Understanding Maxwell's Equations in a Box Maxwell's equations for $n$ charged particles each with charge $e_j$ are known to be (in cgs) $$\begin{align}
 \nabla\cdot\textbf{E}(t,x)&=4\pi\rho(t,x)\\
 \nabla\cdot\textbf{B}(t,x)&=0\\
    \nabla\times\textbf{E}(t,x)&=-\frac{1}{c}\frac{\partial \textbf{B}(t,x)}{\partial t}\\
    \nabla\times\textbf{B}(t,x)&= \frac{1}{c}\left( 4 \pi\mathbf{J}(t,x)+\frac{\partial\mathbf{E}(t,x)}{\partial t}\right)
\end{align}$$
With $$\begin{align}
 \rho(t,x)&=\sum\limits_{j=1}^ne_j\delta(x-x^j(t))\\
 \mathbf{J}(t,x)&=\sum\limits_{j=1}^ne_j\dot{x}^j(t)\delta(x-x^j(t))
\end{align}$$
Where each $x^j$ represents the position of the jth particle. Now if we restrict ourselves to a box $V$ and impose periodic boundary conditions, that should in principle allow us to expand everything using Fourier series $$\begin{align}
  \mathbf{E}(t,x)&=\frac{1}{|V|}\sum_{k}\vec{a}(t)_{k}e^{ik\cdot x}\\
\rho(t,x)&=\frac{1}{|V|}\sum_{j=1}^ne_j\sum_ke^{ik\cdot (x-x^j(t))}=\frac{1}{|V|}\sum_k\left(\sum_{j=1}^ne_je^{-ik\cdot x^j(t)}\right)e^{ik\cdot x}
\end{align}$$
Then if you apply the electric Gauss's law you get the next equation for the Fourier coefficients $$ik\cdot\vec{a}(t)_k=4\pi\sum_{j=1}^ne_je^{-ik\cdot x^j(t)}$$ This is completely analogous to the equation you find by performing the Fourier transform, but with continuous $k$. However, in this case if we consider the Fourier coefficient for $k=\vec{0}$ this results in $$\sum_{j=1}^ne_j=0$$ That is, the net charge must be 0. Clearly it isn't physically reasonable to only consider systems with net charge 0, so my question is if there is anything wrong with my procedure? If not if the problems has to do with how I naively assumed Maxwell's equations work in these sort of systems?
 A: In a compact space, the net charge must be zero, by a simple topological argument: the net charge is proportional to the volume integral of the divergence of the electric field. By Gauss' law, this is equal to the surface integral of the electric field over the boundary, but a compact (periodic) space has no boundary!
Or you can also see it in coordinates: the integral $\int \nabla \cdot \mathbf{E}\, dV$ in a 3-torus is
$$\iiint \left(\frac{\partial E_x}{\partial x} + \frac{\partial E_y}{\partial y} + \frac{\partial E_z}{\partial z} \right)\, dx\, dy\, dz,$$
and each of these terms is zero after applying the fundamental theorem of calculus and the periodic boundary conditions.
A: Convergent Fourier series for the Coulomb field may not exist; it is not L2 integrable through the singularity, only L1 integrable and not all L1 integrable functions have convergent Fourier series. If it exists, one cannot exchange summation and differentiation in that series as you have shown that leads to contradiction.
If we use Fourier transform instead, we find that the transform behaves at $\mathbf k = 0$ as $\mathbf k/|k^2|$ so your argument does not work.
