At the walls of the cube, the parallel component of the electric field and the orthogonal component of the magnetic field must vanish. Analogous to the wave function of a particle in a box, one finds that the fields are superpositions of periodic functions. The three wavelengths λ 1, λ 2, and λ 3, in the three directions orthogonal to the walls can be: λ λ i = 2 L n i , where the n i are positive integers. For each set of integers n i there are two linearly independent solutions (known as modes). The two modes for each set of these n i correspond to the two polarization states of the photon which has a spin of 1. According to quantum theory, the total energy of a mode is given by: