Class 12 Maths, Worked in Full Past papersGet updates
Chapter 7 · Integrals

Exercise 7.10 · Q16: ∫0πlog⁡(1+cos⁡x) dx\int_0^{\pi}\log(1+\cos x)\,dx

Exercise 7.10Properties of definite integrals (P4, P6) · Section 7.10
The question

By using the properties of definite integrals, evaluate the integrals in Exercises 1 to 19.

16. ∫0πlog⁡(1+cos⁡x) dx\displaystyle\int_0^{\pi}\log(1 + \cos x)\,dx

Exam answer

Let

I=∫0πlog⁡(1+cos⁡x) dx  …(i)I = \int_0^{\pi}\log(1 + \cos x)\,dx\;\ldots(\text{i})

Using ∫0af(x) dx=∫0af(a−x) dx\displaystyle\int_0^a f(x)\,dx = \int_0^a f(a - x)\,dx⁠, and cos⁡(π−x)=−cos⁡x\cos(\pi - x) = -\cos x⁠,

I=∫0πlog⁡(1−cos⁡x) dx  …(ii)I = \int_0^{\pi}\log(1 - \cos x)\,dx\;\ldots(\text{ii})

Adding (i) and (ii),

2I=∫0πlog⁡(1−cos⁡2x) dx=∫0πlog⁡sin⁡2x dx=2∫0πlog⁡sin⁡x dx\begin{aligned} 2I &= \int_0^{\pi}\log(1 - \cos^2 x)\,dx \\ &= \int_0^{\pi}\log\sin^2 x\,dx \\ &= 2\int_0^{\pi}\log\sin x\,dx \end{aligned} ⇒ I=∫0πlog⁡sin⁡x dx  …(iii)\Rightarrow\ I = \int_0^{\pi}\log\sin x\,dx\;\ldots(\text{iii})

Using ∫02af(x) dx=2∫0af(x) dx\displaystyle\int_0^{2a} f(x)\,dx = 2\int_0^a f(x)\,dx when f(2a−x)=f(x)f(2a - x) = f(x)⁠, and log⁡sin⁡(π−x)=log⁡sin⁡x\log\sin(\pi - x) = \log\sin x⁠,

I=2∫0π/2log⁡sin⁡x dx  …(iv)I = 2\int_0^{\pi/2}\log\sin x\,dx\;\ldots(\text{iv})

Using ∫0af(x) dx=∫0af(a−x) dx\displaystyle\int_0^a f(x)\,dx = \int_0^a f(a - x)\,dx on [0,π2]\left[0, \frac{\pi}{2}\right]⁠, and sin⁡(π2−x)=cos⁡x\sin\left(\frac{\pi}{2} - x\right) = \cos x⁠,

I=2∫0π/2log⁡cos⁡x dx  …(v)I = 2\int_0^{\pi/2}\log\cos x\,dx\;\ldots(\text{v})

Adding (iv) and (v), and using sin⁡xcos⁡x=12sin⁡2x\sin x\cos x = \frac12\sin 2x⁠,

2I=2∫0π/2log⁡(sin⁡xcos⁡x) dx=2∫0π/2log⁡sin⁡2x2 dx=2∫0π/2log⁡sin⁡2x dx−πlog⁡2\begin{aligned} 2I &= 2\int_0^{\pi/2}\log(\sin x\cos x)\,dx \\ &= 2\int_0^{\pi/2}\log\frac{\sin 2x}{2}\,dx \\ &= 2\int_0^{\pi/2}\log\sin 2x\,dx \\ &\quad - \pi\log 2 \end{aligned}

Put 2x=t2x = t⁠. Then 2 dx=dt2\,dx = dt⁠.

When x=0x = 0⁠, t=0t = 0⁠; when x=π2x = \frac{\pi}{2}⁠, t=πt = \pi⁠.

2∫0π/2log⁡sin⁡2x dx=∫0πlog⁡sin⁡t dt=I[by (iii)]\begin{aligned} &2\int_0^{\pi/2}\log\sin 2x\,dx \\ &= \int_0^{\pi}\log\sin t\,dt = I\quad[\text{by (iii)}] \end{aligned} ∴ 2I=I−πlog⁡2\therefore\ 2I = I - \pi\log 2

