(9) Let the function $f(x)=\frac{x^{2}+n}{x^{2}+x+1}\left(n \in \mathbf{N}^{*}\right)$ have a maximum value of $a_{n}$ and a minimum value of $b_{n}$, then $a_{n}-b_{n}=$
(9) $\frac{4}{3} \sqrt{n^{2}-n+1}$ Hint: From $y=\frac{x^{2}+n}{x^{2}+x+1}$ we get $(y-1) x^{2}+y x+ y-n=0$.
(1) When $y=1$, $x=n-1\left(n \in \mathbf{N}^{*}\right)$, so there exists $x \in \mathbf{R}$, such that $y \neq 1$.
(2) When $y \neq 1$, the equation in $x$ should have a solution, so
$$
\Delta=y^{2}-4(y-1)(y-n) \geqslant 0,
$$

which means
$$
3 y^{2}-4(n+1) y+4 n \leqslant 0 .
$$

It is known that $a_{n}$ and $b_{n}$ are the two roots of the equation $3 y^{2}-4(n+1) y+4 n=0$, so
$$
a_{n}+b_{n}=\frac{4(n+1)}{3}, a_{n} b_{n}=\frac{4 n}{3} .
$$

Therefore,
$$
\begin{aligned}
\left(a_{n}-b_{n}\right)^{2} & =\left(a_{n}+b_{n}\right)^{2}-4 a_{n} b_{n} \\
& =\frac{16(n+1)^{2}}{9}-\frac{16 n}{3} \\
& =\frac{16}{9}\left(n^{2}-n+1\right) .
\end{aligned}
$$

Since $a_{n}>b_{n}$, we have $a_{n}-b_{n}=\frac{4}{3} \sqrt{n^{2}-n+1}$.
(Supplied by Yang Hanlin, Urumqi Senior High School)