Hamiltonian formalism exercises

Exercise 1 Choose a set of generalized coordinates that totally specify the mechanical state of the following systems:

  1. A particle of mass {m} that moves along an ellipse.

    Let {x=a\cos\theta} and {y=b\sin\theta}. Then the generalized coordinate is {\theta}. Perhaps you might be surprised to find out that we need only a single coordinate to describe the motion of this particle since its motion is described on a plane which is a two dimensional entity. But the particle motion is restricted to be along the ellipse and that constraint decreases the particle’s degrees of freedom to one instead of being two.

  2. A cylinder that moves along an inclined plane.

    If the cylinder rotates we need {x}, the distance travelled, and {\theta}, the angle of rotation. If the cylinder doesn’t rotate we only need {x}.

  3. The two masses on a double pendulum.

    The generalized coordinates are {\theta_1} and {\theta_2}.

    Do you see why?

Exercise 2 Derive the transformation equations for the double pendulum.

It is {x_1=l_1\cos\theta_1}, {x_2=l_1\cos\theta_1+l_2\cos\theta_2}, {y_1=l_1\sin\theta_1} and {y_2=l_1\sin\theta_1+l_2\sin\theta_2}

Exercise 3 Show that {\dfrac{\partial \dot{\vec{r}}_\nu}{\partial \dot{q}_\alpha}=\dfrac{\partial\vec{r}_\nu}{\partial q_\alpha}}.

{\begin{aligned} \vec{r}_\nu&=\vec{r}_\nu(q_1,q_2,\cdots,q_n,t)\Rightarrow \\ \dot{\vec{r}_\nu}&=\dfrac{\partial\vec{r}_\nu }{\partial q_1}\dot{q}_1+\cdots+\dfrac{\partial\vec{r}_\nu }{\partial q_n}\dot{q}_n+\dfrac{\partial\vec{r}_\nu}{\partial t} \Rightarrow \\ \dfrac{\partial \dot{\vec{r}}_\nu}{\partial\dot{q}_\alpha}&=\dfrac{\partial \vec{r}_\nu}{\partial q_\alpha} \end{aligned}}

Exercise 4 Consider a system of particles that experiences an increment {dq_j} on its generalized coordinates. Derive the following expression {dW=\displaystyle \sum_\alpha \Phi_\alpha dq_\alpha} for the total work done by the force and indicate the physical meaning of {\Phi_\alpha}.

First note that

\displaystyle  d\vec{r}_\nu =\sum_{\alpha=1}^n \dfrac{\partial \vec{r}_\nu}{\partial q_\alpha}dq_\alpha

For {dW} it is

{\begin{aligned} dW &=\sum_{\nu=1}^N\vec{F}_\nu\cdot d\vec{r}_\nu\\ &=\sum_{\nu=1}^N\left( \sum_{\alpha=1}^n \vec{F}_\nu\cdot\dfrac{\partial \vec{r}_\nu}{\partial q_\alpha} \right) dq_\alpha\\ &= \sum_{\alpha=1}^n \Phi_\alpha dq_\alpha \end{aligned}}

with {\displaystyle \Phi_\alpha=\sum_{\nu=1}^N \vec{F}_\nu\cdot\dfrac{\partial \vec{r}_\nu}{\partial q_\alpha}} being the generalized force.

Exercise 5 Show that {\Phi_\alpha=\dfrac{\partial W}{\partial q_\alpha}}.

We have {\displaystyle dW=\sum_\alpha\frac{\partial W}{\partial q_\alpha}dq_\alpha} and {\displaystyle dW=\sum_\alpha\Phi_\alpha dq_\alpha}. Hence {\displaystyle \sum_\alpha\left( \Phi_\alpha- \frac{\partial W}{\partial q_\alpha}\right)dq_\alpha=0}. Since {dq_\alpha} are linearly independent it is {\Phi_\alpha=\dfrac{\partial W}{\partial q_\alpha}}.

Exercise 6 Derive the lagrangian for a simple pendulum and obtain an equation to describe its motion.

The generalized coordinate for the simple pendulum is {\theta} and the transformation equations are {x=l\sin\theta} and {y=-l\cos\theta}.

For the kinetic energy it is {K=1/2mv^2=1/2m(l\dot{\theta})^2=1/2ml^2\dot{\theta}^2}.

