Potential Energy of Lagrangian system I want to clear my  basic understanding  of Lagrangian system. I am confused about the potential energy for  the Lagrangian system. 

According to this picture, m is suspended from a rigid massless rod of length l  but free to rotate otherwise. I am good at finding the kinetic energies of the system but i am confused after seeing the potential term done by a text which is 
$$U= mg l\cos \theta $$
But what i get is $U = mg l(1-\cos \theta )$ the height is calculated on the below picture. 
Can you please tell me what is going on here? 

 A: You are correct that the potential energy of this system is:
\begin{align*}
U=mgl(1-\cos{\theta})
\end{align*}
when you take the potential energy to be zero at the bottom of the pendulums swing. However, because ($mgl$) is a constant and will play no part in the dynamics of the pendulum, you can throw it out. You can see this by finding the equations of motion and noting that the constant term ($mgl$) disappears. 
Throwing the term ($mgl$) out amounts to saying that the potential energy is zero at the top of the pendulum, or put another way, zero height is located at the top of the pendulum and anything below this is negative height. The vertical distance the mass is below the top of the pendulum is as you found $l\cos{\theta}$, so if you were to represent $y$ as the height, the pendulum mass would be located at a height: 
\begin{align*}
y=-l\cos{\theta}
\end{align*} 
The potential energy of the mass is then:
\begin{align*}
U=mgy=-mgl\cos{\theta}.
\end{align*}
The reason you are seeing a positive instead of a negative term probably comes from the fact that the Lagrangian is (where $T$ is the kinetic energy): \begin{align*}
L=T-U
\end{align*}
so this would be written as:
\begin{align*}
L=T+mgl\cos{\theta}
\end{align*}
If you are truely seeing that the potential energy for this problem is $U=mgl\cos{\theta}$ then I believe there is a mistake in the text.
