Solution
For the integral ∫x2sin(x)dx, use integration by parts ∫udv=uv−∫vdu.
Let u=x2 and dv=sin(x)dx.
Then du=(x2)′dx=2xdx (steps can be seen here) and v=∫sin(x)dx=−cos(x) (steps can be seen here).
So,
∫x2sin(x)dx=(x2⋅(−cos(x))−∫(−cos(x))⋅2xdx)=(−x2cos(x)−∫(−2xcos(x))dx)
Apply the constant multiple rule ∫cf(x)dx=c∫f(x)dx with c=−2 and f(x)=xcos(x):
−x2cos(x)−∫(−2xcos(x))dx=−x2cos(x)−(−2∫xcos(x)dx)
For the integral ∫xcos(x)dx, use integration by parts ∫udv=uv−∫vdu.
Let u=x and dv=cos(x)dx.
Then du=(x)′dx=1dx (steps can be seen here) and v=∫cos(x)dx=sin(x) (steps can be seen here).
The integral can be rewritten as
−x2cos(x)+2∫xcos(x)dx=−x2cos(x)+2(x⋅sin(x)−∫sin(x)⋅1dx)=−x2cos(x)+2(xsin(x)−∫sin(x)dx)
The integral of the sine is ∫sin(x)dx=−cos(x):
−x2cos(x)+2xsin(x)−2∫sin(x)dx=−x2cos(x)+2xsin(x)−2(−cos(x))
Therefore,
∫x2sin(x)dx=−x2cos(x)+2xsin(x)+2cos(x)
Add the constant of integration:
∫x2sin(x)dx=−x2cos(x)+2xsin(x)+2cos(x)+C
Answer: ∫x2sin(x)dx=−x2cos(x)+2xsin(x)+2cos(x)+C