give an example of a discontinuous function the square of which is continuous. The domain is $[0,1]$.
I tried to use the indicator function of rationals, but its square is not continuous.
EDIT:I am sorry that I did not express the question clearly, but the function should be nowhere continuous on $[0,1]$.
Let $A=\mathbb{Q}\cap [0,1]$ and define $f$ by $$f(x)=\begin{cases} 1 & x\in A \\ -1 & x\notin A \end{cases}$$