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

Example 41: ∫−13/2∣xsin⁡πx∣ dx\int_{-1}^{3/2}|x\sin\pi x|\,dx

ExamplesDefinite integral of a modulus (P2, parts) · Miscellaneous Examples
The question

Evaluate

∫−13/2∣xsin⁡(πx)∣dx\int_{-1}^{3/2}\left|x\sin(\pi x)\right|dx
Exam answer

Let I=∫−13/2∣xsin⁡πx∣ dxI = \displaystyle\int_{-1}^{3/2}|x\sin\pi x|\,dx⁠.

Here xsin⁡πx≥0x\sin\pi x \ge 0 on [−1,1][-1, 1] and xsin⁡πx≤0x\sin\pi x \le 0 on [1,32]\left[1, \frac32\right]⁠.

∴ I=∫−11xsin⁡πx dx−∫13/2xsin⁡πx dx\begin{aligned} \therefore\ I &= \int_{-1}^{1}x\sin\pi x\,dx \\ &\quad - \int_{1}^{3/2}x\sin\pi x\,dx \end{aligned}

By parts, with xx as the first function:

∫xsin⁡πx dx=x(−cos⁡πxπ)−∫1⋅(−cos⁡πxπ)dx=−xcos⁡πxπ+sin⁡πxπ2\begin{aligned} &\int x\sin\pi x\,dx \\ &= x\left(-\frac{\cos\pi x}{\pi}\right) \\ &\quad - \int 1\cdot\left(-\frac{\cos\pi x}{\pi}\right)dx \\ &= -\frac{x\cos\pi x}{\pi} + \frac{\sin\pi x}{\pi^2} \end{aligned} ∴ I=[−xcos⁡πxπ+sin⁡πxπ2]−11−[−xcos⁡πxπ+sin⁡πxπ2]13/2=(1π+1π)−(−1π2−1π)\begin{aligned} \therefore\ I &= \left[-\frac{x\cos\pi x}{\pi} + \frac{\sin\pi x}{\pi^2}\right]_{-1}^{1} \\ &\quad - \left[-\frac{x\cos\pi x}{\pi} + \frac{\sin\pi x}{\pi^2}\right]_{1}^{3/2} \\ &= \left(\frac1\pi + \frac1\pi\right) \\ &\quad - \left(-\frac{1}{\pi^2} - \frac1\pi\right) \end{aligned}

∴ I=3π+1π2\therefore\ I = \dfrac{3}{\pi} + \dfrac{1}{\pi^2}⁠.

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

The one idea this problem is built on

A modulus cannot be integrated as it stands: we must know where the expression inside is positive and where it is negative. Here xsin⁡πxx\sin\pi x is ≥0\ge 0 on [−1,1][-1, 1] and negative on (1,32](1, \frac32]⁠. So we split the interval at x=1x = 1 (property P2), drop the modulus on the first part and replace it by a minus sign on the second. Both pieces then need the same antiderivative of xsin⁡πxx\sin\pi x⁠, found by parts.

Given, to find, and the plan
Given
f(x)=∣xsin⁡πx∣f(x) = |x\sin\pi x| on [−1,32][-1, \frac32]⁠, a continuous function (the modulus of a continuous function).
To find
∫−13/2f(x) dx\int_{-1}^{3/2} f(x)\,dx exactly, and as a decimal.
Plan
(1) Sign of xsin⁡πxx\sin\pi x⁠. (2) Split at 1 by P2. (3) Antiderivative of xsin⁡πxx\sin\pi x by parts. (4) Evaluate each piece. (5) Add.

Basics you need

1Modulus

∣u∣=u|u| = u when u≥0u \ge 0 and ∣u∣=−u|u| = -u when u<0u < 0⁠.

2Sign of sin⁡θ\sin\theta

sin⁡θ>0\sin\theta > 0 for 0<θ<π0 < \theta < \pi⁠, sin⁡θ<0\sin\theta < 0 for −π<θ<0-\pi < \theta < 0 and for π<θ<2π\pi < \theta < 2\pi⁠, and sin⁡θ=0\sin\theta = 0 at multiples of π\pi⁠. Basics: trigonometric identities

