Integrating sin² and cos²

The double angle tames the square.

Why sin² needs a rewrite

The four functions on the sine and cosine ring differentiate to sin x, cos x, −sin x and −cos x. None of them differentiates to sin²x, so there is no integral to read off the ring.

Treating sin x as if it were x does not work either. The guess sin³x/3 differentiates, by the chain rule, to (3 sin²x × cos x)/3 = sin²x cos x. That has an extra factor of cos x, so sin³x/3 is not the integral of sin²x.

The double angle formula removes the square

One form of the double angle formula for cosine is cos 2x = 1 − 2 sin²x. Rearrange it for the square: 2 sin²x = 1 − cos 2x, so sin²x = (1 − cos 2x)/2.

The right-hand side has no square in it. It is a constant, ½, minus a plain cosine, ½ cos 2x, and both of those integrate directly.

Check at x = π/6: sin(π/6) = ½, so sin²x = 1/4. On the right, cos(π/3) = ½, so (1 − ½)/2 = 1/4 as well.

xy

The curve y = sin²x and the line y = ½. The curve swings between 0 and 1, an amount ½ either side of the line, and repeats every π, which is the period of cos 2x. That is what sin²x = ½ − ½ cos 2x says: a constant ½, and a wave of size ½ about it.

Integrating the pieces

Now ∫ sin²x dx = ∫ (½ − ½ cos 2x) dx. The ½ integrates to x/2. The cos 2x has a 2 inside, so it integrates to (sin 2x)/2, and ½ of that is (sin 2x)/4. Together, ∫ sin²x dx = x/2 − (sin 2x)/4 + C.

Check by differentiating. x/2 gives ½, and (sin 2x)/4 gives (2 cos 2x)/4 = ½ cos 2x. So the derivative is ½ − ½ cos 2x, which is sin²x.

cos² takes a plus

Another form of the same formula is cos 2x = 2 cos²x − 1. Rearranged, cos²x = (1 + cos 2x)/2: the same move, with a plus where sin² had a minus. Check at x = 0: cos²0 = 1, and (1 + 1)/2 = 1.

So ∫ cos²x dx = x/2 + (sin 2x)/4 + C. Adding the two results gives ∫ (sin²x + cos²x) dx = x + C, which is right, since sin²x + cos²x = 1.

½yπ/2π3π/22π1y = cos²xX/2 = 1.1 · sin 2X / 4 = −0.238 · ∫ = 0.862

cos²x = ½ + ½ cos 2x: the ½ integrates to X/2 and the wave to sin 2X / 4 = −0.238, so the green and red pieces do not yet cancel

Drag the limit to where the wave cancels

The area under y = cos²x from 0 to X, measured against the line y = ½. The term X/2 is the rectangle under the line; the term (sin 2X)/4 is what the curve adds above the line less what it leaves out below. At X = 2.2 that is 1.1 − 0.238 = 0.862. Drag X to π/2, π, 3π/2 or 2π, where sin 2X = 0: the parts above and below the line cancel, and the area is exactly X/2.

Definite integrals

Over half a turn the wave term vanishes. The integral of sin²x from 0 to π is [x/2 − (sin 2x)/4]₀^π = π/2 − 0, since sin 2π = 0 and sin 0 = 0. The integral of cos²x over the same interval is also π/2, and the two add to π, the integral of 1.

Over a part of a wave it does not. The integral of sin²x from 0 to π/4 is π/8 − (sin(π/2))/4 = π/8 − 1/4 ≈ 0.143. That is less than half of the width π/4 ≈ 0.785, because sin²x stays below ½ until x = π/4.

Other angles and products

With 3x in place of x, the double angle is 6x: sin²(3x) = (1 − cos 6x)/2, so ∫ sin²(3x) dx = x/2 − (sin 6x)/12 + C. Check: the derivative is ½ − (6 cos 6x)/12 = ½ − ½ cos 6x.

A product of sine and cosine uses the sine formula instead. sin 2x = 2 sin x cos x, so sin x cos x = (sin 2x)/2, which integrates to −(cos 2x)/4 + C. Check: −(cos 2x)/4 differentiates to (2 sin 2x)/4 = (sin 2x)/2.

Worked example: An Alternating Supply Into a Heater: The Steady Voltage That Would Do the Same Work

