Take u=x2, which drops to 2x when differentiated, and dv=exdx, so du=2xdx and v=ex. The new integral still holds a power of x, but one degree lower.
∫x2exdx=x2ex−∫2xexdx
2
Second round
Keep the same kind of choice, u=2x and dv=exdx, so du=2 dx and v=ex. That gives 2xex−∫2exdx, which is twice the first worked example’s answer.
∫2xexdx=2xex−2ex+C
3
Combine
Subtract the second result from x2ex. The minus sign reaches both terms, x2ex−(2xex−2ex)=x2ex−2xex+2ex, and ex factors out.
∫x2exdx=ex(x2−2x+2)+C
4
Check by differentiating
The derivative of ex(x2−2x+2) is ex(x2−2x+2)+ex(2x−2)=x2ex. The 2x and the 2 cancel in pairs, which is why the constant in the bracket must be +2.
Result
∫x2exdx=ex(x2−2x+2)+C. The bracket x2−2x+2=(x−1)2+1 is never zero, so with C=0 the antiderivative is positive everywhere, and it only rises, as a function with slope x2ex≥0 must.
Your turn
1. One like the example
Find ∫x2sinxdx.
Show the answer and explanation
−x2cosx+2xsinx+2cosx+C.
Round one, u=x2 and dv=sinxdx,gives −x2cosx+∫2xcosxdx. Round two, u=2x and dv=cosxdx, gives ∫2xcosxdx=2xsinx−∫2sinxdx=2xsinx+2cosx. Together the answer is −x2cosx+2xsinx+2cosx+C.
∫x2sinxdx−x2cosx+2xsinx+2cosx+C
2. A variation
Find ∫exsinxdx. Here no power drops, and the integral comes back.
Show the answer and explanation
ex(sinx−cosx)/2+C.
Call the integral I. Parts with u=sinx gives I=exsinx−∫excosxdx. Parts again with u=cosx gives ∫excosxdx=excosx+I. Then I=exsinx−excosx−I, so 2I=ex(sinx−cosx).
∫exsinxdx2ex(sinx−cosx)+C
3. Somewhere new
Find ∫x3exdx. Three rounds are needed, and the pattern of this example tells you the answer’s shape.
Show the answer and explanation
ex(x3−3x2+6x−6)+C.
Each round with the power of x as u gives xnex−n∫xn−1exdx. Starting from x3, the rounds give x3ex−3x2ex+6xex−6ex, with signs alternating. Differentiating ex(x3−3x2+6x−6) gives ex(x3−3x2+6x−6+3x2−6x+6)=x3ex.
∫x3exdxex(x3−3x2+6x−6)+C
Keep exploring
Check it by differentiating in Math, then change F(x) to ex(x2−2x−2), with one sign slipped. The last row turns to ✗, because its derivative is ex(x2−4).