1. Let $f_{1}(x)=\left\{\begin{array}{ll}x, & x \in \mathbf{Q} \text {; } \\ \frac{1}{x}, & x \notin \mathbf{Q} .\end{array}\right.$ For positive integers $n$ greater than 1, define $f_{n}(x)=f_{1}\left(f_{n-1}(x)\right)$.
Then for all positive integers $n$, we have $f_{n}(x)=$
$$
\text { -、1. } f_{n}(x)=\left\{\begin{array}{ll}
x, & x \in \mathbf{Q} \\
x^{(-1)^{n}}, & x \notin \mathbf{Q}
\end{array}\right.
$$

When $x \in \mathbf{Q}$,
$$
f_{2}(x)=f_{1}\left(f_{1}(x)\right)=f_{1}(x)=x \text {; }
$$

When $x \notin \mathbf{Q}$,
$$
f_{2}(x)=f_{1}\left(f_{1}(x)\right)=f_{1}\left(\frac{1}{x}\right)=x \text {. }
$$

Therefore, for all real numbers $x$, we have $f_{2}(x)=x$. From this, we know that for all positive integers $k$, we have
$$
\begin{array}{l}
f_{2 k}(x)=x ; f_{2 k-1}(x)=f_{1}(x) . \\
\text { Hence } f_{n}(x)=\left\{\begin{array}{ll}
x, & x \in \mathbf{Q} ; \\
x^{(-1)^{n}}, & x \notin \mathbf{Q} .
\end{array}\right.
\end{array}
$$