The functions $f(x)$ and $g(x)$ are defined by $f(x)=9^{x}$ and $g(x)=\log _{3}(9 x)$. The real number $x$ satisfies $g(f(x))=f(g(2))$. What is the value of $x$ ?
For positive $x$,

$$
\begin{aligned}
g(f(x)) & =\log _{3}(9 f(x)) \\
& =\log _{3}\left(9 \times 9^{x}\right) \\
& =\log _{3}\left(9^{x+1}\right) \\
& =\log _{3}\left(\left(3^{2}\right)^{x+1}\right) \\
& =\log _{3}\left(3^{2 x+2}\right) \\
& =(2 x+2) \log _{3}(3) \\
& =2 x+2
\end{aligned}
$$

A similar calculation shows that

$$
\begin{aligned}
f(g(2)) & =9^{g(2)} \\
& =9^{\log _{3}(18)} \\
& =3^{2 \log _{3}(18)} \\
& =\left(3^{\log _{3}(18)}\right)^{2} \\
& =18^{2} \\
& =324
\end{aligned}
$$

Therefore, $2 x+2=324$ so $x=\frac{324-2}{2}=161$.