The problem statement, all variables and given/known data
1) $f(x+1)=f(x)+1$
2) $f(x^2) =(f(x))^2$
Let a function $f \colon \mathbb{R} \to \mathbb{R}$ satisfy the above statements. Then prove whether the fuction is odd or even.
The attempt at a solution:
using 2) we get
a) $f(0) = 0,1$ and
b) $f(1) = 0,1$
putting $x = 0$ in the 1st equation we get $f(0) = 0$ and $f(1) = 1$. From this we can prove $f(-1) = -1$ and for integers we get $f(-x) = -f(x)$. But how to prove for all real $x$?
Proposition. $f(x)=x$ for all $x\in\mathbb R$.
Proof. Let $g(x)=x-f(x)$, $Y=\{g(x)\mid x\in\mathbb R\}$ and $s=\sup Y\in\mathbb R\cup\{+\infty\}$. If $0\le x <1$, we find from $(2)$ that $ f(x)=f(\sqrt x^2)=f(\sqrt x)^2\ge 0$ and hence $g(x)<1$. By $(1)$, $g$ is periodic with period $1$ so that we have $g(x)<1$ for all $x\in\mathbb R$ and hence $s\le 1$ (especially, $s$ is finite). As an intermezzo, we show a little
Back to the proof of the proposition. Assume $Y\ne \{0\}$. Let $y\in Y\setminus\{0\}$. If $y>0$ then immediately $s\ge y>0$. If $y<0$, let $a=\frac y2-1$ in the lemma and obtain $2x-y<0$, hence again $s\ge (2x-y)y>0$. Therefore, we have $0<s\le 1$. Select $y\in Y$ with $y>\frac s2>0$ and let $a=1+\frac y2$ in the lemma, we obtain $2x-y\ge 2$, i.e. the contradiction $s\ge (2x-y)y\ge2y>s$. We conclude that $Y=\{0\}$, i.e. the proposition. $_\square$