∴ I=−πlog⁡2\therefore\ I = -\pi\log 2⁠.

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

The one idea this problem is built on

P4 on [0,π][0, \pi] changes cos⁡x\cos x into −cos⁡x-\cos x⁠, so the integral of log⁡(1+cos⁡x)\log(1 + \cos x) equals the integral of log⁡(1−cos⁡x)\log(1 - \cos x)⁠. Adding them, the product (1+cos⁡x)(1−cos⁡x)(1 + \cos x)(1 - \cos x)⁠, which is sin⁡2x\sin^2 x⁠, appears, and the problem becomes the famous integral of log⁡sin⁡x\log\sin x⁠, already found in Example 34.

Given, to find, and the plan
Given
I=∫0πlog⁡(1+cos⁡x) dxI = \displaystyle\int_0^{\pi}\log(1 + \cos x)\,dx⁠, with log⁡\log the natural logarithm, as everywhere in this chapter.
To find
The exact value of II⁠.
Plan
(1) Deal with x=πx = \pi⁠, where 1+cos⁡x=01 + \cos x = 0⁠: show II is finite. (2) P4 with a=πa = \pi⁠. (3) Add: 2I=2∫0πlog⁡sin⁡x dx2I = 2\int_0^{\pi}\log\sin x\,dx⁠. (4) P6 halves the interval. (5) Use Example 34. (6) Confirm by a second route.

Basics you need

1P4 and P6 (Section 7.10)

P4: ∫0af(x) dx=∫0af(a−x) dx\int_0^a f(x)\,dx = \int_0^a f(a-x)\,dx⁠. P6: ∫02af(x) dx=2∫0af(x) dx\int_0^{2a} f(x)\,dx = 2\int_0^a f(x)\,dx if f(2a−x)=f(x)f(2a-x) = f(x)⁠. Lesson: properties of definite integrals

2Laws of logarithms

For p,q>0p, q > 0⁠: log⁡p+log⁡q=log⁡pq\log p + \log q = \log pq and log⁡p2=2log⁡p\log p^2 = 2\log p⁠. Only positive numbers have logarithms. Basics: logarithms

3Trigonometric facts

cos⁡(π−x)=−cos⁡x\cos(\pi - x) = -\cos x⁠, sin⁡(π−x)=sin⁡x\sin(\pi - x) = \sin x⁠, 1−cos⁡2x=sin⁡2x1 - \cos^2 x = \sin^2 x⁠, and the half-angle form 1+cos⁡x=2cos⁡2x21 + \cos x = 2\cos^2\frac{x}{2}⁠. Basics: trigonometric identities

4Example 34

∫0π/2log⁡sin⁡x dx\int_0^{\pi/2}\log\sin x\,dx =∫0π/2log⁡cos⁡x dx= \int_0^{\pi/2}\log\cos x\,dx =−π2log⁡2= -\frac{\pi}{2}\log 2⁠. The book finds the value; our page for it also shows (Step 1 there) that both integrals are finite although the integrands tend to −∞-\infty at one end. Example 34

