Class 12 Maths, Worked in Full Past papersGet updates
Chapter 5 · Continuity and Differentiability

Exercise 5.1 · Q32: ∣cos⁡x∣|\cos x| is a continuous function

Exercise 5.1Algebra of continuous functions · Section 5.2.1
The question

32. Show that the function defined by f(x)=∣cos⁡x∣f(x) = |\cos x| is a continuous function.

Exam answer

Let h(x)=cos⁡xh(x) = \cos x and g(x)=∣x∣g(x) = |x|⁠. Then

(g∘h)(x)=g(cos⁡x)=∣cos⁡x∣=f(x)\begin{aligned} (g\circ h)(x) &= g(\cos x) \\ &= |\cos x| = f(x) \end{aligned}

h(x)=cos⁡xh(x) = \cos x and the modulus function g(x)=∣x∣g(x) = |x| are continuous at every real number.

Let cc be any real number. Then hh is continuous at cc and gg is continuous at h(c)=cos⁡ch(c) = \cos c⁠. The composite of continuous functions is continuous, so f=g∘hf = g\circ h is continuous at cc⁠:

lim⁡x→c∣cos⁡x∣=∣cos⁡c∣=f(c)\lim_{x\to c}|\cos x| = |\cos c| = f(c)

∴ f(x)=∣cos⁡x∣\therefore\ f(x) = |\cos x| is a continuous function. Hence proved.

Want the reason behind every step, the basics and the checks?

The one idea this problem is built on

To compute ∣cos⁡x∣|\cos x| you first take the cosine, then the absolute value. So ff is a composite: "cosine" inside, "modulus" outside. Both are continuous at every real number (Remark after Example 17, and Example 7), so Theorem 2 makes the composite continuous. The graph has sharp corners where cos⁡x=0\cos x = 0⁠, but a corner is not a break.

Given, to find, and the plan
Given
f(x)=∣cos⁡x∣f(x) = |\cos x|⁠, xx real (radians).
To show
ff is continuous at every point of its domain.
Plan
(1) Domain. (2) Write f=g∘hf = g \circ h with h(x)=cos⁡xh(x) = \cos x⁠, g(u)=∣u∣g(u) = |u|⁠. (3) hh is continuous. (4) gg is continuous. (5) Theorem 2 at an arbitrary cc⁠. (6) A direct check at a corner, x=π2x = \frac{\pi}{2}⁠.

Basics you need

1Composite functions

(g∘h)(x)=g(h(x))(g \circ h)(x) = g(h(x))⁠: apply the inner function hh first, then the outer function gg⁠. Basics: composite functions

2Theorem 2

If hh is continuous at cc and gg is continuous at h(c)h(c)⁠, then g∘hg \circ h is continuous at cc (Section 5.2.1). Lesson: algebra of continuous functions

3The modulus function is continuous

∣u∣=−u|u| = -u for u<0u < 0 and ∣u∣=u|u| = u for u≥0u \ge 0⁠; it is continuous at every real number, including 0 (Examples 3 and 7). Basics: piecewise functions

4Cosine is continuous

lim⁡x→ccos⁡x=cos⁡c\lim_{x\to c}\cos x = \cos c for every real cc (Remark after Example 17). Basics: trigonometric identities

5One-sided limits

For the direct check at a corner we compute the left-hand and right-hand limits separately. Basics: left-hand and right-hand limits

