4. $a, b, c \in R^{+}$. Then the minimum value of $f(x)=\sqrt{x^{2}+a}+$ $\sqrt{(c-x)^{2}+b}$ is ( ).
(A) $\sqrt{a}+\sqrt{c^{2}+b}$
(B) $\sqrt{c^{2}+a}+\sqrt{b}$
(C) $\frac{\sqrt{2}}{2} c+\sqrt{a}+\sqrt{b}$
(D) $\sqrt{c^{2}+(\sqrt{a}+\sqrt{b})^{2}}$
4. (D).
$$
\begin{aligned}
f(x) & =\sqrt{(x-0)^{2}+(0+\sqrt{a})^{2}} \\
& +\sqrt{(x-c)^{2}+(0-\sqrt{b})^{2}},
\end{aligned}
$$

This can be seen as the sum of the distances from a moving point $(x, 0)$ on the $x$-axis to two fixed points $A(0,-\sqrt{a})$ and $B(c, \sqrt{b})$. Its minimum value is
$$
\begin{aligned}
|A B| & =\sqrt{(0-c)^{2}+(\sqrt{b}+\sqrt{a})^{2}} \\
& =\sqrt{c^{2}+(\sqrt{a}+\sqrt{b})^{2}}
\end{aligned}
$$