3 Find all functions $f, g:(0,+\infty) \rightarrow(0,+\infty)$, such that for all $x \in \mathbf{R}^{-}$. we have
$$
f(g(x))=\frac{x}{x f(x)-2}, \text { and } g(f(x))=\frac{x}{x g(x)-2} .
$$
Prove first that $x f(x)-2>0 \cdot x g(x)-2>0$, i.e., $x f(x)>2$, $x g(x)>2$.

Let $a_{1}=2 \cdot b_{n}=\frac{2 a_{n}}{a_{n}-1}, a_{n-1}=\frac{2 b_{n}}{b_{n}-1}$, then $a_{i} \in(2, 3)$, $b_{i} \in(3,4], i=1,2,3, \cdots$
We use mathematical induction to prove: for any positive integer $n$, any positive real number $x$, we have
$$
a_{n}2=a_{1}, \operatorname{rg}(x)>2=a_{1}$.
Assume $x \in \mathbf{R}^{-}, a_{n}a_{n} .
$$

i.e.,
$$
x g(x)>a_{n} \cdot x f(x)-2 a_{n},
$$

Similarly,
$$
x f(x)=a_{n} \cdot x g(x)-2 a_{n} \text {, }
$$
(1) $\times a_{n}+(2)$, we get
$$
\begin{array}{c}
2 a_{n}^{2}+2 a_{n}>\left(a_{n}^{2}-1\right) \cdot x f(x) \\
\Rightarrow x f(x) > a_{n+1} \cdot \operatorname{rg}(x) > b_{n-1}$.
Thus, we have proved (*) by mathematical induction.
Now, analyze $\left\{a_{n}\right\}, n=1,2,3, \ldots$
$$
a_{n-1}=\frac{2 b_{n}}{b_{n}-1}=\frac{2 \cdot \frac{2 a_{n}}{a_{n}-1}}{\frac{2 a_{n}}{a_{n}-1}-1}=\frac{4 a_{n}}{a_{n}+1},
$$

So
$$
\frac{1}{a_{n-1}}=\frac{1}{4} \cdot \frac{1}{a_{n}}+\frac{1}{4},
$$

So
$$
\begin{array}{c}
\frac{1}{a_{n-1}}-\frac{1}{3}=-\frac{1}{4} \cdot\left(\frac{1}{a_{n}}-\frac{1}{3}\right) \\
\frac{1}{a_{n}}-\frac{1}{3}=\frac{1}{4^{n-1}} \cdot\left(\frac{1}{a_{1}}-\frac{1}{3}\right)=\frac{1}{6 \cdot 4^{n}},
\end{array}
$$

So
$$
a_{n}=\frac{6 \cdot 4^{n} 1}{2 \cdot 4^{n} 1+1} .
$$

So the sequence $\left\{a_{n}\right\}$ is monotonically increasing, and $\lim a_{n}=3$. For any integer $n$, any real number $x$, we have:
$$
a_{n}<x f(x)<b_{n}=\frac{2 a_{n}}{a_{n}-1},
$$

So
$$
\lim _{n \rightarrow} a_{n}<x f(x)<\lim _{n \rightarrow \infty} \frac{2 a_{n}}{a_{n}-1} .
$$

i.e.,
$$
3 \leqslant x f(x) \leqslant 3 .
$$

So $x f(x)=3$. Similarly, $\operatorname{xg}(x)=3$. Therefore,
$$
f(x)=g(x)=\frac{3}{x} \cdot x \in \mathbf{R}^{*} \text {. }
$$

It is not difficult to verify that it satisfies the conditions. Thus, $f, g$ have a unique solution $f(x)=g(x)=\frac{3}{x}$.