I was trying to solve the classical problem of finding when a mass sliding on a frictionless dome loses contact with said dome.
I got the lagrangian $$L=\frac{1}{2}M\left(r\,\dot{\theta}\right)^2-Mgr\cos\theta$$ and I got the 2 lagrangian equations (with the lagrangian multipliers):
$$Mr\dot{\theta}^2-Mg\cos\theta+\lambda=0$$
&
$$Mr^2\ddot{\theta}-Mgr\sin\theta=0$$
I've now managed to solve the problem, but on my first attempt I thought it was a good idea to isolate $\dot{\theta}$ on the first equation to write $\dot{\theta}=\sqrt{\frac{g}{r}\cos\theta-\frac{\lambda}{Mr}}$. Then, I calculated the derivative:
$$\ddot{\theta}=\frac{-\frac{g}{r}\sin\theta\,\dot{\theta}}{2\sqrt{\frac{g}{r}\cos\theta-\frac{\lambda}{Mr}}}=\frac{-\frac{g}{r}\sin\theta\,\dot{\theta}}{2\dot{\theta}}=-\frac{g}{2r}\sin\theta$$
The problem is that, from the second equation, I get:
$$\ddot{\theta}=\frac{g}{r}\sin\theta$$
How can this be?