Solution

  1. The trouble at x=πx = \pi⁠, and why II is finite

    For 0≤x<π0 \le x < \pi⁠, cos⁡x>−1\cos x > -1⁠, so 1+cos⁡x>01 + \cos x > 0 and log⁡(1+cos⁡x)\log(1 + \cos x) is defined and continuous. At x=πx = \pi⁠, 1+cos⁡π=01 + \cos\pi = 0 has no logarithm, and log⁡(1+cos⁡x)→−∞\log(1 + \cos x) \to -\infty as x→π−x \to \pi^-⁠. So the integrand is not continuous on the closed interval: II is an improper integral, meaning the limit of ∫0b\int_0^{b} as b→π−b \to \pi^-⁠. The book does not raise this point, but the method below needs II to be a finite number.

    The half-angle formula gives, for 0≤x<π0 \le x < \pi (where cos⁡x2>0\cos\frac{x}{2} > 0⁠):

    log⁡(1+cos⁡x)=log⁡(2cos⁡2x2)=log⁡2+2log⁡cos⁡x2.\begin{aligned}\log(1 + \cos x) &= \log\left(2\cos^2\tfrac{x}{2}\right) \\ &= \log 2 + 2\log\cos\tfrac{x}{2} .\end{aligned}

    With t=x2t = \frac{x}{2} (so dx=2 dtdx = 2\,dt⁠, and tt runs from 0 to π2\frac{\pi}{2}⁠), the second term integrates to 4∫0π/2log⁡cos⁡t dt4\int_0^{\pi/2}\log\cos t\,dt⁠, which is finite (shown in Step 1 of our Example 34 page; the book does not discuss it). So II is finite. In the same way log⁡(1−cos⁡x)\log(1 - \cos x)⁠, which equals log⁡2+2log⁡sin⁡x2\log 2 + 2\log\sin\frac{x}{2}⁠, has a finite integral over [0,π][0, \pi]⁠, although it tends to −∞-\infty at x=0x = 0⁠.

    In Step 3 we will solve an equation for II⁠; that only makes sense if II is a finite number. As in Example 34 (Step 1 there), the properties P4 and P6 remain true for these convergent improper integrals. For instance, for P4: the substitution x→π−xx \to \pi - x turns ∫0π−εlog⁡(1+cos⁡x) dx\int_0^{\pi-\varepsilon}\log(1 + \cos x)\,dx into ∫επlog⁡(1−cos⁡x) dx\int_{\varepsilon}^{\pi}\log(1 - \cos x)\,dx⁠, where both integrands are continuous; letting ε→0+\varepsilon \to 0^+ gives the improper version.
    cos⁡x=2cos⁡2x2−1\cos x = 2\cos^2\frac{x}{2} - 1⁠, the double-angle formula read backwards. Basics: trigonometric identities
  2. P4 with a=πa = \pi⁠: cos⁡x\cos x becomes −cos⁡x-\cos x

    P4 replaces xx by π−x\pi - x⁠. Since cos⁡(π−x)=−cos⁡x\cos(\pi - x) = -\cos x⁠:

    I=∫0πlog⁡(1+cos⁡(π−x)) dx=∫0πlog⁡(1−cos⁡x) dx.\begin{aligned}I &= \int_0^{\pi}\log\big(1 + \cos(\pi - x)\big)\,dx \\ &= \int_0^{\pi}\log(1 - \cos x)\,dx .\end{aligned}
    P4 has no condition beyond the integrals existing (Step 1). Reading [0,π][0, \pi] backwards turns the graph of log⁡(1+cos⁡x)\log(1 + \cos x) into its mirror image in x=π2x = \frac{\pi}{2}⁠, which is the graph of log⁡(1−cos⁡x)\log(1 - \cos x) (dashed in the figure).
    cos⁡(π−x)=−cos⁡x\cos(\pi - x) = -\cos x⁠. Basics: symmetry and mirror images
  3. Add the two forms: sin⁡2x\sin^2 x appears

    For 0<x<π0 < x < \pi⁠, both 1+cos⁡x1 + \cos x and 1−cos⁡x1 - \cos x are positive and sin⁡x>0\sin x > 0⁠, so

    log⁡(1+cos⁡x)+log⁡(1−cos⁡x)=log⁡(1−cos⁡2x)=log⁡sin⁡2x=2log⁡sin⁡x.\begin{aligned}&\log(1 + \cos x) + \log(1 - \cos x) \\ &= \log(1 - \cos^2 x) = \log\sin^2 x \\ &= 2\log\sin x .\end{aligned}

    Adding the original II and the form from Step 2:

    2I=2∫0πlog⁡sin⁡x dx,soI=∫0πlog⁡sin⁡x dx.2I = 2\int_0^{\pi}\log\sin x\,dx, \quad\text{so}\quad I = \int_0^{\pi}\log\sin x\,dx .
    The product law log⁡p+log⁡q=log⁡pq\log p + \log q = \log pq needs p,q>0p, q > 0⁠, which holds strictly inside the interval; the endpoints are single points and do not affect an integral. We want sin⁡x\sin x because Example 34 already knows the integral of log⁡sin⁡x\log\sin x⁠.
    (1+c)(1−c)=1−c2(1 + c)(1 - c) = 1 - c^2⁠; sin⁡2x+cos⁡2x=1\sin^2 x + \cos^2 x = 1⁠; log⁡p2=2log⁡p\log p^2 = 2\log p for p>0p > 0⁠. Basics: logarithms
  4. P6 with 2a=π2a = \pi⁠: fold [0,π][0, \pi] in half

    Take g(x)=log⁡sin⁡xg(x) = \log\sin x and a=π2a = \frac{\pi}{2}⁠. The condition of P6 holds:

    g(π−x)=log⁡sin⁡(π−x)=log⁡sin⁡x=g(x).\begin{aligned}g(\pi - x) &= \log\sin(\pi - x) \\ &= \log\sin x = g(x) .\end{aligned}

    So the first case of P6 gives

    I=∫0πlog⁡sin⁡x dx=2∫0π/2log⁡sin⁡x dx.I = \int_0^{\pi}\log\sin x\,dx = 2\int_0^{\pi/2}\log\sin x\,dx .
    sin⁡(π−x)=sin⁡x\sin(\pi - x) = \sin x⁠: the graph of log⁡sin⁡x\log\sin x on [0,π][0, \pi] is symmetric in the line x=π2x = \frac{\pi}{2}⁠, so the two halves contribute equally.
    P6, first case, Section 7.10. Lesson: properties
  5. Use Example 34

    Example 34 found ∫0π/2log⁡sin⁡x dx=−π2log⁡2\int_0^{\pi/2}\log\sin x\,dx = -\frac{\pi}{2}\log 2⁠. Therefore

    I=2(−π2log⁡2)=−πlog⁡2≈−2.177586.I = 2\left(-\frac{\pi}{2}\log 2\right) = -\pi\log 2 \approx -2.177586 .
    x y O π −1 −2 −3 x = π/2 + blue: y = log(1 + cos x); dashed violet: y = log(1 − cos x) each is the mirror image of the other in x = π/2 shaded: signed area I = −π log 2 ≈ −2.1776 (curves cut at y = −3.2)
    y=log⁡(1+cos⁡x)y = \log(1 + \cos x) (blue) and its mirror image y=log⁡(1−cos⁡x)y = \log(1 - \cos x) (dashed violet) on (0,π)(0, \pi)⁠. The blue curve is above the axis on [0,π2)[0, \frac{\pi}{2}) (green, area about 0.743138) and below it on (π2,π)(\frac{\pi}{2}, \pi) (rose, about −2.920724-2.920724⁠). The signed total is I=−πlog⁡2I = -\pi\log 2⁠.
    The answer is negative: the region below the axis near x=πx = \pi⁠, where the integrand plunges to −∞-\infty⁠, outweighs the small region above the axis near x=0x = 0⁠, where the integrand is at most log⁡2≈0.693147\log 2 \approx 0.693147⁠.
  6. Check: a second route through the half-angle formula

    From Step 1, for 0≤x<π0 \le x < \pi⁠, log⁡(1+cos⁡x)\log(1 + \cos x) =log⁡2+2log⁡cos⁡x2= \log 2 + 2\log\cos\frac{x}{2}⁠. Integrate term by term, putting t=x2t = \frac{x}{2} in the second term:

    I=πlog⁡2+4∫0π/2log⁡cos⁡t dt=πlog⁡2+4(−π2log⁡2)=πlog⁡2−2πlog⁡2=−πlog⁡2.\begin{aligned}I &= \pi\log 2 + 4\int_0^{\pi/2}\log\cos t\,dt \\ &= \pi\log 2 + 4\left(-\frac{\pi}{2}\log 2\right) \\ &= \pi\log 2 - 2\pi\log 2 = -\pi\log 2 .\end{aligned}
    This route uses the cos⁡\cos form of Example 34 (equal to the sin⁡\sin form by P4) instead of the adding trick, and it gives the same value, so the two routes confirm each other.
    Substitution t=x2t = \frac{x}{2}⁠: dx=2 dtdx = 2\,dt⁠; x=0⇒t=0x = 0 \Rightarrow t = 0⁠, x=π⇒t=π2x = \pi \Rightarrow t = \frac{\pi}{2}⁠. Basics: substitution
