Find all functions $f: \mathbb{R} \rightarrow \mathbb{R}$ such that

$$
f(x y)+f(x+y)=f(x) f(y)+f(x)+f(y) .
$$
The answers are $f(x)=0$ and $f(x)=x$. It is easy to check that both are valid.

Plugging $(0,0)$ into (3) immediately yields $f(0)=0$. Plugging in $y=1$ yields the relation

$$
f(x+1)=f(1)[f(x)+1]
$$

If $f(1)=0$, then we conclude that $f$ is identically 0 . So we assume that $f(1)=t \neq 0$, so (4) uniquely determines $f(x+1)$ given $f(x)$ or vice versa. In this way we obtain the values

$$
f(0)=0, \quad f(1)=t, \quad f(2)=t^{2}+t, \quad f(-1)=-1, \quad f(-2)=-1-\frac{1}{t}
$$

Plugging the number pair $(2,-1)$ into (3) yields an equation in $t$ that simplifies to $t^{2}=1$, i.e. $t=1$ or $t=-1$.

The case $t=-1$ (which incidentally is tenable if $f$ were defined only on the integers) can be disposed of in an ad hoc way. Plugging $(-1 / 2,-1)$ into (3) yields $f(-1 / 2)=-1 / 2$; two more applications of (4) give us $f(3 / 2)=-1 / 2$. It is now a simple matter to insert the number pair $(-1 / 2,2)$ into (3) and obtain the contradiction $-3 / 2=-1 / 2$, implying that the case $t=-1$ is impossible.

Therefore we have $t=1$, and (4) simplifies to

$$
f(x+1)=f(x)+1 .
$$

By induction, $f(x)=x$ for all $x \in \mathbb{Z}$. Moreover, we claim that $f(x)=x$ for all $x \in \mathbb{Q}$. Let $x=p / q$ with $p \in \mathbb{Z}, q \in \mathbb{N}$. Plugging $(p / q, q)$ into (3) gives

$$
\begin{aligned}
f(p)+f\left(\frac{p}{q}+q\right) & =f\left(\frac{p}{q}\right) f(q)+f\left(\frac{p}{q}\right)+f(q) \\
p+f\left(\frac{p}{q}+q\right) & =q f\left(\frac{p}{q}\right)+f\left(\frac{p}{q}\right)+q .
\end{aligned}
$$

We can use (5) to replace $f\left(\frac{p}{q}+q\right)$ by $f\left(\frac{p}{q}\right)+q$, and then the equation is readily solved for $f\left(\frac{p}{q}\right)=\frac{p}{q}$.

Now we know that $f$ is the identity on the rationals, and we would like to pass from the rationals to the reals using density. For this we need certain bounds. We first plug $(x,-1)$ into (3) and obtain

$$
\begin{aligned}
f(-x)+f(x-1) & =f(-1) \\
f(-x)+f(x)-1 & =-1 \\
f(-x) & =-f(x)
\end{aligned}
$$

that is, $f$ is an odd function. Now we plug in $(x,-x)$ and get

$$
f\left(-x^{2}\right)=f(-x) f(x)+f(-x)+f(x)=-f(x)^{2} .
$$

Thus $f$ applied to a nonpositive number always yields a nonpositive result, and consequently $f$ of a nonnegative number always yields a nonnegative result.

For our final step, we assume that $y$ is a rational number in the interval $[-1,0]$ and $x$ is any real number. Then (3) yields

$$
\begin{aligned}
f(x+y)-f(y) & =f(x) f(y)-f(x)-f(x y) \\
f(x+y)-y & =(y+1) f(x)-f(x y)
\end{aligned}
$$

Our choice of $y$ ensures that both terms on the right-hand side have the same sign as $x$ (except that they may be zero). Let us keep $x+y=r$, where $r \in[-1,0]$ is a fixed irrational number, and vary $y$. We observe that, for each $y \in \mathbb{Q} \cap[-1,0]$, the differences $f(r)-y$ and $r-y$ have the same sign. This can only happen if $f(r)=r$.

Thus $f$ is the identity on $[-1,0]$, and by $(5)$, it is the identity everywhere.