# Divergence of Magnetic Field in an Electromagnetic Wave

In many text books of physics (especially those coping with Electromagnetic Theory), we see that an electromagnetic wave (EMW) is drawn as an electric field varying with a sinusoidal form and exactly perpendicular to it we see the magnetic field varying in the same manner. One of the fundamental equations of EM is the equation that states that $\nabla\cdot\mathbf B=0$ which means that the magnetic monopole doesn't exist. I've always thought of this equation as an equivalent of the affirmation: "The magnetic field lines are always closed ones."

My question is: How can I demonstrate that in an EMW, the equation $\nabla\cdot\mathbf B=0$ still holds if the magnetic field lines are open ones?

If you have an explicit solution $B(\mathbf{r},t)$, then calculate $\nabla\cdot B(\mathbf{r},t)$ to make sure it holds. The magnetic lines are not obligatorily closed. They can be infinitely long too (I even heard they could be infinitely winding in a limited space).
It is clear that $\nabla \cdot {\bf B}=0$ for any EM wave you can come up with. e.g. ${\bf B} = \sin (kx - \omega t) \hat{\bf j}$ for instance. Here the wave propagation is in the positive x-direction. The B-field is perpendicular to the wave motion, which is required by Maxwell's equations. i.e. $B_x =0 = B_z =0$ and $B_{y} \neq f(y)$ so that $\nabla \cdot {\bf B}=0$.