# Continuous Functions

This is from Question 7 Chapter 7 in Spivak:

How many continuous functions $f$ are there which satisfy $(f(x))^2 = x^2$ for all $x$?

It is clear that

• $f(x) = x$

• $f(x) = -x$

• $f(x) = |x|$

• $f(x) = -|x|$

satisfy the conditions but how would you justify that these are the only ones?

Thanks.

-
On $\mathbb{R}\setminus \{0\}$, $\frac{f(x)}{x}$ has to be locally constant, and hence constant on each connected component. – ronno Nov 11 '12 at 17:24

It is enogh to show that $f(x)$ does not change sign on $(0,\infty)$ or $(-\infty,0)$.

If $f(x)$ changes sign on say $(0,\infty)$, then by the Intermediate Value Theorem, $f(c)=0$ for some positive $c$. This is not possible, since $|f(x)|=|x|$.

-

If $x>0$, then either $f(x)=x$ or $f(x)=-x$.

If $x<0$, then either $f(x)=-x$ or $f(x)=-(-x)=x$.

Hence you have four solutions: $f(x)=x$, $f(x)=-x$, $f(x)=|x|$ and $f(x)=-|x|$. Notice that the continuity at zero is always true.

-