for the potential {V=mgl(1-\cos\theta)}.

Hence the Lagrangian is {L=K-V=1/2ml^2\dot{\theta}^2-mgl(1-\cos\theta)}.

{\dfrac{\partial L}{\partial \theta}=-mgl\sin\theta} and {\dfrac{\partial L}{\partial \dot{\theta}}=ml^2\dot{\theta}}.

Hence the Euler Lagrange equation is

{\begin{aligned} \frac{d}{dt}\dfrac{\partial L}{\partial \dot{\theta}}-\dfrac{\partial L}{\partial \theta}&=0\Rightarrow\\ ml^2\dot{\theta}+mgl\sin\theta&=0\Rightarrow\\ \ddot{\theta}+g/l\sin\theta=0 \end{aligned}}

Exercise 7 Two particles of mass {m} are connected with each other and to two points {A} and {B} by springs with constant factor {k}. The particles are free to slide along the direction of {A} and {B}. Use the Euler-Lagrange equations to derive the equations of motion of the particles.

The kinetic energy is {K=1/2m\dot{x}^2_1+1/2m\dot{x}^2_2}.

The potential energy is {V=1/2kx^2_1+1/2k(x_2-x_1)^2+1/2kx^2_2}.

Hence the Lagrangian is {L=K-V=1/2m\dot{x}^2_1+1/2m\dot{x}^2_2-1/2kx^2_1-1/2k(x_2-x_1)^2-1/2kx^2_2}.

The partial derivatives of the Lagrangian are:

  1. {\dfrac{\partial L}{\partial x_1}=k(x_2-x_1)}
  2. {\dfrac{\partial L}{\partial x_2}=k(x_1-x_2)}
  3. {\dfrac{\partial L}{\partial \dot{x_1}}=m\dot{x}_1}
  4. {\dfrac{\partial L}{\partial \dot{x_2}}=m\dot{x}_2}

And the Euler-Lagrange equations are:

  1. {m\ddot{x}_1=k(x_2-x_1)}
  2. {m\ddot{x}_2=k(x_1-2x_2)}

