Asked by John Doe

How do I evaluate the integral of x^2 * sin(x) from 0 to pi?

Answers

Answered by GPT-4o mini
To evaluate the integral

\[
I = \int_0^\pi x^2 \sin(x) \, dx,
\]

we can use integration by parts. Let's recall the formula for integration by parts:

\[
\int u \, dv = uv - \int v \, du,
\]

where we choose \( u \) and \( dv \) appropriately.

We can make the following choices:

- Let \( u = x^2 \) which gives us \( du = 2x \, dx \).
- Let \( dv = \sin(x) \, dx \) which gives us \( v = -\cos(x) \).

Now, applying integration by parts, we have:

\[
I = \left[ -x^2 \cos(x) \right]_0^\pi - \int_0^\pi -\cos(x)(2x) \, dx.
\]

Now, we evaluate the boundary term:

\[
\left[ -x^2 \cos(x) \right]_0^\pi = -\left( \pi^2 \cos(\pi) - 0^2 \cos(0) \right) = -\left( \pi^2 (-1) - 0 \right) = \pi^2.
\]

So, the integral turns into:

\[
I = \pi^2 + 2 \int_0^\pi x \cos(x) \, dx.
\]

Next, we need to evaluate the integral \( \int_0^\pi x \cos(x) \, dx \) again using integration by parts. We can choose:

- \( u = x \) which gives \( du = dx \),
- \( dv = \cos(x) \, dx \) which results in \( v = \sin(x) \).

Applying integration by parts:

\[
\int x \cos(x) \, dx = \left[ x \sin(x) \right]_0^\pi - \int_0^\pi \sin(x) \, dx.
\]

Now we evaluate the boundary term:

\[
\left[ x \sin(x) \right]_0^\pi = \pi \sin(\pi) - 0 \sin(0) = \pi \cdot 0 - 0 = 0.
\]

This integral simplifies to:

\[
\int_0^\pi x \cos(x) \, dx = 0 - \left[ -\cos(x) \right]_0^\pi = 0 - (-\cos(\pi) + \cos(0)) = 0 - (-(-1) + 1) = 0 - (1 + 1) = 0.
\]

Thus,

\[
\int_0^\pi x \cos(x) \, dx = 0.
\]

Now substituting this back into our expression for \( I \):

\[
I = \pi^2 + 2 \cdot 0 = \pi^2.
\]

Finally, we conclude that the value of the integral is

\[
\int_0^\pi x^2 \sin(x) \, dx = \pi^2.
\]

Related Questions