# How to Integrate x*sin^2(x) or x*sin(x)^2

TR Smith is a product designer and former teacher who uses math in her work every day.

The function equal to x times the square of the sine of x can be written two different ways, either f(x) = x*sin(x)^2 or f(x) = x*sin^2(x), as shown in the image above. The choice of notation is up to personal preference. To integrate f(x) = x*sin(x)^2, you must transform it with a trigonometric identity and apply integration by parts.

Functions like f(x) often arise in the solutions of differential equations, and have applications to resonance problems in physics and mechanics. If a particle in motion has a velocity of v(t) = t*sin(t)^2, then the antiderivative of this functions gives the total distance traveled. Here we will work out the antiderivative of f(x) = x*sin(x)^2 using two different procedures that yield the same answer.

## Graph of y = x*sin(x)^2

Graph of the function f(x) = x*sin(x)^2 or f(x) = x*sin^2(x)

## Method 1: Trigonometric Identity Tricks

To compute the integral ∫ x*sin(x)^2 dx with a trick involving trigonometric identities, we need to use the fundamental trig identity and a double angle formula,

sin(x)^2 + cos(x)^2 = 1
sin(x)^2 - cos(x)^2 = -cos(2x

This allows us to easily compute two auxiliary integrals

∫ x(sin(x)^2 + cos(x)^2) dx
= ∫ x dx
= (1/2)x^2 + C

∫ x(sin(x)^2 - cos(x)^2) dx
= -∫ x*cos(2x) dx
= -(x/2)sin(2x) - (1/4)cos(2x) + C

The integral of x*cos(x) requires integration by parts and is worked out in the linked tutorial. To integrate x*cos(2x), you make a simple u-substitution with x = u/2. By adding the two integral equations above we also obtain

[∫ x(sin(x)^2 + cos(x)^2) dx] + [∫ x(sin(x)^2 - cos(x)^2) dx]
= 2 * ∫ x*sin(x)^2 dx

If we substitute the auxiliary integral expressions, we get

2 * ∫ x*sin(x)^2 dx
= (1/2)x^2 - (x/2)sin(2x) - (1/4)cos(2x) + C

Dividing both sides by 2 gives us the final answer:

∫ x*sin(x)^2 dx = (x/2)^2 - (x/4)sin(2x) - cos(2x)/8 + C

With this method we can also recover the integral of x*cos(x)^2; we simply subtract the two auxiliary integral equations instead of add them. This gives us

∫ x*cos(x)^2 dx = (x/2)^2 + (x/4)sin(2x) + cos(2x)/8 + C

Antiderivatives of x*sin(x)^2 and x*cos(x)^2.

## Method 2: Standard Method

The standard method of finding the antiderivative of x*sin(x)^2 is to first apply the double angle formula

sin(x)^2 = 1/2 - (1/2)cos(2x)

This gives us the new integral

∫ x*sin(x)^2 dx
= ∫ (x/2)(1 - cos(x)) dx
= ∫ x/2 dx - ∫ (x/2)*cos(2x) dx
= (x/2)^2 - (x/4)sin(2x) - cos(2x)/8 + C

Again, the integration by parts step is hyperlinked. As you can see, the standard method produces the answer much more quickly than the previous integration method.

Useful trigonometric identities. | Source

## Example Integration Problem

In the graph above, the blue curve is f(x) = x*sin(x)^2. The graph touches the x-axis at x = 0, π, 2π, 3π, ... etc. Two regions below the curve are shaded in pink and green. What is the ratio of the green area to the pink area? To solve this problem, we need to express the area of the shaded regions as definite integrals.

Pink = ∫ x*sin(x)^2 dx, 0 ≤ x ≤ π

Green = ∫ x*sin(x)^2 dx, π ≤ x ≤ 2π

To evaluate these integrals, we plug the endpoints of the interval into the antiderivative equation and subtract. Evaluating the pink and green integrals, we get

Pink
= [2π^2 - 2π*sin(2π) - cos(2π)]/8 - [0^2 - 0*sin(0) - cos(0)]/8
= (π^2)/4 - 1/8 + 1/8
= (π^2)/4

Green
= = [2*4π^2 - 4π*sin(4π) - cos(4π)]/8 - [2π^2 - 2π*sin(2π) - cos(2π)]/8
= π^2 - 1/8 - (π^2)/4 + 1/8
= (3π^2)/4

The ratio of the green to pink shaded regions is

[(3π^2)/4] / [(π^2)/4] = 3

So the ratio is 3:1, or in other terms, the green shaded region has 3 times the area as the pink shaded region.

For the function f(x) = x*sin(x)^2, the area under a single hump spanning from x = nπ to x = (n+1)π is given by the formula

Hump Area = [(2n+1)π^2]/4.

which is shown in the image above and to the right. This is a linear function of n.

## Other Properties of the Function f(x) = x*sin(x)^2

Comparison of f(x) = x*sin(x)^2 in red, and g(x) = x*cos(x)^2 in blue.

The peaks of the function f(x) = x*sin(x)^2 appear to occur halfway between the zeros of the function, that is, the highest points look like they are at x = π/2, 3π/2, 5π/2, 7π/2, ... etc. However, the peaks are actually slightly off center. Where are they?

Since slope of the tangent line at a peak is 0, we can find their location by setting the derivative of f(x) equal to 0 and solving for x.

f'(x) = sin(x)^2 + 2x*sin(x)cos(x) = 0

Solving this gives us

sin(x)^2 = -2x*sin(x)cos(x)
sin(x) = -2x*cos(x)
tan(x) = -2x

This equation cannot be solved algebraically, but numerical solution methods produce these approximate values

x = 1.8366 for the first peak, to the right of π/2
x = 4.8158 for the second peak, to the right of 3π/2
x = 7.9171 for the third peak, to the right of 5π/2
x = 11.0408 for the fourth peak, to the right of 7π/2

It turns out all the peaks are slightly to the right of the center point where they appear to be.

0

3

4

1

2

## Popular

10

30

• ### Names of Geometric Shapes—With Pictures

30

0 of 8192 characters used