2. The minimum value of the function $f(x)=\sqrt{x^{2}+1}+\sqrt{(4-x)^{2}+4}$ is $\qquad$ .
2. 5 .

Obviously, if $xf(-x)$.
Therefore, when $f(x)$ takes its minimum value, there must be $x \geqslant 0$.
As shown in Figure 6, draw a line segment $A B=4$, $A C \perp A B, D B \perp A B$, and $A C=$ $1, B D=2$. For any point $O$ on $A B$, let $O A=x$, then
$$
\begin{array}{l}
O C=\sqrt{x^{2}+1}, \\
O D=\sqrt{(4-x)^{2}+4} .
\end{array}
$$

Thus, the problem is to find a point $O$ on $A B$ such that $O C+O D$ is minimized.
Let the symmetric point of $C$ with respect to $A B$ be $E$, then the intersection of $D E$ and $A B$ is point $O$. At this point, $O C+O D=O E+O D=D E$. Draw $E F / / A B$ intersecting the extension of $D B$ at $F$.

In the right triangle $\triangle D E F$, it is easy to know that $E F=A B=4, D F=3$, so, $D E=5$.
Therefore, the function
$$
f(x)=\sqrt{x^{2}+1}+\sqrt{(4-x)^{2}+4}
$$

has a minimum value of 5.