All 22 questions UPSC has asked on Lagrangian and Hamiltonian mechanics in the Mathematics Optional (Paper II, Mechanics and Fluid Dynamics) from 2010 to 2026, solved step by step – latest first.
Try them yourself first: the same questions, without solutions, are on our Mechanics and Fluid Dynamics topic-wise PYQs page.
How we check these solutions
These are our own solutions, prepared with AI help. UPSC does not publish official answers. Every solution is checked a second way before it goes up, and says how:
- ✓ Checked by computer the answer was worked out again independently with computer algebra (SymPy): Lagrangians, Hamiltonians, potentials and integrals were derived or evaluated again, and where useful the motion was integrated numerically.
- ✓ Proof checked step by step for “prove that” questions, every step was checked against the definitions.
Spotted a mistake or a neater method? Tell us in the comments below or through Report an error.
Jump to a question (year · question number):
2026 · 7c 2025 · 5d 2025 · 8c(i) 2025 · 8c(ii) 2023 · 5d 2023 · 6c 2022 · 5d 2021 · 5d 2021 · 6c 2020 · 6c 2019 · 7a 2018 · 6c 2018 · 7c 2017 · 6c 2016 · 5c 2016 · 8b 2015 · 6b 2015 · 7c 2014 · 5e 2013 · 8a 2012 · 5d 2010 · 8a
A smooth uniform rod, say , of length and mass is pivoted at one end to a fixed point . The rod is inclined at an angle with the downward vertical line and the plane makes an angle with a fixed vertical plane. A bead of mass slides smoothly on the rod and is connected to by a light elastic string of modulus and natural length . Show that the kinetic energy of the system is given by , where is the stretched length of the string, and derive the equations of motion.
Solution
Coordinates. Take , and (the distance of the bead from , which is the stretched length of the string).
Kinetic energy of the rod. The rod turns about . Its angular velocity has components (in the plane ) and (perpendicular to that plane, about the rod’s own transverse axis). The moment of inertia of the rod about any line through perpendicular to it is So
Kinetic energy of the bead. In spherical polar coordinates about the bead’s speed squared is . Adding, (This is the printed result, with in the first bracket; the there is a misprint.)
Potential energy. The rod’s centre is a depth below and the bead a depth . The string, of natural length and modulus , stores energy . So
Equations of motion (, and we divide by ). Write .
For :
For :
For ( does not appear in , so its momentum is conserved):
✓ Checked by computer We checked by computer: from this and , SymPy’s Euler–Lagrange equations reproduce the three equations of motion below. (The question prints in the rod’s term; the correct factor, used here, is .)
A bead of mass slides on a frictionless wire in the shape of a cycloid given by , , . Find the Lagrangian function. Hence show that the equation of motion can be written as where .
Solution
Take as the height. Then So The potential energy is .
Lagrangian.
Change of variable. Let . Then , so , and
Equation of motion. gives , that is So performs simple harmonic motion of period , whatever the amplitude: the cycloid is a tautochrone.
✓ Checked by computer We checked by computer: with the Lagrangian becomes , and its Euler–Lagrange equation is .
A particle of mass moves in a force field of potential Find the Hamiltonian and the Hamilton’s equations in spherical polar coordinates .
Solution
Lagrangian. In spherical polars, and .
Momenta.
Hamiltonian. does not depend on velocities, so :
Hamilton’s equations. : : So (the angular momentum about the polar axis) is constant, and since has no explicit , (the total energy) is constant too.
✓ Checked by computer We checked by computer: the Legendre transform of gives this , and SymPy’s derivatives of give the six Hamilton’s equations below.
Consider the Lagrangian where and are constants. Find the Hamiltonian and Hamilton’s equations of motion. Identify the system.
Solution
Momenta. So and .
Hamiltonian.
Hamilton’s equations.
Identifying the system. From , ; similarly for : These are the equations of a two-dimensional isotropic harmonic oscillator of angular frequency . The Lagrangian is not the usual , but it gives the same equations of motion.
✓ Checked by computer We checked by computer: the Legendre transform gives , and Hamilton’s equations reduce to , .
A planet of mass is revolving around the sun of mass . The kinetic energy and the potential energy of the planet are given by and , where are the polar coordinates of the planet at time , is the gravitational constant and is the major axis of the ellipse (the path of the planet). Find the Hamiltonian and the Hamilton equations of the planet’s motion.
Solution
Momenta. and .
Hamiltonian. is quadratic in the velocities and does not depend on them, so :
Hamilton’s equations.
Consequences. (conservation of angular momentum, Kepler’s second law), and since has no explicit , is constant (conservation of energy). Eliminating gives the radial equation
✓ Checked by computer We checked by computer: the Legendre transform of gives this , and the derivatives of give the four Hamilton’s equations below.
A mechanical system with 2 degrees of freedom has the Lagrangian where , , , are constants. Find the parameter so that under the transformation the Lagrangian in terms of , will not contain the product term . Find the Lagrange’s equations w.r.t. and independent of parameter .
Solution
Kinetic term. The transformation is a rotation, so .
Potential terms. Write , . Then
Removing the product term. The coefficient of in is It vanishes when
The new Lagrangian. Collecting the and terms, where
Removing . , and choosing the root of with of the same sign as , So
Lagrange’s equations. These are the normal-mode equations: and oscillate independently (provided , i.e. ).
✓ Checked by computer We checked by computer: substituting the rotation into , the coefficient is , and with this the coefficients of equal with as given.
A particle at a distance from the centre of force moves under the influence of the central force , where is a constant. Obtain the Lagrangian and derive the equations of motion.
Solution
Potential. For we need , so .
Lagrangian (plane polar coordinates ):
Equation for . , that is
Equation for . does not appear in , so This is conservation of angular momentum. With the two equations combine to , whose solutions are conics.
✓ Checked by computer We checked by computer: the Euler–Lagrange equations of are the two equations below.
A particle is constrained to move along a circle lying in the vertical -plane. With the help of the D’Alembert’s principle, show that its equation of motion is , where is the acceleration due to gravity.
Solution
Let the circle be with centre and the -axis vertically upward. The particle, of mass , has weight and a reaction from the circle along the normal.
Virtual displacement. Varying the constraint, , so any virtual displacement is for small . It is tangent to the circle, so the normal reaction does no virtual work.
D’Alembert’s principle. with only the applied force : Dividing by ,
Check. With , ( from the downward vertical) this becomes , the pendulum equation.
✓ Proof checked step by step Proof checked step by step (virtual displacement tangent to the circle; the normal reaction does no virtual work).
Obtain the Lagrangian equation for the motion of a system of two particles of unequal masses connected by an inextensible string passing over a small smooth pulley.
Solution
Let the masses be and (), the string have length over the pulley, and be the depth of below the pulley, so is at depth . This is the Atwood machine, with one degree of freedom .
Energies. Both particles move with speed :
Lagrangian.
Lagrange’s equation. gives The heavier mass descends with this constant acceleration. (Applying Newton’s law to alone then gives the tension .)
✓ Checked by computer We checked by computer: the Euler–Lagrange equation of gives .
By writing down the Hamiltonian, find the equations of motion of a particle of mass constrained to move on the surface of a cylinder defined by , is a constant. The particle is subject to a force directed towards the origin and proportional to the distance of the particle from the origin given by , is a constant.
Solution
Coordinates. On the cylinder use : , , .
Energies. . The force has potential .
Hamiltonian. , , and
Hamilton’s equations.
Motion. is constant, so is constant: the particle goes round the axis uniformly. Also , so simple harmonic motion along the generators, of period .
✓ Checked by computer We checked by computer: Hamilton’s equations from this give and .
Using Hamilton’s equation, find the acceleration for a sphere rolling down a rough inclined plane, if be the distance of the point of contact of the sphere from a fixed point on the plane.
Solution
Let the sphere have mass and radius , the plane be inclined at , and be measured down the plane.
Rolling condition. No slipping means the angular velocity is . Friction acts at the point of contact, which is momentarily at rest, so it does no work.
Energies. With about a diameter,
Hamiltonian. , so
Hamilton’s equations. So
✓ Checked by computer We checked by computer: with and , Hamilton’s equations give ; a numerical simulation of rolling with friction gives the same.
Suppose the Lagrangian of a mechanical system is given by where , , , , are constants and . Write down the Lagrangian equations of motion and identify the system.
Solution
Lagrange’s equations. So
Uncoupling. In matrix form, with and , Since , is invertible, so :
Identification. The system is a two-dimensional isotropic harmonic oscillator of angular frequency . When is positive definite, is the squared speed in oblique coordinates, so this is the same oscillator described in non-orthogonal axes.
✓ Checked by computer We checked by computer: the Euler–Lagrange equations are as below, and multiplying by the inverse of gives , .
The Hamiltonian of a mechanical system is given by, , where , are the constants. Solve the Hamiltonian equations and show that constant.
Solution
Hamilton’s equations.
Solving. The first two give Then . A particular solution is , so Next . Trying : , so and Here are constants.
The required quantity. so
✓ Checked by computer We checked by computer: the solution below satisfies all four Hamilton’s equations, and is constant.
Two uniform rods , , each of mass and length , are smoothly hinged together at and move on a horizontal plane. At time , the mass centre of the rods is at the point referred to fixed perpendicular axes , in the plane, and the rods make angles with . Prove that the kinetic energy of the system is Also derive Lagrange’s equations of motion for the system if an external force with components along the axes acts at .
Solution
Let make angle and angle with , and let be the centre of mass of the pair.
Positions. The centres , of , are at distance from along each rod, and is their midpoint. This gives
Kinetic energy. Speed of (and of ) relative to squared is The rods spin with angular velocities , each with moment of inertia about its centre. So
Generalized forces. The work of at in a virtual displacement is . From the position of ,
Lagrange’s equations (the plane is horizontal, so there is no potential):
✓ Checked by computer We checked by computer: building from the two rods’ centres and spins reproduces the printed kinetic energy, and the virtual work of at gives the generalized forces below.
Consider a single free particle of mass , moving in space under no forces. If the particle starts from the origin at and reaches the position at time , find the Hamilton’s characteristic function as a function of .
Solution
A free particle has , so it moves in a straight line with constant velocity. To go from the origin at to at the velocity must be
Hamilton’s function. is the action along the actual path:
Checks. (and similarly for ), and so satisfies the Hamilton–Jacobi equation .
(Strictly, a function of and the time is Hamilton’s principal function. The characteristic function, in terms of the energy , is .)
✓ Checked by computer We checked by computer: equals along the straight-line path and satisfies the Hamilton–Jacobi equation .
A hoop with radius is rolling, without slipping, down an inclined plane of length and with angle of inclination . Assign appropriate generalized coordinates to the system. Determine the constraints, if any. Write down the Lagrangian equations for the system. Hence or otherwise determine the velocity of the hoop at the bottom of the inclined plane.
Solution
Generalized coordinates. Let be the distance moved down the plane by the centre and the angle turned by the hoop (mass , radius ).
Constraint. Rolling without slipping: (that is, ). It is holonomic, so the system has one degree of freedom.
Lagrangian. The hoop’s moment of inertia about its axis is , so
Lagrange’s equations with multiplier for : With , the second gives . Then ( is the friction force up the plane.)
Speed at the bottom. Starting from rest and rolling a distance ,
✓ Checked by computer We checked by computer: eliminating the multiplier gives , so at the bottom; a simulation of the rolling hoop gives the same speed.
Solve the plane pendulum problem using the Hamiltonian approach and show that is a constant of motion.
Solution
Let the bob have mass on a light rod of length , with measured from the downward vertical.
Lagrangian.
Hamiltonian. , so
Hamilton’s equations. Eliminating : which is (period ) for small swings.
is a constant of motion. Along a solution, By Hamilton’s equations the first two terms are , and . So , the total energy, is constant.
✓ Checked by computer We checked by computer: Hamilton’s equations from this give , and vanishes along every solution.
A Hamiltonian of a system with one degree of freedom has the form where , , are constants, is the generalized coordinate and is the corresponding generalized momentum. (i) Find a Lagrangian corresponding to this Hamiltonian. (ii) Find an equivalent Lagrangian that is not explicitly dependent on time.
Solution
Write .
(i) A Lagrangian. From , Substituting into , the terms in and cancel and Then with :
(ii) A time-independent equivalent. The two middle terms form a total derivative: Adding a total time derivative to does not change Lagrange’s equations, so an equivalent Lagrangian is It has no explicit : the system is a harmonic oscillator, .
✓ Checked by computer We checked by computer: the Legendre transform of this gives back the given , and the difference between the two Lagrangians is exactly .
Find the equation of motion of a compound pendulum using Hamilton’s equations.
Solution
Let the body have mass , swing about a fixed horizontal axis, have its centre of gravity at distance from the axis, and moment of inertia about the axis ( is the radius of gyration about the parallel axis through ). Let be the angle between the line from the axis to and the downward vertical.
Lagrangian and Hamiltonian. , so
Hamilton’s equations. So For small oscillations the period is the same as a simple pendulum of length .
✓ Checked by computer We checked by computer: Hamilton’s equations from this give .
Two equal rods and , each of length , smoothly jointed at , are suspended from and oscillate in a vertical plane through . Show that the periods of normal oscillations are where .
Solution
Let each rod have mass , and let and make small angles and with the downward vertical.
Kinetic energy. turns about : . For , moves with speed and the centre of moves relative to with speed . For small angles, Adding,
Potential energy. The centres are at depths and . So, up to a constant and to second order,
Lagrange’s equations (divide by ):
Normal modes. Put and : Expanding and multiplying by : So Hence and the periods of the normal oscillations are .
✓ Checked by computer We checked by computer: the frequency determinant gives with , whose roots are ; a simulation of the linearised equations confirms both periods.
Obtain the equations governing the motion of a spherical pendulum.
Solution
A spherical pendulum is a particle of mass on a light rod (or taut string) of length , free to move on the sphere of radius about the fixed point . Use spherical polars: from the downward vertical and azimuth .
Lagrangian.
Equation for .
Equation for . does not appear in , so the conservation of angular momentum about the vertical.
Energy integral. has no explicit , so Using , this gives a first-order equation for alone:
✓ Checked by computer We checked by computer: the Euler–Lagrange equations of this are the two equations below, and the energy expression is constant along them.
A sphere of radius and mass rolls down a rough plane inclined at an angle to the horizontal. If be the distance of the point of contact of the sphere from a fixed point on the plane, find the acceleration by using Hamilton’s equations.
Solution
Set-up. Let the sphere have mass and radius , be the distance of the point of contact from a fixed point of the plane, measured down the line of greatest slope, and the angle the sphere has turned through.
Constraint. Rolling (no slipping) means the point of contact has zero velocity: . The friction and the normal reaction act at that point, so they do no work and the system is conservative with one degree of freedom .
Energies. The centre moves with speed , and : The centre descends as the contact point moves , so (plus a constant).
Hamiltonian. , so
Hamilton’s equations. Differentiating the first and using the second,
Result. The acceleration is constant, , which is of the value for a smooth plane. Starting from rest at , . The energy integral gives the same result: .
✓ Checked by computer We checked by computer: with and , Hamilton’s equations give ; a numerical simulation of rolling with friction gives the same.
More on Mechanics and Fluid Dynamics
- Mechanics and Fluid Dynamics topic-wise PYQs (questions only, for practice)
- Mathematics PYQ analysis: which units carry the marks year by year
- Year-wise question papers
- Mathematics booklist
Questions: UPSC Civil Services (Main) Examination, Mathematics Paper II, 2010–2026. Solutions: Optional Province. Found an error? Tell us.

