9. (16 points) Let $x \in [0, 2\pi]$. Find the maximum value of the function
$$
\begin{aligned}
f(x)= & \sqrt{4 \cos ^{2} x + 4 \sqrt{6} \cos x + 6} + \\
& \sqrt{4 \cos ^{2} x - 8 \sqrt{6} \cos x + 4 \sqrt{2} \sin x + 22}
\end{aligned}
$$
9. Completing the square for $f(x)$ yields
$$
\begin{array}{l} 
f(x)= \sqrt{(\sqrt{6} \cos x+2)^{2}+(\sqrt{2} \sin x-0)^{2}}+ \\
\sqrt{(\sqrt{6} \cos x-4)^{2}+(\sqrt{2} \sin x+2)^{2}} .
\end{array}
$$

The above expression can be seen as the sum of the distances from point $P(\sqrt{6} \cos x, \sqrt{2} \sin x)$ to points $F_{1}(-2,0)$ and $C(4,-2)$, i.e., finding $\left|P F_{1}\right|+|P C|$. It is easy to verify that point $P$ lies on the ellipse $\frac{x^{2}}{6}+\frac{y^{2}}{2}=1$.
Noting that, $F_{1}(-2,0), F_{2}(2,0)$,
$$
a=\sqrt{6}, b=\sqrt{2}, c=2 \text {. }
$$

Since $\left|P F_{1}\right|+\left|P F_{2}\right|=2 \sqrt{6}$, we have,
$$
\begin{array}{l}
\left|P F_{1}\right|+|P C|=2 \sqrt{6}-\left|P F_{2}\right|+|P C| \\
\leqslant 2 \sqrt{6}+\left|C F_{2}\right|=2 \sqrt{6}+2 \sqrt{2} .
\end{array}
$$

In Figure 4, point $P^{\prime}$ is the point that achieves the maximum value.
Therefore, the maximum value of $f(x)$ is $2(\sqrt{6}+\sqrt{2})$.