Result

∫0πlog⁡(1+cos⁡x) dx=−πlog⁡2≈−2.177586\int_0^{\pi}\log(1 + \cos x)\,dx = -\pi\log 2 \approx -2.177586 (an improper but convergent integral). (Textbook answer: −πlog⁡2-\pi\log 2⁠.)

Check it with numbers

Numerical integration (adaptive quadrature, with the logarithmic endpoint at x=πx = \pi handled by working at high precision near it) gives I=−2.1775860903036…I = -2.1775860903036\ldots⁠, and −πlog⁡2=−2.1775860903036…-\pi\log 2 = -2.1775860903036\ldots⁠.

It also confirms Step 3: ∫0πlog⁡sin⁡x dx≈−2.177586\int_0^{\pi}\log\sin x\,dx \approx -2.177586⁠, the same number. The two pieces in the figure, 0.7431380.743138 and −2.920724-2.920724⁠, add to −2.177586-2.177586⁠.

Common mistakes
  1. Adding log⁡(1+cos⁡x)\log(1 + \cos x) and log⁡(1−cos⁡x)\log(1 - \cos x) to get log⁡2\log 2 or similar. The sum of two logs is the log of the product: here log⁡(1−cos⁡2x)\log(1 - \cos^2 x)⁠.
  2. Forgetting the factor 2 from P6, which gives −π2log⁡2-\frac{\pi}{2}\log 2 instead of −πlog⁡2-\pi\log 2⁠.
  3. Writing log⁡sin⁡2x=(log⁡sin⁡x)2\log\sin^2 x = (\log\sin x)^2⁠. The power comes out in front: 2log⁡sin⁡x2\log\sin x⁠.
  4. Ignoring the endpoint x=πx = \pi⁠. The integrand is not defined there; the steps are valid because the improper integral converges (Step 1).
