Example 10. Let $x, y$ be real numbers, and $x^{2}+x y+y^{2}$ $=3$. Find the maximum and minimum values of $x^{2}-x y+y^{2}$. (1994, Huanggang Region Junior High School Competition)
Let $x^{2}-x y+y^{2}=P$,
and $x^{2}+x y+y^{2}=3$.
From (1) and (2), we get
$$
x+y= \pm \sqrt{\frac{9-P}{2}}, x y=\frac{3-P}{2} .
$$
$\therefore x, y$ are the two real roots of the equation $t^{2} \pm \sqrt{\frac{9-P}{2}} t+\frac{3-P}{2}=0$.

From $\Delta=\left( \pm \sqrt{\frac{9-P}{2}}\right)^{2}-4 \cdot \frac{3-P}{2} \geqslant 0$ and $\frac{9-P}{2} \geqslant 0$, we get $1 \leqslant P \leqslant 9$.
Therefore, the maximum value of $x^{2}-x y+y^{2}$ is 9, and the minimum value is 1.