A mass $m$ is attached to the end of a light inextensible string, which is wound around a cylindrical wheel of radius $a$. The moment of inertia of the wheel, about an axis perpendicular to the wheel, is $I$. The axis of the wheel is horizontal, gravity acts downwards with magnitude g.
Let $q$ be the angle rotated by the wheel. Calculate the kinetic energy and potential energies of the system in terms of $q$ and $\dot{q}$. Hence calculate the Lagrangian and derive the equation of motion.
This was our homework for last week but we haven't gotten the answer to it yet and I just don't know how to go about it. Diagram of the situatuion given.