9. (16 points) Given the function $f(x)=x-\sqrt{x}$. If real numbers $a$ and $b$ satisfy $f(a+1)+f(b+2)=3$, find the maximum and minimum values of $a+b$.


9. From $f(a+1)+f(b+2)=3$, we know
$$
\begin{array}{l}
a+b=\sqrt{a+1}+\sqrt{b+2} . \\
\text { Also } a+b=\sqrt{a+1}+\sqrt{b+2} \\
\leqslant 2 \sqrt{\frac{a+1+b+2}{2}}=2 \sqrt{\frac{a+b+3}{2}},
\end{array}
$$

Therefore, $a+b \leqslant 1+\sqrt{7}$. When $a=1+\frac{\sqrt{7}}{2}, b=\frac{\sqrt{7}}{2}$, $a+b$ reaches its maximum value of $1+\sqrt{7}$.
Let $m=\sqrt{a+1}, n=\sqrt{b+2}$. Then $a=m^{2}-1, b=n^{2}-2$.
Thus, $\left(m-\frac{1}{2}\right)^{2}+\left(n-\frac{1}{2}\right)^{2}=\frac{7}{2}$.
Clearly, $m \geqslant 0, n \geqslant 0$.
Also, $a+b=\sqrt{a+1}+\sqrt{b+2}=m+n$. Combining with the graph, the minimum value of $m+n$ is $\frac{1+\sqrt{13}}{2}$, when $a=-1$, $b=\frac{3+\sqrt{13}}{2}$ or $a=\frac{5+\sqrt{13}}{2}, b=-2$, the minimum value of $a+b$ is $\frac{1+\sqrt{13}}{2}$.