# Counting electromagnetic modes in a rectangular cavity and boundary conditions

The electric field in a cubical cavity of side length $L$ with perfectly conducting walls is

$E_x = E_1 \cos(n_1 x \pi/L) \sin(n_2 y \pi/L) \sin(n_3 z \pi/L) \sin(\omega t)$ $E_y = E_2 \sin(n_1 x \pi/L) \cos(n_2 y \pi/L) \sin(n_3 z \pi/L) \sin(\omega t)$ $E_z = E_3 \sin(n_1 x \pi/L) \sin(n_2 y \pi/L) \cos(n_3 z \pi/L) \sin(\omega t)$

with $E_1 n_1 + E_2 n_2 + E_3 n_3 = 0$.

In counting the number of modes, the counting is restricted to non-negative values of $n_1$, $n_2$ and $n_3$. Is there a simple way to show that

a) any mode in which one or more of the $n_1$, $n_2$ and $n_3$ are negative, can be written as a linear combination of the modes that are included in the counting and

b) the modes that are included in the counting are all independent?

Also, is the perpendicular component of the magnetic field on the surface of a plane conductor required to be zero? The vanishing electric field in the conductor only implies that the the time derivative of the perpendicular component of the magnetic field vanishes.

a) Yes, you don't even need to look for linear combinations. By substituting either of the mode numbers by their opposite value, only signs of the quantities involving it in a sine change, which is mathematically equivalent to choosing different $\{E_i\}$ with the original $\{n_j\}$.

b) The modes are all mutually orthogonal (in terms of the $L^2$ scalar product), which automatically implies linear independence.

Finally, about the magnetic field: theoretically, the perpendicular component at a conductive wall could be constant. However, when one is looking for harmonic oscillating modes, this would correspond to zero frequency. There sure are nonzero constant solutions, e.g., a homogeneous magnetic field penetrating the whole box, but we generally are not interested in those for a variety of reasons.

Hope this helps!

I have been stymied by a related question for nearly two years. At that time I tried to draw the field of a typical unit cell for arbitrary n1, n2, and n3 and this is what I came up with: I am trying to see if this is consistent with the OP's formula, and I believe it is. Using his formula, I seem to get three orthogonal field modes for each unit cell, based on choosing either E1=0, E2=0, or E3=0. These three choices seem to correspond to the three choices for blank faces in my diagram.

This leads me to a very disturbing problem: for any unit cell, I seem to get three very unique field configurations depending on my choice of the blank face. So I expect the formula for number of modes to have a factor of 3 in it. But it doesn't. From the hyperphysics website I get the Rayleigh-Jeans formula: Why isn't there an extra factor of 3 in the formula for counting modes? I explain this more fully in my blogpost "Counting Modes".

As I write this I believe I am just now seeing the error in my analysis! I wonder if anyone else wants to point out what I have done wrong. In particular, what if anything is wrong with the picture I have drawn of the field modes?