There are two sets of modes, TE modes and TM modes, that can exist in a rectangular cavity resonator as shown in Fig.1.13. Following the same procedure as in the last section, the transverse electric and magnetic fields can be expressed in terms of the $E_z$ and $H_z$ components which satisfy the wave equation. The boundary conditions require that
$$\begin{align}E_y = E_z = 0\ \text{at}\ x = 0,\ x = a\\ E_z = E_x = 0\ \text{at}\ y = 0,\ y = b\\ E_x = E_y = 0\ \text{at}\ z = 0,\ z = d\end{align}$$
As a result, standing-wave forms are taken in all the $\hat x$, $\hat y$ and $\hat z$ directions, and three sets of guidance conditions are obtained as $k_x = \frac{m\pi}{a}$, $k_y = \frac{n\pi}{b}$, and $k_z = \frac{p\pi}{d}$ .
For the TM mode, $H_z = 0$, and $$E_z = \text{sin}\left(\frac{m\pi}{a}x\right)\text{sin}\left(\frac{n\pi}{b}y\right)\text{cos}\left(\frac{p\pi}{d}z\right)$$

with $m, n = 1, 2, 3 ..., p = 0, 1, 2 ...$. The wave numbers and the frequency satisfy the dispersion relation $\left(\frac{m\pi}{a}\right)^2+\left(\frac{n\pi}{b}\right)^2+\left(\frac{p\pi}{d}\right)^2 = \omega^2\mu\epsilon$ Thus, the resonant frequency of the $TM_{mnp}$ mode can be expressed as
$$\omega_{mnp} = \frac{1}{\sqrt{\mu\epsilon}}\sqrt{\left(\frac{m\pi}{a}\right)^2+\left(\frac{n\pi}{b}\right)^2+\left(\frac{p\pi}{d}\right)^2}$$
Similarly, for the TE mode, $E_z = 0$, and
$$H_z = \text{cos}\left(\frac{m\pi}{a}x\right)\text{cos}\left(\frac{n\pi}{b}y\right)\text{sin}\left(\frac{p\pi}{d}z\right)$$
with $m, n = 0, 1, 2 ..., m^2 + n^2 \neq 0, p = 1, 2 ...$. The expression of resonant frequency is the same as that of the TM modes.
$$\begin{align}&E_x = \frac{-k_zk_x}{k^2-k_z^2}\text{cos}(k_xx)\text{sin}(k_yy)\text{sin}(k_zz)\\ &E_y = \frac{-k_zk_y}{k^2-k_z^2}\text{sin}(k_xx)\text{cos}(k_yy)\text{sin}(k_zz)\\ &E_z = \text{sin}(k_xx)\text{sin}(k_yy)\text{cos}(k_zz)\\ &H_x = \frac{j\omega\epsilon}{k^2-k_z^2}k_y\text{sin}(k_xx)\text{cos}(k_yy)\text{cos}(k_zz)\\ &H_y = \frac{-j\omega\epsilon}{k^2-k_z^2}k_x\text{cos}(k_xx)\text{sin}(k_yy)\text{cos}(k_zz)\\ &H_z = 0\end{align}$$