2. Find all functions $f: \mathbf{R} \rightarrow \mathbf{R}$, such that for any real numbers $x, y$, we have
$$
f(f(x) f(y))+f(x+y)=f(x y) .
$$
2. Denote the given equation as $P(x, y)$.

From $P(0,0)$, we have
$f\left(f^{2}(0)\right)=0$.
For any real number $x \neq 1$, there exists a real number $y$ such that $x+y=xy$.
In fact, taking $y=\frac{x}{x-1}$ suffices.
From $P\left(x, \frac{x}{x-1}\right)$, we get
$f\left(f(x) f\left(\frac{x}{x-1}\right)\right)=0 \quad (x \neq 1)$.
We will discuss two cases for $f(0)$.
【Case 1】 $f(0)=0$.
In this case, from $P(x, 0)$, we get $f(x)=0$.
【Case 2】 $f(0) \neq 0$.
Conclusion 1: $f(a)=0$ if and only if $a=1$.
In fact, from equation (1), there exists a real number $a$ such that
$f(a)=0$.
If $a \neq 1$, then substituting $x=a$ in equation (2) yields $f(0)=0$, which contradicts the assumption that $f(0) \neq 0$.
From Conclusion 1 and equation (1), we get
$$
f^{2}(0)=1 \Rightarrow f(0)= \pm 1 \text {. }
$$

First, consider the case where $f(0)=-1$ (for the case where $f(0)=1$, note that $g(x)=-f(x)$ also satisfies the same functional equation).
$$
\begin{array}{l}
\text { From } P(x, 1) \text {, we get } \\
f(0)+f(x+1)=f(x) \\
\Rightarrow f(x+1)=f(x)+1 .
\end{array}
$$

By induction, it is easy to prove that for any integer $n$,
$$
f(x+n)=f(x)+n \text {. }
$$

Conclusion 2: $f$ is injective.
Proof by contradiction. Assume there exist $a \neq b$ such that
$$
f(a)=f(b) \text {. }
$$

From equation (3), for any integer $N$, we have
$$
f(a+N+1)=f(b+N)+1 \text {. }
$$

Choose an integer $N>-b$, then there exist real numbers $x_{0}$ and $y_{0}$ such that
$$
x_{0}+y_{0}=a+N+1, x_{0} y_{0}=b+N .
$$

Since $a \neq b$, we have $x_{0} \neq 1, y_{0} \neq 1$.
From $P\left(x_{0}, y_{0}\right)$, we get
$$
\begin{array}{l}
f\left(f\left(x_{0}\right) f\left(y_{0}\right)\right)+f(a+N+1)=f(b+N) \\
\Rightarrow f\left(f\left(x_{0}\right) f\left(y_{0}\right)\right)+1 \\
\quad=f\left(f\left(x_{0}\right) f\left(y_{0}\right)+1\right)=0 .
\end{array}
$$

From Conclusion 1, we have $f\left(x_{0}\right) f\left(y_{0}\right)+1=1$, i.e.,
$$
f\left(x_{0}\right) f\left(y_{0}\right)=0 \Rightarrow x_{0}=1 \text { or } y_{0}=1 \text {, }
$$

which is a contradiction.
For any real number $t$, from $P(t,-t)$, we get
$$
\begin{array}{l}
f(f(t) f(-t))+f(0)=f\left(-t^{2}\right) \\
\Rightarrow f(f(t) f(-t))=f\left(-t^{2}\right)+1 \\
\quad=f\left(-t^{2}+1\right) .
\end{array}
$$

Since $f$ is injective, we have
$$
f(t) f(-t)=-t^{2}+1 \text {. }
$$

From $P(t, 1-t)$, we get
$$
\begin{array}{l}
f(f(t) f(1-t))+f(1)=f(t(1-t)) \\
\Rightarrow f(f(t) f(1-t))=f(t(1-t)) .
\end{array}
$$

Since $f$ is injective, we have
$$
f(t) f(1-t)=t(1-t) \text {. }
$$

Since $f(1-t)=1+f(-t)$, comparing equations (4) and (5), we get $f(t)=t-1$.
If $f(0)=1$, then $f(t)=1-t$.
It is easy to verify that
$$
f_{1}(x)=0, f_{2}(x)=x-1, f_{3}(x)=1-x
$$

all satisfy the requirements.