How many functions $f$ are there that satisfy $f(x)^{2}=x^{2}$ for all $x$?
My text (Spivak's Calculus; chapter 7 problem 7) asks this question for continuous $f$, for which the answer is, of course 4:$f(x)=x$ $f(x)=-x$ $f(x)=\lvert x \rvert$ $f(x)=-\lvert x \rvert,$ and I want to make sure I'm correct that if $f$ does not have to be continuous, there are infinitely many: any piecwise combination of them (infinitely many of which are one of the above, and infinitely many of which are not).