# Functional Equation Proof [duplicate]

Question: If $f$ is a function such that $$f(x+y) = f(x)+f(y) \qquad f(xy) = f(x)f(y)$$ for all $x$, then prove that $f(x) = 0$ or $f(x) = x$ for all $x$. (The fact that every positive number is a square of some number will be important)

My attempt: I was able to show that this is satisfied for rational $x$ but we cant assume $f$ is continuous so can we prove this for all real $x$? Also, if I'm not mistaken, can I assume that $f(x) \ne 0$ or $f(x) \ne x$ for all $x$ and then prove that $f(x) = x$ or $f(x) = 0$ for all $x$ respectively?

• Consider $y=0$? – openspace Sep 17 '17 at 20:05
• If $f$ is a continuous function that it's obvious. – Michael Rozenberg Sep 17 '17 at 20:08

We have $f(1)=f(1)^2$, so $f(1)=1$ or $f(1)=0$. Moreover, $f(x)=f(1)x$ for rational $x$. Since $f(x^2)=f(x)^2\ge0$, we have $f(y)\ge0$ if $y\ge0$. But for $y>0$, $f(x+y)=f(x)+f(y)\ge f(x)$, so $f$ is monotone, i.e. $f(x)=f(1)x$ for all real $x$.