Find all functions $f$, defined over real numbers that satisfy $f(x+y) = f(x)+f(y)$ and $f(xy) = f(x)f(y)$ 
Find all functions $f$, defined over real numbers that satisfy $f(x+y) = f(x)+f(y)$ and $f(xy) = f(x)f(y)$.

We can set $x = 0$ and $y = n$ we get $f(n) = f(0)+f(n) \implies f(0) = 0$.  Then what I thought of doing was saying $f(x+y)^2 = f(x)^2+2f(xy)+f(y)^2$ and we can get $f(1) = 2f(1)^2 \implies f(1) =1,0$. I am not sure how to proceed from here.
 A: It's not necessarily true that $f(1)=1$: the function $f(x)=0$ satisfies both functional equations. However, setting $x=y=1$ in $f(xy)=f(x)f(y)$, we get $f(1)=f(1)^2$, so $f(1)=0$ or $f(1)=1$.
Next, $f(n)=nf(1)$ for all $n\in\mathbb{N}$ since $f(x+y)=f(x)+f(y)$, and similarly
$$ 0=f(n-n)=f(n)+f(-n) $$
so $f(-n)=-f(n)=(-n)f(1)$ for all $n\in\mathbb{N}$. And if $r=\frac{m}{n}\in\mathbb{Q}$ with $n>0$, then
$$ nf(r)=f(m)=mf(1)$$
so we see that $f(r)=rf(1)$. So either $f=0$ on $\mathbb{Q}$, or $f(r)=r$ for all $r\in\mathbb{Q}$.
Finally, since $f(x^2)=f(x)^2$ and every non-negative real number is a square, it follows that $f$ maps non-negative real numbers to non-negative real numbers. Therefore if $x\leq y$ then $f(x)\leq f(y)$.
So given any $x\in\mathbb{R}$, choose $r,s\in\mathbb{Q}$ with $r<x<s$, then $f(r)\leq f(x)\leq f(s)$. Therefore if $f(1)=0$ then $f$ is identically zero.
If however $f(1)=1$, then we have $r<x<s$ and $r=f(r)\leq f(x)\leq f(s)=s$, so choosing $s-r$ arbitrarily small shows that $f(x)=x$.
