If $|f(x)|$ is continuous at $a$, is $f(x)$ continuous at $a$?

I tried doing it using composite functions. If $g(x)= |x|$, then $g\circ f(x)= |f(x)|$. Since $g(x)$ and $g\circ f(x)$ are continuous, $f(x)$ is continuous.

I don't know if this is correct. Please help.

  • 16
    $\begingroup$ composition of continuous functions doesn't work that way. If it did, we could let $g = 0$ be a constant function, and then $g\circ f$ is also a constant function, so $g$ and $g \circ f$ are continuous, and thus every function is continuous! $\endgroup$
    – jxnh
    Oct 3 '14 at 15:29
  • $\begingroup$ It does work the other way around though: if $f(x)$ is continuous, so is $|f(x)|$. But that's quite trivial to show, as you only need to consider the points where $f(x) = 0$. $\endgroup$
    – CompuChip
    Oct 4 '14 at 7:39

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$.

  • $\begingroup$ I wonder why you chose 17 particularly. $\endgroup$ May 14 '20 at 20:24

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.


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)$.


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} $$

  • $\begingroup$ This function is continuous. (I assume its domain is the integers?) $\endgroup$ Oct 5 '14 at 0:39
  • 2
    $\begingroup$ Why would you call it continuous? $\endgroup$ Oct 5 '14 at 3:32
  • $\begingroup$ +1. After thinking about it, I can see no reason to presume that its domain is the integers. I believe that the original edit to express it in math speak was in error, since in the programming language version there is no mention of evenness. $\endgroup$ Oct 5 '14 at 17:05
  • $\begingroup$ I assumed the domain was the integers because the way I see it, a number $x$ has to be an integer for the statement '$x$ is odd' to make sense. I guess that's a matter of convention, though. The wording 'if $x$ is an odd integer', plus an indication of what the domain is, would make the answer clearer. $\endgroup$ Oct 23 '14 at 15:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.