Maths WorkshopMaths problems with full solutions
Exercise 81Calculus › Single-variable calculus › Continuity › Continuous and discontinuous functionsL1Added 2 Nov 2026

The absolute value of a continuous function

#continuity#absolute value#counterexamples

Statement

  1. Show that if ff is continuous at aa, then ∣f∣|f| is continuous at aa.
  2. Show that the converse is false.
Hint

For part 1, use the reverse triangle inequality ∣∣u∣−∣v∣∣≤∣u−v∣\bigl||u|-|v|\bigr|\le|u-v|. For part 2, try a function that only takes the values 11 and −1-1.

Show solutionHide solution

Solution

1. For all xx, ∣∣f(x)∣−∣f(a)∣∣≤∣f(x)−f(a)∣\bigl||f(x)|-|f(a)|\bigr|\le|f(x)-f(a)|. Given ε>0\varepsilon>0, continuity of ff gives δ>0\delta>0 with ∣f(x)−f(a)∣<ε|f(x)-f(a)|<\varepsilon when ∣x−a∣<δ|x-a|<\delta; the same δ\delta works for ∣f∣|f|.

2. Let f(x)=1f(x)=1 if xx is rational and f(x)=−1f(x)=-1 if xx is irrational. Then ∣f∣=1|f|=1 is constant, hence continuous. But ff is discontinuous at every point: near any aa there are rationals (where f=1f=1) and irrationals (where f=−1f=-1).

Remark. Taking the absolute value can only destroy sign jumps, never create new discontinuities. That is why ∣f∣|f| is "more continuous" than ff.