is there a function f from the reals to the reals which is not continuous,but has a continous square?

3 Answers
Apr 17, 2017

f(x) = { (-1, x lt 0), (1, x ge 0) :}

Explanation:

Consider the following function

f(x) = { (-1, x lt 0), (1, x ge 0) :}

This has a discontinuity when x=0
enter image source here

However f^2 is continuous:

f^2(x) = { ((-1)^2, x lt 0), (1^2, x ge 0) :} = 1

Apr 17, 2017

Yes, because sqrt(y^2) = absy which is not always y.

Explanation:

f(x) = {(x,"if",x != 5),(-5,"if",x=5):}

f is not continuous at 5, but

(f(x))^2 = x^2 is continuous for all x.

Apr 17, 2017

There's more!

Explanation:

In fact, there is a family of functions f which are never continuous in any point, and their square is continuous: they are called the Dirichlet functions: fix n>0 an integer, then:

f(x)=x^n if x is rational, -x^n if x is irrational.

Are the required functions. Their square is always x^{2n}, which is continuous, but f is never continuous.