Lagrangian of charged particle in magnetic field

I am aware that this question has been asked before, but the answer uses a formula I haven't seen before, and I was wondering if there is another more intuitive way to solve this problem.

I wish to find the Lagrangian of a charged particle ($q$) in a magnetic field $B=\nabla\times A$.
Lorentz force equation gives \begin{align}F=-\nabla V&=q(v\times B)\\ -\frac{\partial V}{\partial x_i}&=q\epsilon_{ijk}\epsilon_{kab}v_j\frac{\partial A_b}{\partial x_a}\\ &=q(\delta_{ai}\delta_{bj}-\delta_{aj}\delta_{bi})v_j\frac{\partial A_b}{\partial x_a}\\ \implies-\nabla_i V&=\nabla_i[q(v\cdot A)]-q(v\cdot\nabla)A_i\\\end{align} So we get $$\nabla[V+q(v\cdot A)]=q(v\cdot \nabla)A$$ I believe the answer is $V=-q(v\cdot A)$, but I don't know how to conclude it from here. It looks like if both sides are $0$, then it could be proved, since we only need to know $V$ up to a constant. But why should either of these sides be zero? How can I finish this?

Edit

After some guidance in the comments by JM1, I have got to the point that $$\nabla[V+q(\dot{x}\cdot A)]=(\dot{x}\cdot\nabla)\frac{\partial}{\partial \dot{x}}[V+q(\dot{x}\cdot A)]\\\implies\left(\nabla-(\dot{x}\cdot\nabla)\frac\partial{\partial \dot{x}}\right)[V+q(\dot{x}\cdot A)]=0$$ I then tried to simplify this operator as follows: $$\frac{\partial}{\partial x_i}-\dot x_j\frac{\partial}{\partial x_j}\frac{\partial}{\partial \dot x_i}=\left(\delta_{ij}-\dot x_j\frac{\partial}{\partial \dot x_i}\right)\frac{\partial}{\partial x_j}=\left(2\delta_{ij}-\frac{\partial}{\partial \dot x_i}(\dot x_j~\cdot)\right)\frac{\partial}{\partial x_j}$$which didn't do much really. It looks really close to finished but I don't see how to finish it. Is it sufficient to say the operator bracket is non-zero, so $V+q(\dot x\cdot A)=0$?

• Consider the possibility that for this Lagrangian $\partial V/\partial \dot x$ might not be equal to $0$. – JM1 Dec 22 '17 at 7:39
• I don't see where I have assumed that it is $0$. Is my expression for the force, as $-\nabla V$, incorrect? – John Doe Dec 22 '17 at 12:49
• The way you made the assumption is subtle, but choosing $\mathbf{F} = -\nabla V$ implies $\partial V/\partial \dot x_i = 0$. Remember that you are constructing $L = T - V$ such that $$\frac{d}{dt}\left(\frac{\partial L}{\partial \dot x_i}\right) - \frac{\partial L}{\partial x_i} = 0$$ simplifies to $m \mathbf{\ddot r} = q(\mathbf{v} \times \mathbf{B})$. I'd suggest trying $$\frac{d}{dt}\left(\frac{\partial V}{\partial \dot x_i}\right) - \frac{\partial V}{\partial x_i} = q \epsilon_{ijk} v_j B_k$$ – JM1 Dec 22 '17 at 13:31
• Ah yes I see now where that comes from. Then this would give that $$\nabla_i[V+q(v\cdot A)]=q(v\cdot\nabla)A_i+\frac d{dt}\left(\frac{\partial V}{\partial \dot{x}_i}\right)$$ Then what can I do? – John Doe Dec 22 '17 at 13:52
• Note that $$\frac{d}{dt} \equiv \frac{\partial}{\partial t} + \mathbf{v} \cdot \nabla$$ is the material derivative. I'm not really sure how to properly finish the derivation from this point, but it looks like you're extremely close to the answer. – JM1 Dec 22 '17 at 14:27