TITLE: Sketch all the continuous function use the intermediate value theorem
QUESTION [6 upvotes]: Question: Sketch all the continuous functions $f:\mathbb{R}\rightarrow \mathbb{R}$ which satisfy
\begin{equation*}
(f(x))^2=(x-1)^2 (x-2)^2.
\end{equation*}
Justify your answers.
I have found the eight possible continuous functions as follows:
\begin{align*}
f(x) & =(x-1)(x-2)\\
f(x) & =-(x-1)(x-2)\\
f(x) & =|x-1|(x-2)\\
f(x) & =-|x-1|(x-2)\\
f(x) & =(x-1)|x-2|\\
f(x) & =-(x-1)|x-2|\\
f(x) & =|x-1| |x-2|\\
f(x) & =-|x-1| |x-2|.
\end{align*}
and have got the conclusion of this question which has at most eight possible such functions, but how to proof the "at most" statement.

REPLY [2 votes]: Any such function $f$ has to vanish at $x=1$ and $x=2$ and nowhere else. Therefore  the sign of $f$ has to be constant in each of the intervals $\ ]{-\infty},1[\ $, $\ ]1,2[\ $, $\ ]2,\infty[\ $. It follows that you have exactly two choices for the graph of $f$ in each of these intervals. As the value at the junctions is $0$ it follows that $f$ will automatically be continuous for  any choice made. In particular you are allowed to make the choices independently. This gives a total of $2^3=8$ possibilities.