This is a problem my professor worked on in class:
The first thing he said was that we would use position 2 as the "reference height" and I'm not sure what that means exactly. He goes on to say that this means that position 1 has a positive gravitational potential energy and position 3 has a negative gravitational potential energy. I understand that as the block goes down the incline, the gravitational potential energy should decrease as it is converted into kinetic energy, but I guess I'm not really sure why it's negative at position 3.
He then says we can basically ignore what happens in position 2 because total mechanical energy is the same, and this is where I get confused.
He gives us $$\tfrac{1}{2} mv^2 + mgd\sin\theta = -mgx\sin\theta + \tfrac{1}{2}kx^2$$ and tells us to solve for $x$. I feel like I understand the left side of that equation. The initial kinetic energy is the one with the known velocity that was given, since it was projected downward with a given speed, while $mgd\sin\theta$ represents the gravitational potential energy. Then on the right side, which is where I'm confused, the kinetic energy is 0 because the block has momentarily stopped. Hence $-mgx\sin\theta + \tfrac{1}{2}kx^2$ represents the total potential energy. Why is $-mgx\sin\theta$ negative and why isn't $kx^2$ negative? The reason I ask about $kx^2$ is because it seems like the displacement of the spring is opposite the direction of the force exerted by the spring, so I would expect the work done to be negative.
And finally, how come one side is equal to the other if the right side involves a completely different aspect to it (the spring) that isn't found in the initial conditions. I'm getting confused as to which forces I'm supposed to be keeping track of.