# Differential operators inside commutators

I started learning QED and I'm making my way through some introductory literature. I encountered a problem in a section that derives the commutator between the fields, $\left[A_i(x);E^j(y) \right]$. Working in the Coulomb gauge, they quote a naive guess:

$$\left[A_i(\vec x),E^j(\vec y) \right] = i\delta^j_i\delta(\vec x-\vec y)$$

But then go on to argue that we want $\nabla\cdot \vec{A} = \nabla \cdot \vec{E} = 0$ to hold, so should definitely have:

$$\left(\nabla\cdot \vec{A} \right) \left(\nabla \cdot \vec{E}\right) - \left(\nabla \cdot \vec{E}\right) \left(\nabla\cdot \vec{A} \right) = \left[\nabla\cdot \vec{A} , \nabla \cdot \vec{E} \right] = 0$$

but then using the naive commutator we get

$$\left[\nabla\cdot \vec{A}(\vec x) , \nabla \cdot \vec{E}(\vec y) \right] = i\nabla^2\delta(\vec{x}-\vec{y}) \neq 0$$

Now, I don't quite see how the last equality holds. I am not sure what to do with the differential operators in my commutator. Normally I'd try something along the lines of:

$$[\partial_x \phi(x),\psi(y)] = \partial_x[\phi(x),\psi(y)] + [\partial_x,\psi(y)]\phi(x) = \partial_x[\phi(x),\psi(y)] + 0$$

Where the second term vanishes as all derivatives are in $x$. But if I try to do a similar thing here I get something like:

$$\left[\nabla\cdot \vec{A}(\vec x) , \nabla \cdot \vec{E}(\vec y) \right]=\nabla\cdot\left[ \vec{A}(\vec x) , \nabla \cdot \vec{E}(\vec y) \right] =\nabla_y\cdot \left(\nabla_x \cdot\left[ \vec{A}(\vec x) , \vec{E}(\vec y) \right]\right)$$ (I put the subscripts in the last line so it;s clear which operator acts on which variable)

And clearly something goes wrong when I try to pull out the second divergence operator. Where am I going wrong with this? Thanks for your time!

If you are to have $$\left[A_i(\vec x),\,E^j(\vec y) \right] = i\delta^j_i\delta(\vec x-\vec y)$$ and $\nabla\cdot A=\nabla\cdot E=0$, then you must also have \begin{aligned} i\nabla_x^j\delta(\vec x-\vec y)&=i\nabla^i_x\delta_i^j\delta(\vec x-\vec y) \\&=\nabla^i_x\left[A_i(\vec x),\,E^j(\vec y) \right] \\&=\left[\nabla^i_xA_i(\vec x),\,E^j(\vec y) \right] \\&=\left[0,\,E^j(\vec y) \right] \\&=0 \end{aligned} a contradiction.
The only "non-trivial" step in the manipulation above is $\nabla^i_x\left[A_i(\vec x),\,E^j(\vec y) \right]=\left[\nabla^i_xA_i(\vec x),\,E^j(\vec y) \right]$. Convince yourself that it is a correct manipulation (because the $\nabla_x$ only acts on functions of $x$, as indicated by the subscript).
Note that for this argument, we only used $\nabla\cdot A=0$. We didn't even need to use the second condition, $\nabla\cdot E=0$, to arrive at a contradiction.