# How to calculate the Hamiltonian from the Lagrangian for a non-relativistic charged point particle in an EM field?

I was given the equation of the Lagrangian: \begin{equation} L~=~\frac{1}{2}m \dot{x}^2+\frac{e}{c}\vec{\dot{x}}\cdot \vec{A}(\vec{x},t)-e\phi (\vec{x},t). \end{equation} I proceeded to use the equation: \begin{equation} H~=~\sum_{i} \dot{q_i} \frac{\partial L}{\partial \dot{q_i}} -L \end{equation} to get the Hamiltonian as: \begin{equation} H~=~\frac{1}{2}m \dot{x}^2+e\phi (\vec{x},t), \end{equation} but, in the text, the Hamiltonian is given as: \begin{equation} \hat{H}~=~\frac{1}{2m}(\frac{\hbar}{i}\nabla - \frac{e}{c}\vec{A})\cdot(\frac{\hbar}{i}\nabla - \frac{e}{c}\vec{A})+e\phi \end{equation} So,why and where did I go wrong?

• Remember that $H$ is a function of $p$, not $\dot{x}$. Your solution is not written in that form. The answer you approved does this. – garyp Mar 26 '15 at 13:57

To make the correct answer clearer, allow me to introduce the canonical momentum $\vec{p}$, given by: $$\vec{p}=\dfrac{\partial L}{\partial\dot{x}}$$ This way we can rewrite the Hamiltonian as: $$H=\vec{p}\cdot\vec{\dot{x}}-L$$ Let's start by computing $\vec{p}$: $$\vec{p}=\dfrac{\partial L}{\partial\dot{x}}=m\vec{\dot{x}}+\dfrac{e}{c}\vec{A}(\vec{x},t)$$ And you get: \begin{align}H&=m\dot{x}^2+\dfrac{e}{c}\vec{x}\cdot\vec{A}-\dfrac{1}{2}m\dot{x}^2-\dfrac{e}{c}\vec{\dot{x}}\cdot\vec{A}+e\phi\\&=\dfrac{1}{2}m\dot{x}^2+e\phi\end{align} But from the expression of the canonical momentum we found earlier, you can rewrite $\vec{\dot{x}}$ as: $$\vec{\dot{x}}=\dfrac{1}{m}\left(\vec{p}-\dfrac{e}{c}\vec{A}\right)$$ Such that: $$\dot{x}^2=\dfrac{1}{m^2}\left|\vec{p}-\dfrac{e}{c}\vec{A}\right|^2$$ Plugging this result into $H$: $$H=\dfrac{1}{2m}\left|\vec{p}-\dfrac{e}{c}\vec{A}\right|^2+e\phi$$ Make the transition to quantum mechanics by promoting the classical momentum $\vec{p}$ to the operator $\hat{p}=-i\hbar\nabla$ and you're done.
• Nota: $-i=\frac{1}{i}$. – Demosthene Mar 26 '15 at 10:20