# Swinging Atwood and Hoop And Pulley Lagrangian

The picture is showing the swinging atwood and a hoop and pulley.

I know the lagrangian for both two, I have no problem with the kinetic energy of both but i couldn't convince myself that for the swinging atwood, the potential energy is : $$V = Mgr - mgr \cos\theta$$ and for the hoop and pulley, the potential energy is : $$V = -Mgr \cos\theta - mgr\theta$$

where $$\theta$$ is the angle mass $$m$$ makes with vertical

I'm having the sign problem here. I don't understand why for the atwood we use $$+Mgr$$ and the hoop we use $$-mgr\theta$$

When and how do we use the $$+$$ and $$-$$ sign?

In the first case we have $$Mgr$$ because as $$r$$ increases the potential energy increases for the block of mass $$M$$. In the second case we have $$-mgR\theta$$ because when $$\theta$$ increases the potential energy decreases for the block of mass $$m$$.