9. (16 points) Let the inequality $\left|2^{x}-a\right|<\left|5-2^{x}\right|$ hold for all $x \in[1,2]$. Find the range of real number $a$.


Given $t=2^{x}$. Then $t \in[2,4]$.
Notice,
$$
\begin{array}{l}
|t-a|<|5-t| \\
\Leftrightarrow(t-a)^{2}<(5-t)^{2} \\
\Leftrightarrow(2 t-a-5)(5-a)<0 .
\end{array}
$$

For a given real number $a$, let
$$
f(t)=(2 t-a-5)(5-a) \text {. }
$$

Then $f(t)$ is a linear function or a constant function of $t$.
Since $t \in[2,4]$, we have
$$
\begin{array}{l}
f(t)<0 \\
\Leftrightarrow\left\{\begin{array}{l}
f(2)=(-1-a)(5-a)<0, \\
f(4)=(3-a)(5-a)<0
\end{array}\right. \\
\Rightarrow 3<a<5 .
\end{array}
$$