# Lorentz force from velocity-dependent potential and Lagrangian

There is something I'm missing. I am at page 22-23 of Goldstein Classical Mechanics 3rd ed. Lorentz force can be derived from the Lagrangian

$$L=T-U$$ where $T$ is the kinetic energy $$T= \dfrac{1}{2}m\dot{x}^2 ,$$ and $U$ is the potential energy

$$U=q\phi-q\mathbf{A}\cdot\mathbf{v}$$

where $\phi(t,x,y,z)$ is a scalar potential and $\mathbf{A}(t,x,y,z)$ is a vector potential.

I'm trying to solve this with Lagrange equations for the x coordinate, and for the term

$$\frac{d}{dt}\big(\frac{\partial{L}}{\partial\dot{x}}\big)$$

I'll show you how I'm trying to compute this with detail:

$$\frac{d}{dt}\big(\frac{\partial{L}}{\partial\dot{x}}\big)=m\ddot{x}-q\frac{d}{dt}(\frac{\partial{}}{\partial{\dot{x}}}\phi)+q\frac{d}{dt}(\frac{\partial\mathbf{A}}{\partial{\dot{x}}}\cdot\mathbf{v}+\frac{\partial\mathbf{v}}{\partial{\dot{x}}}\cdot\mathbf{A})$$

Now, here's my big problem, I'll may have some trouble understanding the condition in which I can interchange the differentiation with respect to $\dot{x}$ and $t$, i.e for example,

$$q\frac{d}{dt}(\frac{\partial{}}{\partial{\dot{x}}}\phi)=q\frac{\partial{}}{\partial{\dot{x}}}(\frac{d}{dt}\phi)$$

This is done some pages before when Goldstein is deriving the lagrange equations, and I solved a problem in this chapter usig this. So now I have:

$$q\frac{\partial{}}{\partial{\dot{x}}}(\frac{\partial{}}{\partial{x}}\phi\frac{dx}{dt}+\frac{\partial{}}{\partial{y}}\phi\frac{dy}{dt}+\frac{\partial{}}{\partial{z}}\phi\frac{dz}{dt}+\frac{\partial{}}{\partial{t}}\phi)$$

Now I have looked now for many hours for many ways in which this derivation is made and the expression above vanishes, but I don't understand why, is it because I'm assuming x,y,z in the scalar potential are functions of time themselves? If not I can see why it would vanish. Also, this vanishes because I can't exchange the order of differentiation?

I totally see what you mean, I was applying it wrong, after you answered me I encountered that final term $\frac{\partial \phi}{\partial q_i}$, I had to substract it because it was actually:

$$q\frac{d}{dt}(\frac{\partial{}}{\partial{\dot{x}}}\phi)=q[\frac{\partial{}}{\partial{\dot{x}}}(\frac{d}{dt}\phi)-\frac{\partial f}{\partial q_i}]$$

Thanks a lot you're awesome!

Both $\mathbf{E}(t,x,y,z)$ and $\mathbf{B}(t,x,y,z)$ are continuous functions of time and position derivable from a scalar potential $\phi(t,x,y,z)$ and a vector potential $\mathbf{A}(t,x,y,z)$
i.e., these terms are not dependent on $\mathbf{v}$.
Thus, $$\frac{\partial\phi}{\partial\dot{x}}=\frac{\partial\mathbf{A}}{\partial\dot{x}}=0$$ and, trivially, the time derivatives are also zero. The only term that depends on $\dot{x}$ is the kinetic energy term, hence the appearance of $m\ddot{x}$ and the disappearance of your term.
With regards to interchanging derivatives, with an ordinary derivative you can write it as $$\frac{df}{dt} = \sum_{n=1}^p\frac{\partial f}{\partial q_n}\dot{q}_n+\frac{\partial f}{\partial t}$$ for any $f(q_1,\ldots,q_p,\dot{q}_1,\ldots,\dot{q}_p,t)$. If you multiply the above by $\partial/\partial \dot{q}_i$ and carefully apply partial derivatives, you will actually find $$\frac{\partial}{\partial\dot{q}_i}\left(\frac{df}{dt}\right) = \frac{d}{dt}\left(\frac{\partial f}{\partial \dot{q}_i}\right)+\frac{\partial f}{\partial q_i}$$ (in your case, $\dot{q}_i=\dot{x}$).
For partial derivatives, it should be straight-forward that $$\frac{\partial^2f}{\partial x\partial y}=\frac{\partial^2f}{\partial y\partial x}$$