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?