Solution

  1. The domain is all of R\R

    cos⁡x\cos x is defined for every real xx⁠, and the modulus of every real number is defined. So f(x)=∣cos⁡x∣f(x) = |\cos x| is defined for all real xx⁠.

    "Continuous function" means continuous at every point of the domain (Definition 2), so we record the domain first. Nothing is excluded.
  2. Write ff as a composite g∘hg \circ h

    Let

    h(x)=cos⁡x  (inner),g(u)=∣u∣  (outer).h(x) = \cos x \ \ (\text{inner}), \qquad g(u) = |u| \ \ (\text{outer}).

    Then for every real xx⁠,

    (g∘h)(x)=g(cos⁡x)=∣cos⁡x∣=f(x).(g \circ h)(x) = g(\cos x) = |\cos x| = f(x).

    The range of hh is [−1,1][-1, 1]⁠, which lies inside the domain R\R of gg⁠, so the composite is defined everywhere.

    This is the order in which you would press calculator keys: cos first, then the absolute value. The other order, h∘gh \circ g⁠, would be cos⁡∣x∣\cos|x|⁠, which is a different function (although it happens to equal cos⁡x\cos x⁠, since cosine is even).
    Inner function first, outer function second (Basic 1). Basics: composite functions
  3. The inner function cos⁡x\cos x is continuous everywhere

    For every real cc⁠, lim⁡x→ccos⁡x=cos⁡c\lim_{x\to c}\cos x = \cos c⁠. With x=c+tx = c + t⁠:

    lim⁡t→0cos⁡(c+t)=lim⁡t→0(cos⁡ccos⁡t−sin⁡csin⁡t)=cos⁡c⋅1−sin⁡c⋅0=cos⁡c.\begin{aligned} \lim_{t\to0}\cos(c + t) &= \lim_{t\to0}(\cos c\cos t - \sin c\sin t)\\ &= \cos c\cdot1 - \sin c\cdot0 = \cos c. \end{aligned}
    This is the "similar proof" the textbook mentions after Example 17. It uses cos⁡t→1\cos t \to 1 and sin⁡t→0\sin t \to 0 as t→0t \to 0⁠, limits from Class XI (Limits and Derivatives) that Example 17 uses without proof.
    Cosine is continuous (Basic 4). Basics: trigonometric identities
  4. The outer function ∣u∣|u| is continuous everywhere

    This is Example 7. In brief, for a point dd⁠:

    • if d<0d < 0⁠, near dd we have ∣u∣=−u|u| = -u⁠, so lim⁡u→d∣u∣=−d=∣d∣\lim_{u\to d}|u| = -d = |d|⁠;
    • if d>0d > 0⁠, near dd we have ∣u∣=u|u| = u⁠, so lim⁡u→d∣u∣=d=∣d∣\lim_{u\to d}|u| = d = |d|⁠;
    • if d=0d = 0⁠, the left-hand limit is lim⁡(−u)=0\lim(-u) = 0⁠, the right-hand limit is lim⁡u=0\lim u = 0⁠, and ∣0∣=0|0| = 0 (Example 3).
    The only delicate point for ∣u∣|u| is u=0u = 0⁠, where the formula changes; the one-sided limits there both equal 0, which is the value. So gg is continuous at every real number.
    Modulus as a two-piece function (Basic 3). Basics: piecewise functions
  5. Apply Theorem 2 at an arbitrary point

    Let cc be any real number. h=cos⁡h = \cos is continuous at cc (Step 3), and g=∣⋅∣g = |\cdot| is continuous at h(c)=cos⁡ch(c) = \cos c (Step 4, since gg is continuous at every real number). By Theorem 2, g∘h=fg \circ h = f is continuous at cc⁠:

    lim⁡x→c∣cos⁡x∣=∣cos⁡c∣=f(c).\lim_{x\to c} |\cos x| = |\cos c| = f(c).

    As cc was arbitrary, ff is continuous at every real number, so it is a continuous function.

    Theorem 2 asks for continuity of the outer function at the particular inner value cos⁡c\cos c⁠. Because ∣⋅∣|\cdot| is continuous everywhere, that holds whatever cos⁡c\cos c turns out to be, including cos⁡c=0\cos c = 0⁠.
    Theorem 2, Section 5.2.1; Example 20 uses ∣⋅∣|\cdot| as an outer function in the same way. Lesson: algebra of continuous functions
  6. A direct look at a corner: x=π2x = \frac{\pi}{2}

    The most suspicious points are where cos⁡x=0\cos x = 0⁠, because there the modulus switches from "leave alone" to "flip the sign". Take x=π2x = \frac{\pi}{2}⁠, where f(π2)=∣0∣=0f(\frac{\pi}{2}) = |0| = 0⁠.

    • Just left of π2\frac{\pi}{2}⁠, cos⁡x>0\cos x > 0⁠, so f(x)=cos⁡xf(x) = \cos x⁠, and lim⁡x→π/2−cos⁡x=cos⁡π2=0\lim_{x\to\pi/2^-} \cos x = \cos\frac{\pi}{2} = 0⁠.
    • Just right of π2\frac{\pi}{2}⁠, cos⁡x<0\cos x < 0⁠, so f(x)=−cos⁡xf(x) = -\cos x⁠, and lim⁡x→π/2+(−cos⁡x)=0\lim_{x\to\pi/2^+} (-\cos x) = 0⁠.

    Left-hand limit == right-hand limit == value =0= 0⁠: continuous at π2\frac{\pi}{2}⁠, as Step 5 promised. The same happens at every odd multiple of π2\frac{\pi}{2}⁠.

    x y −2π −π π 2π 1 −1 blue: y = |cos x| dashed: y = cos x
    The dashed curve is y=cos⁡xy = \cos x⁠; the blue curve y=∣cos⁡x∣y = |\cos x| keeps its arches above the axis and flips the ones below. Where cos⁡x=0\cos x = 0 (at ±π2\pm\frac{\pi}{2}⁠, ±3π2\pm\frac{3\pi}{2}⁠) the blue graph touches the axis at a sharp corner, but it never lifts off the page.
    The general argument already covers these points; the direct check shows why the corners cause no trouble: both sides arrive at height 0, which is the value. A corner changes the direction of the graph, not its height. (Corners do matter for differentiability, Section 5.3.)
    One-sided limits (Basic 5). Basics: left-hand and right-hand limits
