Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?


share|cite|improve this question
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
up vote 2 down vote accepted

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|$.

share|cite|improve this answer

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.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.