3P2 (Section 7.10)∫abf(x) dx=∫acf(x) dx+∫cbf(x) dx\int_a^b f(x)\,dx = \int_a^c f(x)\,dx + \int_c^b f(x)\,dx

Lesson: properties of definite integrals

4Integration by parts (Section 7.6)

∫fg dx=f∫g dx−∫(f′∫g dx)dx\int f g\,dx = f\int g\,dx - \int\left(f'\int g\,dx\right)dx⁠; with a power of xx times a trigonometric function, take the power of xx as the first function. Lesson: integration by parts

Solution

  1. Where is xsin⁡πxx\sin\pi x positive, and where negative?

    xxπx\pi xsign of xxsign of sin⁡πx\sin\pi xxsin⁡πxx\sin\pi x
    −1<x<0-1 < x < 0(−π,0)(-\pi, 0)−-−-++
    0<x<10 < x < 1(0,π)(0, \pi)++++++
    1<x≤321 < x \le \frac32(π,3π2](\pi, \frac{3\pi}{2}]++−-−-

    At x=−1,0,1x = -1, 0, 1 the product is 0. So

    ∣xsin⁡πx∣={xsin⁡πx,−1≤x≤1−xsin⁡πx,1≤x≤32|x\sin\pi x| = \begin{cases} x\sin\pi x, & -1 \le x \le 1\\ -x\sin\pi x, & 1 \le x \le \frac32 \end{cases}
    This is the book's first line, with the reason behind it. On [−1,0][-1, 0] both factors are negative, so their product is positive; the modulus only "acts" on (1,32](1, \frac32]⁠. At x=1x = 1 both formulas give 0, so it does not matter which piece includes it.
    A product of two numbers of the same sign is positive; of opposite signs, negative.
  2. Split at x=1x = 1 by P2

    ∫−13/2∣xsin⁡πx∣ dx=∫−11xsin⁡πx dx+∫13/2(−xsin⁡πx) dx=∫−11xsin⁡πx dx−∫13/2xsin⁡πx dx.\begin{aligned}&\int_{-1}^{3/2}|x\sin\pi x|\,dx\\ &= \int_{-1}^{1}x\sin\pi x\,dx + \int_{1}^{3/2}(-x\sin\pi x)\,dx\\ &= \int_{-1}^{1}x\sin\pi x\,dx - \int_{1}^{3/2}x\sin\pi x\,dx .\end{aligned}
    P2 lets us cut the interval at any point cc⁠; we cut at the point where the formula for the modulus changes. On each piece the integrand is now a single smooth formula, continuous on the closed sub-interval, so Theorem 2 (Section 7.8.3) applies to each.
  3. Antiderivative of xsin⁡πxx\sin\pi x by parts

    First function xx (its derivative is 1), second function sin⁡πx\sin\pi x (its integral is −cos⁡πxπ-\frac{\cos\pi x}{\pi}⁠):

    ∫xsin⁡πx dx=x(−cos⁡πxπ)−∫1⋅(−cos⁡πxπ)dx=−xcos⁡πxπ+sin⁡πxπ2+C.\begin{aligned}\int x\sin\pi x\,dx &= x\left(-\frac{\cos\pi x}{\pi}\right)\\ &\quad - \int 1\cdot\left(-\frac{\cos\pi x}{\pi}\right)dx\\ &= -\frac{x\cos\pi x}{\pi} + \frac{\sin\pi x}{\pi^2} + C .\end{aligned}

    Call F(x)=−xcos⁡πxπ+sin⁡πxπ2F(x) = -\frac{x\cos\pi x}{\pi} + \frac{\sin\pi x}{\pi^2}⁠. Check (product rule on the first term):

    F′(x)=−cos⁡πxπ+xsin⁡πx+cos⁡πxπ=xsin⁡πx.F'(x) = -\frac{\cos\pi x}{\pi} + x\sin\pi x + \frac{\cos\pi x}{\pi} = x\sin\pi x .
    Taking xx as the first function makes it disappear on differentiating (ILATE: algebraic before trigonometric). The other choice would raise the power of xx and make things worse (as Section 7.6 shows for ∫xcos⁡x dx\int x\cos x\,dx⁠).
    ∫sin⁡πx dx=−cos⁡πxπ\int\sin\pi x\,dx = -\frac{\cos\pi x}{\pi} and ∫cos⁡πx dx=sin⁡πxπ\int\cos\pi x\,dx = \frac{\sin\pi x}{\pi} (substitute u=πxu = \pi x⁠). Basics: substitution
  4. The first piece: ∫−11xsin⁡πx dx\int_{-1}^{1}x\sin\pi x\,dx

    Using cos⁡π=cos⁡(−π)=−1\cos\pi = \cos(-\pi) = -1 and sin⁡π=sin⁡(−π)=0\sin\pi = \sin(-\pi) = 0⁠:

    F(1)=−1⋅(−1)π+0=1π,F(−1)=−(−1)(−1)π+0=−1π.\begin{aligned}F(1) &= -\frac{1\cdot(-1)}{\pi} + 0 = \frac1\pi ,\\ F(-1) &= -\frac{(-1)(-1)}{\pi} + 0 = -\frac1\pi .\end{aligned} ∫−11xsin⁡πx dx=F(1)−F(−1)=1π+1π=2π.\int_{-1}^{1}x\sin\pi x\,dx = F(1) - F(-1) = \frac1\pi + \frac1\pi = \frac{2}{\pi} .
    Theorem 2: upper value minus lower value. A shortcut gives the same: xsin⁡πxx\sin\pi x is an even function ((−x)sin⁡(−πx)=xsin⁡πx(-x)\sin(-\pi x) = x\sin\pi x⁠), so by P7 (i) the integral is 2∫01xsin⁡πx dx2\int_0^1 x\sin\pi x\,dx⁠, which is 2(F(1)−F(0))=2⋅1π2\left(F(1) - F(0)\right) = 2\cdot\frac1\pi⁠.
    cos⁡\cos is even and sin⁡\sin is odd: cos⁡(−π)=cos⁡π=−1\cos(-\pi) = \cos\pi = -1⁠, sin⁡(−π)=−sin⁡π=0\sin(-\pi) = -\sin\pi = 0⁠.
  5. The second piece: ∫13/2xsin⁡πx dx\int_{1}^{3/2}x\sin\pi x\,dx

    Using cos⁡3π2=0\cos\frac{3\pi}{2} = 0 and sin⁡3π2=−1\sin\frac{3\pi}{2} = -1⁠:

    F(32)=−32⋅0π+−1π2=−1π2.F\left(\tfrac32\right) = -\frac{\frac32\cdot 0}{\pi} + \frac{-1}{\pi^2} = -\frac{1}{\pi^2} . ∫13/2xsin⁡πx dx=F(32)−F(1)=−1π2−1π.\int_{1}^{3/2}x\sin\pi x\,dx = F\left(\tfrac32\right) - F(1) = -\frac{1}{\pi^2} - \frac{1}{\pi} .
    This integral is negative, as it must be: the integrand is negative on (1,32](1, \frac32]⁠. The modulus will turn it into a positive contribution.
  6. Add the pieces

    ∫−13/2∣xsin⁡πx∣ dx=2π−(−1π2−1π)=3π+1π2≈1.056251.\begin{aligned}\int_{-1}^{3/2}|x\sin\pi x|\,dx &= \frac{2}{\pi} - \left(-\frac{1}{\pi^2} - \frac1\pi\right)\\ &= \frac{3}{\pi} + \frac{1}{\pi^2} \approx 1.056251 .\end{aligned}
    x y −1 −1/2 1/2 1 3/2 1 −1 1/π 1/π blue: y = |x sin πx|; shaded area 3/π + 1/π² ≈ 1.0563 dashed rose: y = x sin πx on [1, 3/2], below the axis the modulus reflects that piece up: its area is 1/π + 1/π²
    The blue curve is y=∣xsin⁡πx∣y = |x\sin\pi x| on [−1,32][-1, \frac32]⁠, and the shaded area under it is the integral. On (1,32](1, \frac32] the original curve y=xsin⁡πxy = x\sin\pi x (dashed rose) dips below the axis; the modulus reflects it upward. The two humps over [−1,0][-1, 0] and [0,1][0, 1] are mirror images (the function is even), each of area 1π\frac1\pi⁠.
    The total is the area 2π≈0.636620\frac2\pi \approx 0.636620 over [−1,1][-1, 1] plus the reflected area 1π+1π2≈0.419631\frac1\pi + \frac{1}{\pi^2} \approx 0.419631 over [1,32][1, \frac32]⁠. A modulus integral is always ≥0\ge 0⁠, and it is a good sign that our answer is positive.
Result

∫−13/2∣xsin⁡πx∣ dx=3π+1π2≈1.056251\int_{-1}^{3/2}|x\sin\pi x|\,dx = \frac{3}{\pi} + \frac{1}{\pi^2} \approx 1.056251 This is the textbook's answer.

Check it with numbers

Numerical integration of ∣xsin⁡πx∣|x\sin\pi x| over [−1,32][-1, \frac32] (split at 0 and 1, where the modulus has corners) gives 1.05625084221.0562508422 to ten decimal places, while 3π≈0.9549296586\frac3\pi \approx 0.9549296586 and 1π2≈0.1013211836\frac{1}{\pi^2} \approx 0.1013211836 add up to 1.05625084221.0562508422 as well.

Without the modulus the integral would be 2π−1π−1π2\frac2\pi - \frac1\pi - \frac{1}{\pi^2}⁠, that is 1π−1π2≈0.216989\frac1\pi - \frac{1}{\pi^2} \approx 0.216989⁠: the negative part cancels some of the positive part, which is exactly what the modulus prevents.

Common mistakes
  1. Thinking xsin⁡πx<0x\sin\pi x < 0 on (−1,0)(-1, 0)⁠. Both factors are negative there, so the product is positive.
  2. Forgetting the minus sign on (1,32](1, \frac32], or putting it on the wrong piece.
  3. Wrong values at the limits. cos⁡3π2=0\cos\frac{3\pi}{2} = 0 and sin⁡3π2=−1\sin\frac{3\pi}{2} = -1⁠; cos⁡(±π)=−1\cos(\pm\pi) = -1⁠.
  4. Integrating sin⁡πx\sin\pi x as −cos⁡πx-\cos\pi x⁠. The inner factor π\pi gives −cos⁡πxπ-\frac{\cos\pi x}{\pi}⁠, and integrating once more gives the 1π2\frac{1}{\pi^2}⁠.
What to take away
  1. For ∫∣g(x)∣ dx\int|g(x)|\,dx⁠: find the zeros of gg in the interval, find its sign on each piece, split with P2, and remove the modulus piece by piece.
  2. ∫xsin⁡kx dx=−xcos⁡kxk+sin⁡kxk2+C\int x\sin kx\,dx = -\frac{x\cos kx}{k} + \frac{\sin kx}{k^2} + C (by parts, xx first).
  3. Even functions over [−a,a][-a, a]⁠: P7 (i) halves the work.

Every fact used, and where it comes from

FactUsed inSource
Sign of sin⁡θ\sin\theta in each quadrantStep 1Class XI trigonometry
P2: splitting the intervalStep 2Section 7.10, property P2 (Lesson: properties)
Integration by parts, ILATE choiceStep 3Section 7.6 (Lesson: integration by parts)
Theorem 2: ∫abf=F(b)−F(a)\int_a^b f = F(b) - F(a)Steps 4, 5Section 7.8.3
P7 (i) for even functionsStep 4 (alternative)Section 7.10, property P7
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 →