9. A3 (BLR) Find all pairs of functions $f: \mathbb{R} \rightarrow \mathbb{R}, g: \mathbb{R} \rightarrow \mathbb{R}$ such that $f(x+g(y))=x f(y)-y f(x)+g(x) \quad$ for all $x, y \in R$.
9. Let us first solve the problem under the assumption that $g(\alpha)=0$ for some $\alpha$.
Setting $y=\alpha$ in the given equation yields $g(x)=(\alpha+1) f(x)-x f(\alpha)$. Then the given equation becomes $f(x+g(y))=(\alpha+1-y) f(x)+(f(y)-f(\alpha)) x$, so setting $y=\alpha+1$ we get $f(x+n)=m x$, where $n=g(\alpha+1)$ and $m=f(\alpha+1)-f(\alpha)$. Hence $f$ is a linear function, and consequently $g$ is also linear. If we now substitute $f(x)=a x+b$ and $g(x)=c x+d$ in the given equation and compare the coefficients, we easily find that
$$
f(x)=\frac{c x-c^{2}}{1+c} \text { and } g(x)=c x-c^{2}, \quad c \in \mathbb{R} \backslash\{-1\} .
$$

Now we prove the existence of $\alpha$ such that $g(\alpha)=0$. If $f(0)=0$ then putting $y=0$ in the given equation we obtain $f(x+g(0))=g(x)$, so we can take $\alpha=-g(0)$.
Now assume that $f(0)=b \neq 0$. By replacing $x$ by $g(x)$ in the given equation we obtain $f(g(x)+g(y))=g(x) f(y)-y f(g(x))+g(g(x))$ and, analogously, $f(g(x)+g(y))=g(y) f(x)-x f(g(y))+g(g(y))$. The given functional equation for $x=0$ gives $f(g(y))=a-b y$, where $a=g(0)$. In particular, $g$ is injective and $f$ is surjective, so there exists $c \in \mathbb{R}$ such that $f(c)=0$. Now the above two relations yield
$$
g(x) f(y)-\alpha y+g(g(x))=g(y) f(x)-\alpha x+g(g(y)) .
$$

Plugging $y=c$ in (1) we get $g(g(x))=g(c) f(x)-a x+g(g(c))+a c=$ $k f(x)-a x+d$. Now (1) becomes $g(x) f(y)+k f(x)=g(y) f(x)+k f(y)$.
For $y=0$ we have $g(x) b+k f(x)=a f(x)+k b$, whence
$$
g(x)=\frac{a-k}{b} f(x)+k .
$$

Note that $g(0)=\alpha \neq k=g(c)$, since $g$ is injective. From the surjectivity of $f$ it follows that $g$ is surjective as well, so it takes the value 0 .