What to take away
  1. Integrals of log⁡\log of trigonometric expressions usually reduce, by P4, P6 and the laws of logarithms, to ∫0π/2log⁡sin⁡x dx=−π2log⁡2\int_0^{\pi/2}\log\sin x\,dx = -\frac{\pi}{2}\log 2 (Example 34; see also Q10).
  2. By the same steps, ∫0πlog⁡(1−cos⁡x) dx=−πlog⁡2\int_0^{\pi}\log(1 - \cos x)\,dx = -\pi\log 2 too (Step 2), and ∫0πlog⁡sin⁡x dx=−πlog⁡2\int_0^{\pi}\log\sin x\,dx = -\pi\log 2 (Step 3).

Every fact used, and where it comes from

FactUsed inSource
A definite integral needs ff continuous on [a,b][a, b]Step 1Remark (iv) after Theorem 2, Section 7.8.3
1+cos⁡x=2cos⁡2x21 + \cos x = 2\cos^2\frac{x}{2}⁠; cos⁡(π−x)=−cos⁡x\cos(\pi - x) = -\cos x⁠; sin⁡(π−x)=sin⁡x\sin(\pi - x) = \sin xSteps 1, 2, 4, 6Class XI trigonometry
Value of ∫0π/2log⁡sin⁡x dx\int_0^{\pi/2}\log\sin x\,dx (and of the cos⁡\cos form)Steps 5, 6Example 34, Section 7.10
Convergence of these improper integralsStep 1Not discussed in the book; shown in Step 1 of our Example 34 page
P4Step 2Section 7.10, property P4 (Lesson: properties)
log⁡p+log⁡q=log⁡pq\log p + \log q = \log pq⁠, log⁡p2=2log⁡p\log p^2 = 2\log p for p,q>0p, q > 0Steps 1, 3Laws of logarithms
P6, first caseStep 4Section 7.10, property P6
Substitution in a definite integralSteps 1, 6Section 7.9
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 →