Example 1. If $\frac{x^{2}}{4}+y^{2} \leqslant 1$, find the extremum of $z=x-y$.



Translate the text above into English, please keep the original text's line breaks and format, and output the translation result directly. 

Example 1. If $\frac{x^{2}}{4}+y^{2} \leqslant 1$, find the extremum of $z=x-y$.
Let $x=2 \lambda \sin \theta, y=\lambda \cos \theta$,
$$
\begin{aligned}
\frac{x^{2}}{4}+y^{2} & =\lambda^{2} \leqslant \lambda, \text { then } \\
|z| & =|2 \lambda \sin \theta-\lambda \cos \theta| \leqslant \sqrt{4 \lambda^{2}+\lambda^{2}} \\
& \leqslant \sqrt{5 .}
\end{aligned}
$$

The equality holds when $\lambda=1, \sin \theta=\frac{2}{\sqrt{5}}, \cos \theta=\frac{-1}{\sqrt{5}}$, hence
$$
z_{\text {max }}=\sqrt{5}, \quad z_{\text {min }}=-\sqrt{5} \text {. }
$$