Physics Stack Exchange is a question and answer site for active researchers, academics and students of physics. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have to find the Hamiltonian of a charged particle in a uniform magnetic field; the potential vector is $ \vec {A}= B/2 (-y, x, 0)$.

I know that $$H=\sum_i p_i \dot q_i -L$$ where $p_i$ is conjugated momentum, $\dot q_i$ is the velocity and $L$ is the Lagrangian.

The result that I should obtain is $$H=\frac{1}{2} m(\dot x^2+ \dot y^2)= \frac {1}{2m}(p_x^2+ p_y^2)+ \frac{1}{2}\omega^2 (x^2+y^2)+ \omega (p_x y- p_y x)$$, where $\omega= \frac{eB}{2mc}$.

I obtain this result only if I don't consider in the Hamiltonian the potential magnetic, and if I substitute only at the last step the values of velocities in function of conjugata momenta.

Considering that the magnetic field isn't a field of conservative forces, I ask you:

if I have a system in a non conservative field, is it correct to not consider the potential of the non conservative force when I'm writing the Hamiltonian? are my steps correct? thank you.

share|cite|improve this question
up vote 2 down vote accepted

1) We start writing the Lagrangian

$$L=\frac{1}{2}mv^2+q\vec{v}\cdot\vec{A}=\frac{1}{2}m(v_x^2+v_y^2+v_z^2)+q\frac{B}{2}\left(-yv_x+xv_y \right)$$

2) We find the momenta

$$p_{x}=\frac{\partial L}{\partial v_{x}}=mv_{x}-\frac{qBy}{2}$$

$$p_{y}=\frac{\partial L}{\partial v_{y}}=mv_{y}+\frac{qBx}{2} $$

$$ p_{z}=\frac{\partial L}{\partial v_{z}}=mv_{z} $$

3) We express the Hamiltonian, performing a Legrende transformation between velocities and momenta as usual, and solving for the velocities as a function of the coordinates and momenta

$$ v_{x}=\frac{1}{m}\left(p_x+\frac{qBy}{2}\right) $$

$$ v_{y}=\frac{1}{m}\left( p_y-\frac{qBx}{2} \right) $$

$$ v_{z}=\frac{p_{z}}{m} $$


$$ H=\sum_{i} p_{i}v_{i}-L\bigg|_{v=v(p,q)}=\frac{p_{x}}{m}\left(p_{x}+\frac{qBy}{2}\right)+\frac{p_{y}}{m}\left(p_{y}-\frac{qBx}{2} \right)+\frac{p_z^2}{m}-\frac{1}{2m}\left[\left(p_{x}+\frac{qBy}{2}\right)^2+\left(p_{y}-\frac{qBx}{2} \right)^2+p_z^2\right]-q\frac{B}{2}\left[-\frac{y}{m}\left(p_{x}+\frac{qBy}{2}\right)+\frac{x}{m}\left(p_{y}-\frac{qBx}{2} \right) \right]$$

Expanding the squares

$$ H=\frac{p_x^2}{m}+\frac{p_xqBy}{2m}+\frac{p_y^2}{m}-\frac{p_yqBx}{2m}+\frac{p_z^2}{m} -\frac{1}{2m}\left(p_x^2+\frac{q^2B^2y^2}{4}+p_xqBy+p_y^2+\frac{q^2B^2x^2}{4}-p_yqBx+\frac{p_{z}^2}{m}\right)-\frac{qB}{2m}\left( -yp_x -\frac{qBy^2}{2}+xp_y-\frac{qBx^2}{2}\right)$$

Taking common factors

$$ H=\frac{p_x^2}{2m}+\frac{p_y^2}{2m}+\frac{p^2_{z}}{2m}+p_{x}\left( \frac{qBy}{2m}-\frac{qBy}{2m}+y\right)+p_y\left( -\frac{qBx}{2m}+\frac{qBx}{2m}-x\right) -\frac{q^2B^2y^2}{2·4m}-\frac{q^2B^2x^2}{2·4m}+\frac{qB^2y^2}{4m}+\frac{qB^2x^2}{4m}$$



In the textbook they problably decided to obviate the $p_z$ because, given that $A_z=0$ the Lagrangian does not depende on $v_z$ so $p_z$ is a constant.

share|cite|improve this answer
thanks for your answer! :) – sunrise Jan 17 '13 at 9:25
can I follow these steps for every case, either I have a velocity-dependent potential either I have a non generalized potential? – sunrise Jan 17 '13 at 9:28
In this case you have a velocity dependent potential via the term $q\vec{v}\cdot\vec{A}$ and you can use it following the usual steps. What do you mean by a non generalized potential? if you mean a force non derivable from a potential, please take a look at this question and specifically at the first answer… – Jorge Jan 17 '13 at 9:34
For "generalized potential" I mean a "velocity-dependent potential" and for "not generalized potential" a potential dependent only on coordinates.. – sunrise Jan 17 '13 at 13:34
Then the answer is yes, this is the very general prescription to translate a problem of Lagrangian mechanics into a problem of Hamiltonian mechanics. 1)Lagrangian 2) Hamiltonian $\sum v_ip_i -L$ (as a function coordinates and momenta, not velocities!) 3) Hamilton's equations 4) Profit! – Jorge Jan 17 '13 at 13:42

The potential of a charged particle in an electromagnetic field is:

$$U(r,v,t)=q\phi -q\mathbf{v}\cdot A$$

Being $\phi$ the electric potential, $v$ the speed of the particle, $q$ the charge of the particle, and $A$ the vector potential of the magnetic field. Make sure su haven't made any mistakes calculating the lagrange equations (when you derive by $d/dt$, remember $\mathbf{v}$ is a function of time.

The Lagrangian will be:

$$L=\frac{1}{2}mv^2-q\phi +q\mathbf{v}\cdot A$$

Again, make sure you haven't made arithmetic mistakes.

share|cite|improve this answer
thank you, but the particle is in a magnetic field and not in an electromagnetic field... – sunrise Jan 15 '13 at 18:33
@sunrise Then the only thing you have to do is remove the electric field term of the potential: $q\phi$, and there you go. – MyUserIsThis Jan 15 '13 at 18:39
sure! but my problem is about the Hamiltonian not about Lagrangian.. :( – sunrise Jan 15 '13 at 18:52
$H=m\dot x ^2+m\dot y^2-1/2m\dot x^2-1/2m\dot y^2-qvA\sin\alpha$, being $\alpha$ the angle bewtween $v$ and $A$, get that angle and operate. – MyUserIsThis Jan 15 '13 at 19:04
the book tells me that the result is $H=\frac{1}{2}m(\dot x^2+ \dot y^2)$ and I have no information about any angle.. :( – sunrise Jan 15 '13 at 19:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.