Question A generator supplies v = 340sin(π n10) volts, where n is the number of milliseconds since the voltage last passed through zero on its way up; one whole cycle takes 20 milliseconds. (a) Find the mean of v2 over one cycle, and hence the root mean square voltage. (b) The supply feeds a heating element of resistance 34 ohms, in which the instantaneous power is v234 watts. Find the mean power, and compare it with the power a steady 340 volts would give.

  1. 1.The mean of v2 over a cycle is 120∫020 3402sin2(π n10)dn. Replace the squared sine by its double-angle form, sin2θ = 1 − cos 2θ2, which gives sin2(π n10) = 12 − 12cos(π n5).

    0100020003000400005101520n, millisecondspower in the element, Wsine squared = half − half cos(pi n / 5)
    0100020003000400005101520n, millisecondspower in the element, Wsine squared = half − half cos(pi n / 5)
    The power is v234 watts, a squared sine; the double angle writes it as 12 − 12cos(π n5) of its peak.
  2. 2.The cosine term contributes nothing. Its antiderivative is 5πsin(π n5), which is 0 at n = 0 and 0 again at n = 20, so ∫020cos(π n5)dn = 0: over a whole number of cycles the cosine cancels itself out.

    0100020003000400005101520n, millisecondspower in the element, Wsine squared = half − half cos(pi n / 5)the cosine is zero at n = 0 and at n = 20
    0100020003000400005101520n, millisecondspower in the element, Wsine squared = half − half cos(pi n / 5)the cosine is zero at n = 0 and at n = 20
    Across a whole cycle the cosine term integrates to nothing, because sin(π n5) is 0 at n = 0 and 0 again at n = 20.
  3. 3.(a) What survives is the constant half: the mean of v2 is 34022 = 1156002 = 57800. The root mean square voltage is the square root of that, 340√2 = 240.4 volts, or 240 volts to three significant figures.

    0100020003000400005101520n, millisecondspower in the element, Wmean 1700 Wsine squared = half − half cos(pi n / 5)the cosine is zero at n = 0 and at n = 20(a) mean of v × v = 115600 halved = 57800root mean square = 340/√2= 240.4 V
    0100020003000400005101520n, millisecondspower in the element, Wmean 1700 Wsine squared = half − half cos(pi n / 5)the cosine is zero at n = 0 and at n = 20(a) mean of v × v = 115600 halved = 57800root mean square = 340/√2= 240.4 V
    (a) What survives is the constant half: the mean of v2 is 1156002 = 57800, whose root is 340√2 = 240.4 volts.
  4. 4.(b) Averaging is linear, so the mean of v234 is the mean of v2 divided by 34: the mean power is 5780034 = 1700 watts.

    0100020003000400005101520n, millisecondspower in the element, Wmean 1700 Wsine squared = half − half cos(pi n / 5)the cosine is zero at n = 0 and at n = 20(a) mean of v × v = 115600 halved = 57800root mean square = 340/√2= 240.4 V(b) mean power = 57800 over 34 = 1700 W
    0100020003000400005101520n, millisecondspower in the element, Wmean 1700 Wsine squared = half − half cos(pi n / 5)the cosine is zero at n = 0 and at n = 20(a) mean of v × v = 115600 halved = 57800root mean square = 340/√2= 240.4 V(b) mean power = 57800 over 34 = 1700 W
    (b) The mean power is that mean divided by the resistance, 5780034 = 1700 watts: the humps above the line fill the gaps below it.
  5. 5.A steady 340 volts across the same element would give 340234 = 3400 watts, exactly twice as much. Check: the mean of a squared sine is 12, so the alternating supply delivers half the peak power, and the steady voltage that would match it is smaller by a factor of √2, which is the 240.4 volts of part (a).

    0100020003000400005101520n, millisecondspower in the element, Wmean 1700 Wsteady 340 V: 3400 Wsine squared = half − half cos(pi n / 5)the cosine is zero at n = 0 and at n = 20(a) mean of v × v = 115600 halved = 57800root mean square = 340/√2= 240.4 V(b) mean power = 57800 over 34 = 1700 Wa steady 340 V gives 3400 W, twice as much
    0100020003000400005101520n, millisecondspower in the element, Wmean 1700 Wsteady 340 V: 3400 Wsine squared = half − half cos(pi n / 5)the cosine is zero at n = 0 and at n = 20(a) mean of v × v = 115600 halved = 57800root mean square = 340/√2= 240.4 V(b) mean power = 57800 over 34 = 1700 Wa steady 340 V gives 3400 W, twice as much
    A steady 340 volts would hold the element at 340234 = 3400 watts, exactly twice the mean.

Answer: (a) the mean of v2 is 57800 and the root mean square voltage is 340√2 = 240.4 volts, which is 240 volts to three significant figures; (b) the mean power is 1700 watts, against 3400 watts for a steady 340 volts, exactly twice as much

Common mistakes

  • Averaging v rather than v2. Over a whole cycle ∫020 340sin(π n10)dn = 0, so the mean voltage is zero, and yet the element plainly gets hot. Power depends on v2, which is never negative, and it is the mean of that square which matters.
  • Taking the effective voltage to be half the peak, 170 volts. The halving happens to the square, not to the voltage: the mean of v2 is 34022, whose root is 340√2 = 240.4 volts. A steady 170 volts would deliver 170234 = 850 watts, half the true mean power.

More techniques of integration problems, worked step by step →

The usual mistakes

Integrating the square as a power. sin³x/3 differentiates to sin²x cos x, not sin²x.

The plus and minus swapped. sin²x = (1 − cos 2x)/2 has the minus. At x = 0, sin²x is 0, and only the minus version gives (1 − 1)/2 = 0.

Halving one piece and not the other. Both the 1 and the cos 2x are divided by 2, so the answer is x/2 − (sin 2x)/4 + C, not x − (sin 2x)/4 + C.

Forgetting the 2 inside. cos 2x integrates to (sin 2x)/2, not sin 2x; with the ½ in front, that makes (sin 2x)/4.

Using sin²x + cos²x = 1. It only trades sin²x for 1 − cos²x, which still has a square.

Practice Integrating sin² and cos² in the app