Bare with me, I don't remember every little step, but I hope this derivation helps you.
First remember how a wave travels through a waveguide (dielectric).
$$ E(x,y,z) = E^{0}(x,y)e^{-\gamma z}$$
$$ H(x,y,z) = H^{0}(x,y)e^{-\gamma z}$$
Then consider Ampere's and Faraday's Laws for a source-free region. $$ \triangledown \times H = j\omega\epsilon E $$ $$ \triangledown \times E = -j\omega\mu H $$
This produces 3 equations each (for the x, y and z directions):
$$ 1) \frac{\partial E_{z}}{\partial y} + \gamma E_{y} = -j\omega\mu H_{x}$$
$$ 2) \frac{\partial E_{z}}{\partial x} + \gamma E_{x} = j\omega\mu H_{y}$$
$$ 3) \frac{\partial E_{y}}{\partial x} - \frac{\partial E_{x}}{\partial y} = -j\omega\mu H_{z}$$
$$ 4) \frac{\partial H_{z}}{\partial y} + \gamma H_{y} = j\omega\epsilon E_{x}$$
$$ 5) \frac{\partial H_{z}}{\partial x} + \gamma H_{x} = -j\omega\epsilon E_{y}$$
$$ 6) \frac{\partial H_{y}}{\partial x} - \frac{\partial H_{x}}{\partial y} = j\omega\epsilon E_{z}$$
We can combine (1) and (5) and combine (2) and (4) due to like terms to generate equations for $H_{x}$ and $E_{x}$ which become (7) and (9). We rearrange equations (3) and (6) for $H_{y}$ and $E_{y}$, respectively.
$$ 7) H_{x} = \frac{-\gamma}{h^2} \frac{\partial H_{z}}{\partial x} + \frac{j\omega\epsilon}{h^2} \frac{\partial E_{z}}{\partial y}$$
$$ 8) H_{y} = \frac{-\gamma}{h^2} \frac{\partial H_{z}}{\partial x} - \frac{j\omega\epsilon}{h^2} \frac{\partial E_{z}}{\partial x}$$
$$ 9) E_{x} = \frac{-\gamma}{h^2} \frac{\partial E_{z}}{\partial x} - \frac{j\omega\mu}{h^2} \frac{\partial H_{z}}{\partial y}$$
$$ 10) E_{x} = \frac{-\gamma}{h^2} \frac{\partial E_{z}}{\partial y} + \frac{j\omega\mu}{h^2} \frac{\partial H_{z}}{\partial x}$$
And remember $ h^{2} = \gamma^{2} + \beta^{2}$, where $\beta = \omega \sqrt{\mu\epsilon}$
Transverse components $E_{x}, E_{y}, H_{x}, H_{y}$ are expressed in terms of the longitudinal components $E_{z}, H_{z}$. And we are given three cases:
1) Transverse Electric (TE): $$ E_{z} = 0, H_{z} \neq 0$$
2) Transverse Magnetic (TM): $$ E_{z} \neq 0, H_{z} = 0 $$
3) Transverse Electromagnetic (TEM): $$ E_{z} = H_{z} = 0 $$
Where in the case of TEM modes equations (7) through (10) break down unless $ h = 0 $ meaning:
$$ \gamma^{2} + \beta^{2} = 0 $$
$$ \gamma^{2} = -\beta^{2} $$
$$ \gamma = j\beta = j\omega\sqrt{\mu\epsilon} $$
Now here we need to bring in the Helmholtz equation to solve the partial differential for TE and TM modes: $$ \triangledown^{2} A + k^{2}A = 0 $$
In TE modes, we need $H_{z}$, which is our $A$ in the Helmholtz equation, and our factor $k^{2}$ is $\beta^{2}$.
Substituting: $$ \triangledown^{2} H_{z} + \beta^{2} H_{z} = 0 $$
Expand: $$ \frac{\partial^{2} H_{z}}{\partial x^{2}} + \frac{\partial^{2} H_{z}}{\partial y^{2}} + \frac{\partial^{2} H_{z}}{\partial z^{2}} + \beta^{2} H_{z} = 0 $$
$$ \frac{\partial^{2} H_{z}}{\partial z^{2}} = -\gamma^{2}H_{z}^{0}(x,y)e^{-\gamma z} $$
$$ \frac{\partial^{2} H_{z}^{0}}{\partial x^{2}} + \frac{\partial^{2} H_{z}^{0}}{\partial y^{2}} + (\gamma^{2} + \beta^{2})H_{z}$$ Since $h^{2}$ = $\gamma^{2} + \beta^{2}$ we conclude: $$ \frac{\partial^{2} H_{z}^{0}}{\partial x^{2}} + \frac{\partial^{2} H_{z}^{0}}{\partial y^{2}} + h^{2}H_{z} = 0$$
Repeat the same steps above for TM modes, where we need $E_{z}$
$$ \triangledown^{2} E_{z} + \beta^{2} E_{z} = 0 $$
And therefore: $$ \frac{\partial^{2} E_{z}^{0}}{\partial x^{2}} + \frac{\partial^{2} E_{z}^{0}}{\partial y^{2}} + h^{2}E_{z} = 0$$
Now the reason for there being only two sets of components is due to the fact that the wave propagates along a single direction given the waveguide. The key factor being that Electric and Magnetic Fields are ALWAYS perpendicular to eachother. This is a primary principle that Maxwell discovered. The two always travel together in electromagnetic waves.
For example:
Where in TM modes the electric field is in the direction perpendicular to that of propagation, so ONLY the magnetic field propagates within the waveguide, and vice versa for TE modes. This is why the electric or magnetic components are considered 0 (given that we're assuming z to be the direction of propagation).
So you have two instances for TM and TE waves, where the electric field is zero or the magnetic field is zero - why you have two sets of equations.
This differs in TEM modes where neither propagate in the direction of the waveguide, however at least two conductors are required for any TEM modes to exist.
Best Answer
You're confused because there are two separate concepts here: the plane interface problem, and waveguide modes. The definition for what is TE or TM is completely different between the two cases. Confusing, I agree.
In waveguide modes, the definition is based on what is transverse to the direction of propagation in the waveguide. So TE modes have an electric field completely transverse to the direction of propagation, with a non-zero transverse magnetic field. TM modes have a magnetic field completely transverse to the direction of propagation, with a non-zero transverse electric field. In TEM modes both the electric and magnetic field have zero components in the transverse direction.
For the plane interface problem, the meaning of transverse is different. Now we're concerned with transverse to the plane of incidence, not the direction of propagation. It's kind of an opposite definition. So TE modes (s-polarized) have electric field completely transverse to this plane. This plane is the xz-plane in your notes, so the electric field is y-polarized, and the magnetic field has no polarization in the y-direction. TM modes (p-polarized) have magnetic fields completely transverse to this plane (y-polarized) and electric fields have no components in the y-direction.
This definition of TE/TM for the plane interface problem can vary. I believe I have seen the definition of TE and TM switched so that they describe quantities that are transverse to the direction of propagation. This makes the definition more consistent with the definition used in waveguide modes.
As per usual, keeping track of conventions is half the battle.
Some references: