# Evaluation of Hamiltonian of a charged particle under EM field

The Hamiltonian of a charged partical in EM field is given by $$H = \frac{\pi^2}{2m} -e \phi$$ where $$\boldsymbol{\pi}=-\mathrm{i} \hbar \boldsymbol{\nabla}+e \mathbf{A}.$$ To evaluate $$\pi^2$$, we apply a random function $$\Psi$$ to the right hand side of $$\pi^2$$, so we have \begin{aligned} \pi^{2} \Psi &=p^{2} \Psi+e \mathbf{p} \cdot \mathbf{A} \Psi+e \mathbf{A} \cdot \mathbf{p} \Psi+e^{2} A^{2} \Psi \\ &=p^{2} \Psi+e(\mathbf{p} \cdot \mathbf{A}) \Psi+2 e \mathbf{A} \cdot \mathbf{p} \Psi+e^{2} A^{2} \Psi \\ &=\left(p^{2}+2 e \mathbf{A} \cdot \mathbf{p}+e^{2} A^{2}\right) \Psi \end{aligned} if we assume Coulomb guage $$\nabla \cdot \mathbf{A}=0$$.

I'm confused how do we get $$e \mathbf{p} \cdot \mathbf{A} \Psi = e(\mathbf{p} \cdot \mathbf{A}) \Psi+e \mathbf{A} \cdot \mathbf{p} \Psi$$ in the first and the second line?

Let us replace $$\mathbf{p}$$ with the form $$i\hbar\mathbf{\nabla}$$. Doing so, we get $$i\hbar e\nabla\cdot(\mathbf{A}\Psi)$$ Now, use the divergence product rule, $$\nabla\cdot(\phi\mathbf{V})=\mathbf{V}\cdot\nabla\phi+\phi(\nabla\cdot\mathbf{V})$$ This is directly applicable, and we get \begin{align}i\hbar e\nabla\cdot(\mathbf{A}\Psi)&=i\hbar e(\mathbf{A}\cdot\nabla\Psi)+i\hbar e(\nabla\cdot\mathbf{A})\Psi\\ &=e\mathbf{A}\cdot i\hbar\nabla\Psi+e(i\hbar\nabla\cdot\mathbf{A})\Psi\\ &=e\mathbf{A}\cdot\mathbf{p}\Psi+e(\mathbf{p}\cdot\mathbf{A})\Psi \end{align} where we have used the bilinearity of the dot product.
Derivation of the product rule: \begin{align} \nabla\cdot(\phi\mathbf{V})&=\partial_x(\phi V_x)+\partial_y(\phi V_y)+\partial_z(\phi V_z)\\ &=V_x\partial_x\phi+\phi\partial_xV_x+V_y\partial_y\phi+\phi\partial_yV_y+V_z\partial_z\phi+\phi\partial_zV_z\\ &= V_x\partial_x\phi+V_y\partial_y\phi+V_z\partial_z\phi+\phi(\partial_xV_x+\partial_yV_y+\partial_zV_z)\\ &=\mathbf{V}\cdot\nabla\phi+\phi(\nabla\cdot\mathbf{V}) \end{align}