Example 2 Let the function $f: \mathbf{R} \rightarrow \mathbf{R}$, not identically zero, satisfy the conditions: for all $x$, $y \in \mathbf{R}$,
(i) $f(x y)=f(x) f(y)$;
(ii) $f(x+\sqrt{2})=f(x)+f(\sqrt{2})$.

Find $f(x)$.
Solution: Clearly, $f(x)=x$ satisfies the requirements. Below, we prove that this is the only solution.
First, in (i), let $x=y=0$, we get
$$
f(0)=f^{2}(0),
$$

thus $f(0)=0$ or $f(0)=1$.
If $f(0)=1$, then for any $y \in \mathbf{R}$,
$$
f(y)=f(0) f(y)=f(0)=1.
$$

But in this case, $f(x+\sqrt{2})=f(x)=f(\sqrt{2})=1$, which contradicts (ii). Therefore, $f(0)=0$.
Similarly, in (i), let $x=y=1$, we get
$$
f(1)=f^{2}(1),
$$

thus $f(1)=1$ or $f(1)=0$.
If $f(1)=0$, then for any $-y \in \mathbf{R}$,
$$
f(y)=f(1) f(y)=0,
$$

which contradicts that $f(x)$ is not identically zero. Therefore, $f(1)=1$.
Next, we "improve" (ii). For any $y \neq 0$,
$$
\begin{aligned}
& f(x+y)=f\left(\frac{y}{\sqrt{2}}\left(x \cdot \frac{\sqrt{2}}{y}+\sqrt{2}\right)\right) \\
= & f\left(\frac{y}{\sqrt{2}}\right) f\left(x \cdot \frac{\sqrt{2}}{y}+\sqrt{2}\right) \\
= & f\left(\frac{y}{\sqrt{2}}\right)\left(f\left(x \cdot \frac{\sqrt{2}}{y}\right)+f(\sqrt{2})\right) \\
= & f\left(\frac{y}{\sqrt{2}}\right) f\left(x \cdot \frac{\sqrt{2}}{y}\right)+f\left(\frac{y}{\sqrt{2}}\right) f(\sqrt{2}) \\
= & f(x)+f(y) .
\end{aligned}
$$

The above equation clearly holds for $y=0$. Therefore, we have
(iii) $f(x+y)=f(x)+f(y)$.
Thus, $f(x)+f(-x)=f(0)=0$. Hence, $f(x)$ is an odd function, and we only need to consider $x>0$.
By $f(1)=1$ and (iii), it is easy to see that for $n \in \mathbf{N}$,
$$
\begin{array}{l}
f(n)=f(n-1)+f(1)=f(n-2)+2 f(1) \\
=\cdots=n f(1)=n .
\end{array}
$$

And for $m, n \in \mathbf{N}$, we have
$$
\begin{array}{l}
m f\left(\frac{n}{m}\right)=\underset{m \uparrow}{f\left(\frac{n}{m}\right)+f\left(\frac{n}{m}\right)+\cdots+f\left(\frac{n}{m}\right)} \\
=f \underbrace{\left(\frac{n}{m}+\frac{n}{m}+\cdots+\frac{n}{m}\right)}_{m \uparrow}=f(n)=n \text {, } \\
\end{array}
$$

i.e.,
$$
f\left(\frac{n}{m}\right)=\frac{n}{m} .
$$

Thus, for all rational numbers $x$,
$$
f(x)=x .
$$

We only need to prove that this equation also holds for irrational $x$.
Since $f\left(x^{2}\right)=f(x) f(x)=f^{2}(x) \geqslant 0$, when $x>0$, $f(x)$ is non-negative. When $y>0$,
$$
f(x+y)=f(x)+f(y) \geqslant f(x),
$$

i.e., $f(x)$ is increasing.
For any irrational number $c$, we can find rational numbers $r_{1}$, $r_{2}$, such that $r_{1}<c<r_{2}$. By monotonicity,
$$
r_{1}=f\left(r_{1}\right) \leqslant f(c) \leqslant f\left(r_{2}\right)=r_{2} .
$$

Since $r_{1}, r_{2}$ can be arbitrarily close to $c$, we have
$$
f(c)=c .
$$

Thus, $f(x)=x$ holds for all $x$.
Note: After obtaining (iii), based on $f(1)=1$, we can deduce that (3) holds for all rational numbers $x$. This method is called the Cauchy method. However, to prove that (3) holds for all real numbers, (iii) alone is not sufficient; we must rely on monotonicity or continuity, which (i) provides.