Exercise 8 A particle of mass {m} moves subject to a conservative force field. Use cylindrical coordinates to derive:

  1. The Lagrangian.

    The kinetic energy is {K=1/2m(1/2m\dot{\rho}^2+\rho^2\dot{\phi}^2+\dot{z^2})}. The potential is {V=V(\rho,\phi,z)}.

  2. The equations of motion.
    • {m(\ddot{\rho}-\rho\dot{\phi}^2)=-\dfrac{\partial v}{\partial \rho}}
    • {m\dfrac{d}{dt}(\rho^2\dot{\phi}=-\dfrac{\partial V}{\partial \phi}}
    • {m\ddot{z}=-\dfrac{\partial V}{\partial z}}

Exercise 9 A double pendulum oscillates on a vertical plane.


  1. The Lagrangian.

    The transformation equations for the coordinates are

    • {x_1=l_1\cos\theta_1}
    • {y_1=l_1\sin\theta_1}
    • {x_2=l_1\cos\theta_1+l_2\cos\theta_2}
    • {y_2=l_1\sin\theta_1+l_2\sin\theta_2}

    Applying {\dfrac{d}{dt}} to the previous equations

    • {\dot{x}_1=-l_1\dot{\theta}_1\sin\theta_1}
    • {\dot{y}_1=l_1\dot{\theta}_1\cos\theta_1}
    • {\dot{x}_2=-l_1\dot{\theta}_1\sin\theta_1-l_2\dot{\theta}_2\sin\theta_2}
    • {\dot{y}_2=l_1\dot{\theta}_1\cos\theta_1+l_2\dot{\theta}_2\cos\theta_2}

    Hence the kinetic energy is

    \displaystyle K=1/2m_1l^2_1\theta^2_1+1/2m\left[ l^2_1\dot{\theta}^2_1+l^2_2\dot{\theta}^2_2+2l_1l_2\dot{\theta}_1\dot{\theta}_2\cos(\theta_1-\theta_2) \right]

    And the potential is

    \displaystyle  V=m_1g(l_1+l_2-l_1\cos\theta_1)+m_2g\left[l_1+l_2-(l_1\cos\theta_1+l_2\cos\theta_2)\right]

    As always the Lagrangian is {L=K-V=\cdots}

  2. The equations of motion.
    • {\dfrac{\partial L}{\partial \theta_1}=-m_2l_1l_2\dot{\theta}_1\dot{\theta}_2\sin(\theta_1-\theta_2)-m_1gl_1\sin\theta_1-m_2gl_1\sin\theta_1}
    • {\dfrac{\partial L}{\partial \dot{\theta_1}}=m_1	l_1^2\dot{\theta}_1^2+m_2l_1^2\dot{\theta}_1+m_2l_1l_2\dot{\theta}_2\cos(\theta_1-\theta_2)}
    • {\dfrac{\partial L}{\partial \theta_2}=m_2l_1l_2\dot{\theta}_1\dot{\theta}_2\sin(\theta_1-\theta_2)-m_2gl_2\sin\theta_2}
    • {\dfrac{\partial L}{\partial \dot{\theta_2}}=m_2l_2^2\dot{\theta}_2^2+m_2l_1l_2\dot{\theta}_1\cos(\theta_1-\theta_2)}




  3. Assume that {m_1=m_2=m} e {l_1=l_2=l} and write the equations of motion.

    Is left as an exercise for the reader.

  4. Write the previous equations in the limit of small oscillations.

    If {\theta\ll1} implies {\sin \theta\approx\theta} and {\cos \theta\approx1}.

    Hence the equations of motion are



Exercise 10 A particle moves along the plane {xy} subject to a central force that is a function of the distance between the particle and the origin.

  1. Find the hamiltonian of the system.

    The generalized coordinates are {r} and {\theta}. The potential is of the form {V=V(r)}.

    The Lagrangian is {L=1/2m(\dot{r}^2+r^2\dot{\theta}^2)-V(r)}.

    The conjugate momenta are:

    • {p_r=\dfrac{\partial L}{\partial \dot{r}}=m\dot{r}}
    • {p_\theta=\dfrac{\partial L}{\partial \dot{\theta}}=mr^2\dot{\theta}}

    For the Hamiltonian it is

    {\begin{aligned} H&=\displaystyle \sum_{\alpha=n}^np_\alpha\dot{q}_\alpha\\ &=p_r\dot{r}+p_\theta\dot{\theta}-(1/2m(\dot{r^2}+r^2\dot{\theta}^2)-V(r))\\ &=\dfrac{p_r^2}{2m}+\dfrac{p_theta^2}{2mr^2}+V(r) \end{aligned}}

  2. Write the equations of motion.
    • {\dot{r}=\dfrac{\partial H}{\partial p_r}=\dfrac{p_r}{m}}
    • {\dot{\theta}=\dfrac{\partial H}{\partial p_\theta}=\dfrac{p_\theta}{mr^2}}
    • {\dot{p}_r=-\dfrac{\partial H}{\partial r}=\dfrac{p_\theta}{mr^3}-V'(r)}
    • {\dot{p}_\theta=-\dfrac{\partial H}{\partial \theta}=0)}

Exercise 11 A particle describes a one dimensional motion subject to a force

\displaystyle  F(x,t)= \frac{k}{x^2}e^{-t/\tau}

where{k} and {\tau} are positive constants. Find the lagrangian and the hamiltonian.

Compare the hamiltonian with the total energy and discuss energy conservation for this system.

Since {F(x,t)= \frac{k}{x^2}e^{-t/\tau}} it follows {V=\dfrac{k}{x}e^{-t/\tau}}.

For the kinetic energy it is {K=1/2m\dot{x}^2}. Hence the lagrangian is

\displaystyle L=1/2m\dot{x}^2-\dfrac{k}{x}e^{-t/\tau}


Now {p_x=m\dot{x}\Rightarrow\dot{x}=\dfrac{p_x}{m}}.

For the Hamiltonian it is {H=p_x\dot{x}-L=\dfrac{p_x^2}{2m}+\dfrac{k}{x}e^{-t/\tau}}.

Since {\dfrac{\partial L}{\partial t}=0} the system isn’t conservative. Since {\dfrac{\partial U}{\partial \dot{x}}=0} it is {H=E}.

Exercise 12 Consider two functions of the generalized coordinates and the generalized momenta, {g(q_k,p_k)} and {h(q_k,p_k)}. The Poisson brackets are defined as:

\displaystyle [g,h]=\sum_k \left(\frac{\partial g}{\partial q_k}\frac{\partial h}{\partial p_k}-\frac{\partial g}{\partial p_k}\frac{\partial h}{\partial q_k}\right)

Show the following properties of the Poisson brackets:

  1. {\dfrac{dg}{dt}=[g,H]+\dfrac{\partial g}{\partial t}}.

    Left as an exercise for the reader.

  2. {\dot{q}_j=[q_j,H]} e {\dot{p}_j=[p_j,H]}.

    Left as an exercise for the reader.

  3. {[p_k,p_j]=0} e {[q_k,q_j]=0}.

    Left as an exercise for the reader.

  4. {[q_k,p_j]=\delta_{ij}}.

    Left as an exercise for the reader.

    If the Poisson brackets between two functions is null the two functions are said to commute.

    Show that if a function {f} doesn’t depend explicitly on time and {[f,H]=0} the function is a constant of movement.


Newtonian formalism exercises

Exercise 1 A particle of mass {m} moves in the plane {xy}. Its position vector is {\vec{r}=a\cos \omega t \vec{i}+b\sin \omega t \vec{j}} with {a,b,\omega} positive constants and {a>b}. Show that:

  1. The particle’s trajectory is an ellipse.

    For {x=a\cos\omega\ t} and {y=b\sin\omega\ t} it is

    \displaystyle \left( \frac{x}{a} \right)^2+\left( \frac{y}{b} \right)^2=\cos^2\omega t+\sin^2\omega t=1

    Which is the equation of an ellipse

  2. The particle is subject to a central force oriented to the origin

    It is

    {\begin{aligned} \vec{F} &= m\dfrac{d\vec{v}}{dt}\\ &= m\dfrac{d^2\vec{r}}{dt^2}\\ &= m\dfrac{d^2}{dt^2}a\cos \omega t \vec{i}+b\sin \omega t \vec{j}\\ &=-m\omega^2\vec{r} \end{aligned}}

    Which is a central force oriented to the origin (note the minus sign).

Exercise 2 A particle of constant mass {m} is subject to to a force {F}. Suppose that for {t_1} e {t_2} the velocities are {\vec{v}_1} and {\vec{v}_2}, respectively. Show that the work the force does on the particle equals its change in kinetic energy.

{\begin{aligned} W &= \int_{t_1}^{t_2}\vec{F}\cdot d\vec{r}\\ &= \int_{t_1}^{t_2}\vec{F}\cdot\dfrac{d\vec{r}}{dt}dt \\ &= \int_{t_1}^{t_2}\vec{F}\cdot\vec{v}dt\\ &= \int_{t_1}^{t_2}m\dfrac{d\vec{v}}{dt}\cdot\vec{v}dt\\ &=m\int_{t_1}^{t_2}\vec{v}\cdot d\vec{v}\\ &=\dfrac{1}{2} m\int_{t_1}^{t_2}d(\vec{v}\cdot\vec{v})\\ &=1/2m(v_2^2-v_1^2) \end{aligned}}

Exercise 3 For the conditions of exercise 1 calculate:

  1. The particle’s kinetic energy in the positive semi-major axis and on the positive semi-minor axis.

    First note that {\vec{v}=-\omega a\sin \omega t \vec{i}+\omega b \cos \omega t \vec{j}}.

    Now {K=1/2m(\omega^2a^2\sin^2\omega t+\omega^2b^2\cos^2\omega t)}. Let {A} denote the semi-major axis extension and {B} the semi-minor axis extension.

    Hence {K_A=1/2m\omega ^2b^2} and {K_B=1/2m\omega ^2a^2}

  2. The work done by the force field when it moves the particle from the positive semi-major axis to the positive semi-minor axis.

    {\begin{aligned} W &= \int_A^B\vec{F}\cdot d\vec{r}\\ &= \int_A^B(-m\omega ^2\vec{r})\cdot d\vec{r}\\ &= -m\omega ^2\int_A^B\vec{r}\cdot d\vec{r}\\ &= -1/2m\omega ^2\int_A^B d(\vec{r}\cdot\vec{r})\\ &=1/2m\omega ^2(a^2-b^2) \end{aligned}}

  3. The total work done by the force field by moving the particle along the ellipse.

    {W=0}. Do you see why?

Exercise 4 Show that if a particle is subject to {\vec{F}} and {\vec{v}} is its instantaneous velocity then the instantaneous power is

\displaystyle  \mathcal{P}=\vec{F}\cdot\vec{v}

By definition it is {dW=\vec{F}\cdot d\vec{r}}. Hence

{\begin{aligned} \mathcal{P}&=\dfrac{dW}{dt}\\ &= \vec{F}\cdot\dfrac{d\vec{r}}{dt}\\ &= \vec{F}\cdot\vec{v} \end{aligned}}

Exercise 5 Show that the integral {\displaystyle \int _{P_1}^{P_2} \vec{F}\cdot d\vec{r}} is independent of a particle’s trajectory if and only if { \displaystyle\oint\vec{F}\cdot d\vec{r}=0 }.

Let {\Gamma=P_1AP_2BP_1} denote a closed curve and admit that {\displaystyle \int _{P_1}^{P_2} \vec{F}\cdot d\vec{r}} is path independent. Then

{\begin{aligned} \oint \vec{F}\cdot d\vec{r}&=\int_\Gamma\vec{F}\cdot d\vec{r} \\ &= \int_{P_1AP_2}\vec{F}\cdot d\vec{r}+\int_{P_2BP_1}\vec{F}\cdot d\vec{r}\\ &= \int_{P_1AP_2}\vec{F}\cdot d\vec{r}-\int_{P_1BP_2}\vec{F}\cdot d\vec{r}\\ &=0 \end{aligned}}

Where the last equality follows from our assumption that {\displaystyle \int _{P_1}^{P_2} \vec{F}\cdot d\vec{r}} is path independent.

Suppose now that { \displaystyle\oint\vec{F}\cdot d\vec{r}=0 }.

{\begin{aligned} \int_\Gamma\vec{F}\cdot d\vec{r}&=\int_{P_1AP_2}\vec{F}\cdot d\vec{r}+\int_{P_2BP_1}\vec{F}\cdot d\vec{r}\\ &= \int_{P_1AP_2}\vec{F}\cdot d\vec{r}-\int_{P_1BP_2}\vec{F}\cdot d\vec{r}\\ &=0 \end{aligned}}

Where the last equality follows from our { \displaystyle\oint\vec{F}\cdot d\vec{r}=0 }. Hence {\displaystyle\int_{P_1AP_2}\vec{F}\cdot d\vec{r}=\int_{P_1BP_2}\vec{F}\cdot d\vec{r}}.

Exercise 6 A particle of mass {m} moves along {x} subject to to a conservative force field {V(x)}. If the particle’s positions are {x_1} and {x_2} on {t_1} and {t_2}, respectively, show that, if {E} is the total energy then

\displaystyle  t_2-t_1=\sqrt{\frac{m}{2}}\int_{x_1} ^{x_2}\frac{dx}{\sqrt{E-V(x)}}

Write {1/2m\left( \dfrac{dx}{dt} \right)^2+V(x)=E} solve in order to {dt} and integrate.

Exercise 7 Consider a particle of mass {m} that moves vertically on a resistive medium where the retarding force is proportional to the particle’s velocity. Consider that particle initially moves in the downward direction with an initial velocity {v_0} from an height {h}. Derive the particle’s equation of motion {z=z(t)}.

It is {F=m\dfrac{dv}{dt}=-mgg-kmv} with {v<0} and {-kmv>0}. Then solve in order to {dv} and integrate to find {v=\dfrac{dz}{dt}=-\dfrac{g}{k}+\dfrac{kv_0+g}{k}e^{-kt}} (the terminal velocity {v_t} is {v_t=\displaystyle \lim_{t \rightarrow +\infty} v=-g/k}).

Solving in order to {dz} and integrating and it is {z=h-\dfrac{gt}{k}+\dfrac{kv_0+g}{k^2}(1-e^{-kt})}.

Exercise 8 A particle is shot vertically on a region where exists a constant gravitational field with a constant initial velocity {v_0}. Show that, in the presence of resistive force proportional to the square of the particle’s instantaneous velocity, the velocity of the particle when it returns to its initial position is:

\displaystyle  \frac{v_0 v_t}{\sqrt{v_0^2+v_t^2}}

Where {v_t} denotes the particle’s terminal velocity.