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

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

for all $x, y \in \mathbb{R}$.
The answers are $f(x)=0$ and $f(x)=x$. It is easily checked that both of these satisfy the equation.

If $f(x)=c$, a constant, for all $x$, we must have

$$
\begin{aligned}
& c=c(1+c) \\
& c=c+c^{2} \\
& 0=c^{2} \\
& 0=c,
\end{aligned}
$$

and the solution $f(x)=0$ has already been noted. Thus we may assume that $f$ is not a constant.

Plugging $y=-1$ into (3) gives

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

If $f(-1) \neq-1$, we have $f(x)=\frac{f(0)}{1+f(-1)}$, a constant. Thus we may assume that $f(-1)=-1$. It follows that $f(0)=0$. Next we try to find $u:=f(1)$. Plugging $x=1$ and $y=-2$ into (3) gives

$$
\begin{aligned}
f(1(1-2)) & =f(1)(1+f(-2)) \\
f(-1) & =f(1)(1+f(-2)) \\
-1 & =u(1+f(-2)) .
\end{aligned}
$$

On the other hand, with $x=-1$ and $y=1$ in (3), we get

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

and plugging this into (4),

$$
\begin{aligned}
-1 & =u(1-(1-u)) \\
& =u(-u) \\
1 & =u^{2}
\end{aligned}
$$

so $u=1$ or $u=-1$. If $u=-1$, using $y=1$ in (3) yields

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

and $f$ becomes a constant. Thus we must have $f(1)=1$. Using $x=1$ in (3),

$$
f(1+y)=f(1)(1+f(y))=1+f(y) \text {. }
$$

We can use this identity to transform (3):

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

and letting $z=1+y$, we get

$$
f(x z)=f(x) f(z)
$$

for all $x$ and $z$. Now we transform (3) in yet another way:

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

letting $z=x y$,

$$
f(x+z)=f(x)+f(z)
$$

whenever $x \neq 0$. Since this equation is trivially true when $x=0$, we can use it for all $x$ and $z$. Repeatedly applying it to the known values $f(1)=1, f(-1)=-1$, we find $f(x)=x$ whenever $x$ is an integer. Then, if $\frac{m}{n}$ is any rational number, plugging $x=\frac{m}{n}, z=n$ into (5) shows that $f(x)=x$ for rational $x$ as well. Setting $x=y$ in (5) gives

$$
f\left(x^{2}\right)=(f(x))^{2},
$$

so if $x$ is nonnegative, so is $f(x)$. By (6), if $x \geq y$, then $f(x) \geq f(y)$. Suppose that $f(a)>a$ for some irrational $a$. Then there is a rational $p$ with $f(a)>p>a$, and

$$
f(a) \leq f(p)=p<f(a),
$$

a contradiction. Similarly if $f(a)<a$, we get a contradiction. Thus $f(x)=x$ for all $x$, the second of the two solutions to the functional equation.