Ok. So I solved it, thanks to @lulu's comment, which made me realize that $f(x)=3x$ might NOT be the only answer.
After realizing that and getting out of the trapped box, the answer was rather straightforward. Note that the only REAL constraint is that $f(9^xy)=9^xf(y)$.
I found two types of answers satisfying this property:
Type $1$:
First, define $S = \{x \mid x \in \mathbb{N^+}, 9 \nmid x\}$. Then for each ordered tuple $(U, V, g)$ such that the following holds:
- $U \cup V = S$
- $U \cap V = \emptyset$
- $g : U \rightarrow V$
- $g$ is bijective (aka $g^{-1} : V \rightarrow U$)
Then we have a corresponding $f$, defined as follows:
$f = \begin{cases}
9^u * f(v) & 9 \mid x, x = 9^u \times v \\
g(x) & x \in U \\
9 \times g^{-1}(x) & x \in V
\end{cases}$
Proof that it works:
If $x \in U$ then $f(f()x) = f(g(x)) = 9 \times g^{-1}(g(x)) = 9x$ (since $g(x) \in V$).
If $x \in V$ then $f(f(x)) = f(9 \times g^{-1}(x)) = 9 \times f(g^{-1}(x)) = 9 \times g(g^{-1}(x)) = 9x$ (since $g^{-1}(x) \in U$).
If $9 \mid x$ then after $x = 9^u \times v$, $f(f(x)) = f(9^u f(v)) = 9^u f(f(v)) = 9^u \times 9v = 9x$
(In the last case, $f(f(v))=9v$ is proved in the first two cases).
Type $2$:
This is the case where $\forall x, 3 \mid f(x)$.
First, define $S = \{x \mid x \in \mathbb{N^+}, 3 \nmid x\}$. Then for each ordered tuple $(U, V, g)$ such that the following holds:
- $U \cup V = S$
- $U \cap V = \emptyset$
- $g : U \rightarrow V$
- $g$ is bijective (aka $g^{-1} : V \rightarrow U$)
Then we have a corresponding $f$, defined as follows:
$f = \begin{cases}
9^u * f(v) & 9 \mid x, x = 9^u * v \\
9 \times g(\frac{x}{3}) & 3 \mid x, 9 \nmid x, \frac{x}{3} \in U \\
9 \times g^{-1}(\frac{x}{3}) & 3 \mid x, 9 \nmid x, \frac{x}{3} \in V \\
3 \times g(x) & x \in U \\
3 \times g^{-1}(x) & x \in V
\end{cases}$
I will leave the proof as an EXERCISE :).
End Notes:
For anyone of you who want an explicit function that satisfies $f(f(x))=9x$ but $f(x) \neq 3x$, here is one from Type $1$:
$f = \begin{cases}
9^u * f(v) & 9 \mid x, x = 9^u \times v \\
9(x-1) & x \equiv 2, 4, 6, 8 \pmod 9 \\
x + 1 & x \equiv 1, 3, 5, 7 \pmod 9
\end{cases}$