Example 5 Given that $a$ and $b$ are real numbers, and
$$
a^{2}+a b+b^{2}=3 \text {. }
$$

If the maximum value of $a^{2}-a b+b^{2}$ is $m$, and the minimum value is $n$, find the value of $m+n$. ${ }^{[3]}$
$(2008$, National Junior High School Mathematics Competition, Tianjin Preliminary Round)
Let $a^{2}-a b+b^{2}=k$.
From $\left\{\begin{array}{l}a^{2}+a b+b^{2}=3 \\ a^{2}-a b+b^{2}=k,\end{array}\right.$, we get $a b=\frac{3-k}{2}$.
Thus, $(a+b)^{2}=\left(a^{2}+a b+b^{2}\right)+a b$
$=3+\frac{3-k}{2}=\frac{9-k}{2}$.
Since $(a+b)^{2} \geqslant 0$, then $\frac{9-k}{2} \geqslant 0$, which means $k \leqslant 9$.
Therefore, $a+b= \pm \sqrt{\frac{9-k}{2}}, a b=\frac{3-k}{2}$.
Hence, the real numbers $a, b$ can be considered as the two roots of the quadratic equation
$$
x^{2} \mp \sqrt{\frac{9-k}{2}}+\frac{3-k}{2}=0
$$

Thus, $\Delta=\left(\sqrt{\frac{9-\bar{k}}{2}}\right)^{2}-4 \times \frac{3-k}{2}=\frac{3 k-3}{2} \geqslant 0$.
Solving this, we get $k \geqslant 1$.
Therefore, $1 \leqslant k \leqslant 9$.
So, the maximum value of $a^{2}-a b+b^{2}$ is $m=9$, and the minimum value is $n=1$.
Thus, $m+n=10$.