Let f:R->R be such that f(x+y)=f(x)+f(y) and f(x.y)=f(x).f(y), $\displaystyle \forall$x,y$\displaystyle \in$R. Prove that f(x)=0 or f(x)=x, $\displaystyle \forall$x$\displaystyle \in$R.
It doesn't have to be continuous or something?
Let $\displaystyle x\in\mathbb{R}$. Then $\displaystyle f(x)=f\left(x\cdot 1\right)=f(x)f(1)$
$\displaystyle f(x)=f\left(x\cdot 1\right)=f(x)f(1)\implies f(x)\left(f(1)-1\right)=0$. If $\displaystyle f(x)=0$ we are done, so assume that $\displaystyle f(x)\ne 0$ then $\displaystyle f(1)=1$..etc.
It doesn't have to be continuous. It has already been shown that f(1)=1. Let x be a positive rational number. Then there is an integer p and a positive integer q such that x = p/q.
Therefore f(x) = f(p/q) = f(p)*f(1/q)
But $\displaystyle p=\sum_{i=1}^{p}1 \Rightarrow f(p)=f(\sum_{i=1}^{p}1)=\sum_{i=1}^{p}f(1)=\sum_{i =1}^{p}1 = p$
Furthermore, we can use a trick to show that f(1/q) = 1/q.
$\displaystyle f(1) = 1 = \sum_{i=1}^{q}\frac{1}{q} \Rightarrow q \cdot f(1/q) = \sum_{i=1}^{q}f(1/q) = f(\sum_{i=1}^{q}1/q)=f(1)=1 \Rightarrow f(1/q)=\frac{1}{q} $
Ok. Now it is your turn:
i) Why is f(x) positive for all positive x?
ii) Why is f(x) monotonically increasing?
iii) Why is f(x)=x even for x in R\Q?
We don't need to assume the continuity of f.
i) f(x) is positive whenever x is positive.
Proof. Since x is positive, x has a positive square root, say, y = sqrt(x). Then
f(x) = f(y)*f(y) > 0 for all positive x.
ii) f(x) is monotonically increasing.
Proof. In fact, if y > x then y - x > 0, and, by proposition i), f(y-x) = f(y)-f(x) > 0 => f(y)>f(x).
iii) f(x)=x for all x in R.
Proof. Suppose f(x) < x for some x in R. There is, however, a rational number y such that f(x) < y < x. But y < x implies y = f(y) < f(x), i.e., f(x)<y<f(x), a contradiction.
You misunderstood me. I am not saying we need to have that $\displaystyle f$ is continuous. I am saying that we can show that $\displaystyle f$ is continuous at $\displaystyle 0$ and thus with a little work it is continuous at all points. And thus, by the fact that $\displaystyle f(1)=f\left(\frac{p}{p}\right)=pf\left(\frac{1}{p} \right)\implies f\left(\frac{1}{p}\right)=\frac{f(1)}{p}=\frac{1}{ p}$ and then $\displaystyle f\left(\frac{p}{q}\right)=pf\left(\frac{1}{q}\righ t)=\frac{p}{q}$ we see that $\displaystyle f(x)=x,\text{ }x\in\mathbb{Q}$ and since $\displaystyle \mathbb{Q}$ is dense in $\displaystyle \mathbb{R}$ and a continuous function is determined on a dense subset the conclusion follows.
Your proof is equally good thought, good job!