Particle on a hemisphere - lagrange 
A particle of mass $m$ is on top of a frictionless hemisphere centered at the origin with radius $R$. It starts sliding down the hemisphere.
Set up the Lagrange equations of the first kind and determine the constraint force and the point at which the particle detaches from the hemisphere as well as its velocity at that point. Set up the Lagrange equations of the first kind for polar coordinates and find the angle and angular velocity at which the particle detaches.


I have been reading about Lagrange equations and the exercise in theoretical physics this week deals with the first kind. I'm having troubles setting this up. Still not used to the method with which one solves problems like this with the lagrangian.
I know how to solve this problem without using the :agrangian and the answers are correct, but I still don't know how to get to the same solutions with the lagrangian. Although my prof said that I would be allowed to use a different method to solve this problem if I were to have troubles with the Lagrangian. But I really want to know how to solve this with the Lagrangian.
I mean, I know that the constraint force is the centrifugal force since I used that assumption to solve this with my method, but it's hard to imagine how the Lagrangian would give me a conclusive proof that the constraint force is really the centrifugal force.
Before I created this post I searched for similar questions on SE and found one for a particle on a sphere. So I guess basically the same since the detachment point is on the upper hemisphere anyway. The answer to that post was a PDF and although I read through it it didn't make it much clearer to me and as far as I could see it didn't show the constraint force.
 A: 
Considering the situation in the schematics above, we can start out with the radial position of the particle given by 
\begin{equation}
\mathbf{r}=r\left( \sin\theta, \cos\theta \right),
\end{equation}
where we assume for now that $r=r(t)$ and $\theta=\theta(t)$. Its radial velocity will then be given by 
\begin{equation}
\mathbf{\dot r}=\dot r\left( \sin\theta, \cos\theta \right) + r\dot\theta\left( \cos\theta, -\sin\theta \right).
\end{equation}
The Kinetic Energy of the particle during its motion can now be established as a function of $r$, $\dot r$ and $\dot \theta$ as:
\begin{equation}
T=\frac{1}{2}m\mathbf{\dot r}^2=\frac{1}{2}m\left( \dot r^2 + r^2\dot\theta^2 \right).
\end{equation}
Its Potential Energy would be:
\begin{equation}
V=mg r\cos\theta,
\end{equation}
where $r\cos\theta$ corresponds to the particle instantaneous height. If we were not interested in finding a constraint force, the Lagrangian of this situation would be
\begin{equation}
L=T-V=\frac{1}{2}m\left( \dot r^2 + r^2\dot\theta^2 \right) - mg r\cos\theta.
\end{equation}
But, the hemisphere exerts a reaction force towards the particle in order to prevent it from sinking on its surface. This leads to a holonomic constraint imposing that the distance between the hemisphere center and the particle equals the constant hemisphere radius: $r=R$. Or to be more specific,
\begin{equation}
f(r)=r-R=0.
\end{equation}
Since the goal here is to get information on constraint forces, we should then employ Lagrange's "$\lambda$-method" by establishing a new Lagrangian which takes into account the previous holonomic constraint. We can achieve this by defining a new Potential Energy as:
\begin{equation}
V'=V+\lambda f(r).
\end{equation}
(This is possible only because the constraint is holonomic)
Therefore, the new Lagrangian will be:
\begin{equation}
L=T-V'=\frac{1}{2}m\left( \dot r^2 + r^2\dot\theta^2 \right) - mg r\cos\theta - \lambda(r-R).
\end{equation}
The equations of motion are derived as usual, only this time, the right hand side will hold the generalized forces:
\begin{equation}
\frac{d}{dt}\frac{\partial L}{\dot r}-\frac{\partial L}{\partial r}=\lambda\frac{\partial f}{\partial r}
\end{equation}
\begin{equation}
\frac{d}{dt}\frac{\partial L}{\dot \theta}-\frac{\partial L}{\dot \theta}=\lambda\frac{\partial f}{\partial \theta}
\end{equation}
leading to the two equations of motion:
\begin{equation}
m\ddot r - mr\dot\theta^2+mgcos\theta=\lambda
\end{equation}
\begin{equation}
mr^2\ddot\theta=mgr\sin\theta.
\end{equation}
We shall remember that the constraint tells us that $\ddot r = 0$. Therefore, the equations of motion simplify in:
\begin{equation}
- mR\dot\theta^2+mgcos\theta=\lambda
\end{equation}
\begin{equation}
\ddot\theta=\frac{g}{R}\sin\theta.
\end{equation}
$\mathbf{\lambda}$ corresponds to the force of constraint. It is indeed the force exerted by the surface of the hemisphere towards the particle in order to keep it at a constant distance from its center (also called normal force). We shall now determine the value of this force of constraint as a function of solely the angle $\theta$.
First of all, we know that 
\begin{equation}
\frac{d}{dt}\dot\theta^2 = 2\dot\theta\ddot\theta,
\end{equation}
and from our second equation of motion, we can establish that 
\begin{equation}
\frac{d}{dt}\dot\theta^2 = 2\frac{g}{R}\dot\theta\sin\theta = -2\frac{g}{R}\frac{d(\cos\theta)}{dt}.
\end{equation}
This relation can be integrated over time on both sides in order to rid us from the time derivatives, leading to: 
\begin{equation}
\dot\theta^2=-2\frac{g}{R}\cos\theta + c,
\end{equation}
where $c$ is an integration constant corresponding to the initial velocity. Assuming that the initial velocity is zero, we end up with the relation
\begin{equation}
\dot\theta^2=-2\frac{g}{R}\cos\theta.
\end{equation}
By injecting this last relation into our first equation of motion involving $\lambda$, we provide a constraint force which is a function of solely $\theta$:
\begin{equation}
 \lambda=2mR\frac{g}{R}\cos\theta + mg\cos\theta = mg(3\cos\theta-2)
\end{equation}
When the particle is no longer in contact with the surface of the hemisphere, it means that the constraint force is no longer active and therefore equals zero. This provides the following $\theta$ value
\begin{equation}
\theta_{final}=\cos^{-1}\frac{2}{3} = 48.19^{\circ}.
\end{equation}
We now use this last value of $\theta$ and inject it into our initial equation of motion involving $\lambda$ (the one that is function of $\theta$ and $\dot\theta$). We do this in order to find the angular velocity at which the particle detaches:
\begin{equation}
\dot\theta^2=\frac{g}{R}\cos\theta_{final} = \frac{2g}{3R},
\end{equation}
leading to the detachment velocity:
\begin{equation}
\dot\theta_{final}=\sqrt{\frac{2g}{3R}},
\end{equation}
