3. Find the minimum value of the function $f(a, b)=(a-b)^{2}+\left(\sqrt{2-a^{2}}-\frac{9}{b}\right)^{2}$.
3. From the problem, we know that $f(a, b)$ is the square of the distance from point $P\left(a, \sqrt{2-a^{2}}\right)$ on the circle $x^{2}+y^{2}=2$ to point $Q\left(b, \frac{9}{b}\right)$ on the hyperbola $x y=9$. Since $\sqrt{2-a^{2}} \geqslant 0$, point $P$ lies on the upper half of the circle $x^{2}+y^{2}=2(y \geqslant 0)$. It is easy to see that we only need to consider point $Q$ on the part of the curve $x y=9$ in the first quadrant $(x>0, y>0)$.

Let $Q(x, y)$ be any point on the curve $x y=9(x>0)$. It is easy to see that point $P$ should lie on the line connecting the origin $O$ and $Q$. By the triangle inequality, for any other point $P^{\prime}$ on the circle, we have $O P^{\prime}+P^{\prime} Q>O P+P Q, P^{\prime} Q>P Q$, so we can first find the minimum value of $|O Q|$. Since $|O Q|^{2}=x^{2}+y^{2} \geqslant 2 x y=2 \cdot 9=18$, we have $|O Q| \geqslant \sqrt{18}$, with equality if and only if $x=y=3$. Therefore, when point $Q$ is $(3,3)$, $|P Q|$ has a minimum value of $\sqrt{18}-\sqrt{2}$, and $f(a, b)$ has a minimum value of $(\sqrt{18}-\sqrt{2})^{2}=8$. That is, when $a=1, b=3$, $f(a, b)$ has a minimum value of 8.