Result

f(x)=∣cos⁡x∣f(x) = |\cos x| is the composite of the continuous functions cos⁡\cos and ∣⋅∣|\cdot|⁠, so by Theorem 2 it is continuous at every real number; it is a continuous function. (The answer key gives no separate answer for this "show that" question.)

Check it with numbers

Near the corner π2≈1.5707963\frac{\pi}{2} \approx 1.5707963⁠:

f ⁣(π2−0.01)=∣cos⁡1.5607963∣≈0.0099998,f ⁣(π2+0.01)=∣cos⁡1.5807963∣=∣−0.0099998∣≈0.0099998.\begin{aligned} f\!\left(\tfrac{\pi}{2} - 0.01\right) &= |\cos 1.5607963|\\ &\approx 0.0099998,\\ f\!\left(\tfrac{\pi}{2} + 0.01\right) &= |\cos 1.5807963|\\ &= |-0.0099998| \approx 0.0099998. \end{aligned}

Both are within 0.01 of f(π2)=0f(\frac{\pi}{2}) = 0⁠, and shrink with the step. ✓

Common mistakes
  1. "The graph has corners, so it is not continuous." Corners affect differentiability, not continuity. Continuity only asks that limits equal values.
  2. Getting the layers backwards. Inner is cos⁡x\cos x⁠, outer is ∣u∣|u|⁠. The composite the other way round is cos⁡∣x∣\cos|x|⁠.
  3. Forgetting to justify continuity of ∣u∣|u| at 0. That is exactly the point Example 3 handles with one-sided limits.
What to take away
  1. ∣continuous function∣|\text{continuous function}| is always continuous: modulus is a continuous outer layer.
  2. Theorem 2 turns "continuous inside continuous" into a one-line proof.
  3. Sharp corners are allowed in a continuous graph; jumps and holes are not.

Every fact used, and where it comes from

FactUsed inSource
A continuous function is continuous at every point of its domainSteps 1, 5Definition 2, Section 5.2
Cosine is continuousSteps 3, 6Remark after Example 17, Section 5.2.1
cos⁡(A+B)=cos⁡Acos⁡B−sin⁡Asin⁡B\cos(A + B) = \cos A\cos B - \sin A\sin BStep 3Class XI, Trigonometric Functions
cos⁡t→1\cos t \to 1⁠, sin⁡t→0\sin t \to 0 as t→0t \to 0Step 3Class XI, Limits and Derivatives (used without proof in Example 17)
The modulus function is continuous (including at 0)Step 4Examples 3 and 7, Section 5.2
Continuity of a compositeStep 5Theorem 2, Section 5.2.1 (Lesson: algebra of continuous functions)
Continuity at cc⁠: left-hand limit, right-hand limit and f(c)f(c) equalStep 6Definition 1, Section 5.2 (Lesson: continuity at a point)
cos⁡x>0\cos x > 0 just left of π2\frac{\pi}{2}⁠, <0< 0 just rightStep 6Signs of cosine by quadrant, Class XI, Trigonometric Functions
Found an error, or want more?

Tell us if something on this page is wrong or unclear, or if you would like a fuller explanation, another method or a new feature. Send feedback on this problem →