Example 8 Find the maximum value of the function
$$
f(x)=\sqrt{-x^{2}+10 x-9}+\sqrt{-x^{2}+68 x-256}
$$
Given the function
$$
f(x)=\sqrt{(x-1)(9-x)}+\sqrt{(x-4)(64-x)} \text {. }
$$

the domain is $4 \leqslant x \leqslant 9$.
To factor out the same constant from both radicals, we can combine
$$
\begin{array}{l}
(x-1)+(64-x)=63 \\
\Rightarrow\left(\sqrt{\frac{x-1}{63}}\right)^{2}+\left(\sqrt{\frac{64-x}{63}}\right)^{2}=1 . \\
\text { Let } \sqrt{\frac{x-1}{63}}=\cos \alpha, \sqrt{\frac{64-x}{63}}=\sin \alpha, \text { where, }
\end{array}
$$
$\alpha$ is an acute angle.
$$
\begin{array}{l}
\text { Also, }(x-4)+(9-x)=5 \\
\Rightarrow\left(\sqrt{\frac{x-4}{5}}\right)^{2}+\left(\sqrt{\frac{9-x}{5}}\right)^{2}=1 . \\
\text { Let } \sqrt{\frac{x-4}{5}}=\sin \beta, \sqrt{\frac{9-x}{5}}=\cos \beta \text {, where, } \beta
\end{array}
$$

is an acute angle.
$$
\begin{array}{l}
\text { Therefore, } \sqrt{x-1}=\sqrt{63} \cos \alpha, \\
\sqrt{9-x}=\sqrt{5} \cos \beta, \\
\sqrt{64-x}=\sqrt{63} \sin \alpha, \\
\sqrt{x-4}=\sqrt{5} \sin \beta . \\
\text { Then } f(x)=3 \sqrt{35}(\cos \alpha \cdot \cos \beta+\sin \alpha \cdot \sin \beta) \\
=3 \sqrt{35} \cos (\alpha-\beta) \leqslant 3 \sqrt{35},
\end{array}
$$

When $\alpha=\beta$, the equality holds, at this time,
$$
\begin{array}{l}
\sqrt{\frac{x-1}{63}}=\cos \alpha=\cos \beta=\sqrt{\frac{9-x}{5}} . \\
\text { Hence } \frac{x-1}{63}=\frac{9-x}{5}=\frac{(x-1)+(9-x)}{63+5}=\frac{2}{17}, \\
\Rightarrow x-1=\frac{126}{17} \\
\Rightarrow x=1+\frac{126}{17}=\frac{143}{17} .
\end{array}
$$

Since $\frac{143}{17} \in[4,9]$, when $x=\frac{143}{17}$, $f(x)$ achieves its maximum value $3 \sqrt{35}$.