Solution (source code)

= Solution

Let $\theta$ be the angle from the downward vertical to the hoop's centre, measured at the suspension point, and let $\phi$ be the absolute angle from the downward vertical to the bead's radius from the hoop centre. The bead position is the sum of two <vectors> of length $a$. Including the hoop's moment of inertia about the pivot gives
$$
T=\frac{ma^2}{2}
\left(3\dot\theta^2+\dot\phi^2
+2\dot\theta\dot\phi\cos(\theta-\phi)\right),
$$
while
$$
V=-mga(2\cos\theta+\cos\phi).
$$
Thus one suitable <Lagrangian> is
$$
\boxed{
L=\frac{ma^2}{2}
\left(3\dot\theta^2+\dot\phi^2
+2\dot\theta\dot\phi\cos(\theta-\phi)\right)
+mga(2\cos\theta+\cos\phi)}.
$$