If the absolute value of a function is continuous, is the function continuous?

Solution 1:

Let $f(x)=-1$ if $x$ is rational, and let $f(x)=1$ if $x$ is irrational.

Or else more modestly let $f(x)=-1$ if $x\lt 17$, and $f(x)=1$ for $x\ge 17$.

Solution 2:

This is not always true. If $f(x)$ is a piecewise function such that

$f(x)=1$ for $x<a$ or $x=a$ and

$f(x)=-1$ for $x>a$

Then $|f(x)|$ is continuous at $a$ but $f(x)$ is not.

Solution 3:

Maybe you are misunderstanding the logic behind it:

Let $g(x)$ be continuous, OK.

Now, saying

$g \circ f(x)$ is continous if $f(x)$ is continuous

doesn't imply that

$g \circ f(x)$ is not continuous if $f(x)$ is not continuous

Also, it's never true to say that $g \circ f(x)$ is continuous because $f(x)$ is continuous.


The single (and obvious) conclusion that we can take is that if $f(x)$ is continuous, then $g \circ f(x)$ certainly is continuous too. But if $f(x)$ is discontinuous, then $g \circ f(x)$ may be, or may be not.

So you can deduce nothing about $f(x)$ from the behaviour of $g \circ f(x)$.

Solution 4:

In programming speak as I don't know how to express this in math speak:

f(x) = odd(x) ? x : -x;


Ed.: that would be

$$ f(x) = \begin{cases} x \quad \text{if $x$ is odd} \\ -x \quad \text{otherwise} \end{cases} $$