Week 10 Discussion Notes

Table of Contents

Integration Techniques

As a quick summary, here are the main techniques we learned in the past week:

  • Integration by parts
  • Trig integrals (essentially just trig identities and integration by parts)
  • Trig substitution (basically a uu-substitution combined with trig integrals)
  • Partial fractions

From this list, the only real new one this week is the method of partial fractions.

Partial Fractions

You usually want to use partial fractions when you want to integrate a rational function, i.e., a function of the form

P(x)Q(x),\frac{P\p{x}}{Q\p{x}},

where PP and QQ are polynomials such that degP<degQ\deg{P} < \deg{Q} (if this isn't the case, then you have to do long division first). For example, the result of partial fractions looks something like

1(x1)(x2)=1x21x1.\frac{1}{\p{x - 1}\p{x - 2}} = \frac{1}{x - 2} - \frac{1}{x - 1}.

As you can imagine, the left side is hard to integrate, but the right side is a lot easier to integrate.

Process

When setting up the partial fractions, you want to look at the factors of qq. Here're the rules for the setup:

Linear Factors

For every factor of QQ of the form (x+a)n\p{x + a}^n, you need to include the following terns:

A1x+a+A2(x+a)2++AN(x+a)N.\frac{A_1}{x + a} + \frac{A_2}{\p{x + a}^2} + \cdots + \frac{A_N}{\p{x + a}^N}.

Quadratic Factors

For factors of the form (x2+ax+b)M\p{x^2 + ax + b}^M, you need

A1x+B1x2+ax+b+A2x+B2(x2+ax+b)2++AMx+BM(x2+ax+b)M.\frac{A_1x + B_1}{x^2 + ax + b} + \frac{A_2x + B_2}{\p{x^2 + ax + b}^2} + \cdots + \frac{A_Mx + B_M}{\p{x^2 + ax + b}^M}.

Once you have the setup, you need to solve for all the constants.

Example 1.

Calculate x2(x+1)(x2+1)dx\displaystyle \int \frac{x^2}{\p{x+1}\p{x^2+1}} \,\diff{x}.

Solution.

As you might guess, we're going to want to perform partial fractions first before integrating. We have a factor of (x+1)\p{x + 1} and (x2+1)\p{x^2 + 1}, so our decomposition looks like

x2(x+1)(x2+1)=Ax+1+Bx+Cx2+1x2=A(x2+1)+(Bx+C)(x+1).\begin{gathered} \frac{x^2}{\p{x+1}\p{x^2+1}} = \frac{A}{x+1} + \frac{Bx+C}{x^2+1} \\ x^2 = A\p{x^2 + 1} + \p{Bx + C}\p{x + 1}. \end{gathered}

I multiplied both sides by (x+1)(x2+1)\p{x+1}\p{x^2+1} to get to the second line. From here, there are two main ways to solve for the coefficients:

Method 1: Expand and match coefficients.

If you expand the right-hand side and collect like terms, you get

x2=Ax2+A+Bx2+Bx+Cx+Cx2+0x+0=(A+B)x2+(B+C)x+A+C.\begin{aligned} x^2 &= Ax^2 + A + Bx^2 + Bx + Cx + C \\ x^2 + 0x + 0 &= \p{A + B}x^2 + \p{B + C}x + A + C. \end{aligned}

The equation is true for every value of xx, and this means that the coefficients have to be the same, so you get the system

{A+B=1B+C=0A+C=0\begin{cases} A + B = 1 \\ B + C = 0 \\ A + C = 0 \end{cases}

and you can solve for A,B,CA, B, C from here.

Method 2: Plug in values for xx.

Like before, the equation is true for any xx, so you can plug in convenient values to get equations for your coefficients:

x=1    1=2A    A=12x=0    0=A+C    C=12x=1    1=2A+2(B+C)    B=12.\begin{aligned} x = -1 &\implies 1 = 2A \\ &\implies A = \frac{1}{2} \\ x = 0 &\implies 0 = A + C \\ &\implies C = -\frac{1}{2} \\ x = 1 &\implies 1 = 2A + 2\p{B + C} \\ &\implies B = \frac{1}{2}. \end{aligned}

You can use either method (or even both at the same time), and you should get the same numbers each time. Our calculations tell us that

x2(x+1)(x2+1)=12x+1+12x12x2+1.\frac{x^2}{\p{x+1}\p{x^2+1}} = \frac{\frac{1}{2}}{x+1} + \frac{\frac{1}{2}x - \frac{1}{2}}{x^2+1}.

Now, to integrate this, we just have to integrate all the terms on the right. You'll usually want to split things up at this point:

12x+1dx=12lnx+1+C.\int \frac{\frac{1}{2}}{x+1} \,\diff{x} = \frac{1}{2} \ln{\abs{x+1}} + C.

For the second one, we can use the substitution u=x2+1u = x^2 + 1, which gives du=2xdx\diff{u} = 2x \,\diff{x}. Then

12xx2+1dx=142xx2+1dx=14duu=14lnu+C=14lnx2+1+C.\begin{aligned} \int \frac{\frac{1}{2}x}{x^2 + 1} \,\diff{x} &= \frac{1}{4} \int \frac{2x}{x^2 + 1} \,\diff{x} \\ &= \frac{1}{4} \int \frac{\diff{u}}{u} \\ &= \frac{1}{4} \ln{\abs{u}} + C \\ &= \frac{1}{4} \ln{\abs{x^2+1}} + C. \end{aligned}

Finally, the third one is

12x2+1dx=12arctanx+C.\int \frac{-\frac{1}{2}}{x^2+1} \,\diff{x} = -\frac{1}{2} \arctan{x} + C.

Putting these all together, you get

x2(x+1)(x2+1)dx=12lnx+1+14lnx2+112arctanx+C.\int \frac{x^2}{\p{x+1}\p{x^2+1}} \,\diff{x} = \boxed{\frac{1}{2}\ln{\abs{x+1}} + \frac{1}{4}\ln{\abs{x^2+1}} - \frac{1}{2}\arctan{x} + C}.

Examples

Example 2.

Calculate x3xdx\displaystyle\int x3^x \,\diff{x}.

Solution.

When you see two "unrelated" functions multiplied with each other, usually integration by parts is the way to go. Here, we'll use u=xu = x and dv=3xdx\diff{v} = 3^x \,\diff{x}. Then

du=dxandv=3xln3,\diff{u} = \diff{x} \quad\text{and}\quad v = \frac{3^x}{\ln{3}},

so we get

x3xdx=x3xln33xln3dx=x3xln33x(ln3)2+C.\begin{aligned} \int x3^x \,\diff{x} &= \frac{x3^x}{\ln{3}} - \int \frac{3^x}{\ln{3}} \,\diff{x} \\ &= \boxed{\frac{x3^x}{\ln{3}} - \frac{3^x}{\p{\ln{3}}^2} + C}. \end{aligned}
Example 3.

Calculate 0π/4tan5xdx\displaystyle\int_0^{\pi/4} \tan^5{x} \,\diff{x}.

Solution.

If you have a definite integral, I recommend just calculating the indefinite integral first, and then applying the bounds at the end.

Usually, it's a good idea to use the identity tan2x+1=sec2x\tan^2{x} + 1 = \sec^2{x} and see what happens:

tan5xdx=(sec2x1)tan3xdx=tan3xsec2xdxtan3xdx.\begin{aligned} \int \tan^5{x} \,\diff{x} &= \int \p{\sec^2{x} - 1}\tan^3{x} \,\diff{x} \\ &= \int \tan^3{x}\sec^2{x} \,\diff{x} - \int \tan^3{x} \,\diff{x}. \end{aligned}

We can take care of the first integral with the substitution u=tanxu = \tan{x}, which gives du=sec2xdx\diff{u} = \sec^2{x} \,\diff{x}, so

tan3xsec2xdx=u3du=u44+C=tan4x4+C.\int \tan^3{x} \sec^2{x} \,\diff{x} = \int u^3 \,\diff{u} = \frac{u^4}{4} + C = \frac{\tan^4{x}}{4} + C.

For the second integral, we can use the trig identity again to get

tan3xdx=(sec2x1)tanxdx=tanxsec2xdxtanxdx.\begin{aligned} \int \tan^3{x} \,\diff{x} &= \int \p{\sec^2{x} - 1}\tan{x} \,\diff{x} \\ &= \int \tan{x}\sec^2{x} \,\diff{x} - \int \tan{x} \,\diff{x}. \end{aligned}

We can use u=tanxu = \tan{x} again for the first term, and we already know the second one:

tanxsec2xdx=tan2x2+Ctanxdx=lnsecx+C.\begin{aligned} \int \tan{x}\sec^2{x} \,\diff{x} &= \frac{\tan^2{x}}{2} + C \\ \int \tan{x} \,\diff{x} &= \ln{\abs{\sec{x}}} + C. \end{aligned}

Putting these all together, we get

tan5xdx=tan4x4tan2x2+lnsecx+C.\int \tan^5{x} \,\diff{x} = \frac{\tan^4{x}}{4} - \frac{\tan^2{x}}{2} + \ln{\abs{\sec{x}}} + C.

Now we can apply the bounds. When x=π4x = \frac{\pi}{4}, we get

tan4π44tan2π42+lnsecπ4=1412+ln2=14+ln2.\begin{aligned} \frac{\tan^4{\frac{\pi}{4}}}{4} - \frac{\tan^2{\frac{\pi}{4}}}{2} + \ln{\abs{\sec{\frac{\pi}{4}}}} &= \frac{1}{4} - \frac{1}{2} + \ln{\sqrt{2}} \\ &= -\frac{1}{4} + \ln{\sqrt{2}}. \end{aligned}

When x=0x = 0, we get

tan404tan202+lnsec0=ln1=0.\frac{\tan^4{0}}{4} - \frac{\tan^2{0}}{2} + \ln{\abs{\sec{0}}} = \ln{1} = 0.

Thus,

0π/4tan5xdx=14+ln2.\int_0^{\pi/4} \tan^5{x} \,\diff{x} = \boxed{-\frac{1}{4} + \ln{\sqrt{2}}}.
Example 4.

Calculate x7cos(x4)dx\displaystyle\int x^7\cos{\p{x^4}} \,\diff{x}.

Solution.

Like in the first example, we should integrate by parts. However, if you try it right away, it might get a little complicated. What you can do instead is start with a substitution: let w=x4w = x^4 so dw=4x3dx\diff{w} = 4x^3 \,\diff{x} and

x7cos(x4)dx=14x4cos(x4)4x3dx=14wcoswdw.\begin{aligned} \int x^7 \cos{\p{x^4}} \,\diff{x} &= \frac{1}{4} \int x^4 \cos{\p{x^4}} 4x^3 \,\diff{x} \\ &= \frac{1}{4} \int w\cos{w} \,\diff{w}. \end{aligned}

Now it's more clear what parts we should use: u=wu = w and dv=coswdw\diff{v} = \cos{w} \,\diff{w}, which gives du=dw\diff{u} = \diff{w} and v=sinwv = \sin{w}, so

14wcoswdw=wsinw414sinwdw=wsinw4+cosw4+C.\frac{1}{4} \int w\cos{w} \,\diff{w} = \frac{w\sin{w}}{4} - \frac{1}{4} \int \sin{w} \,\diff{w} = \frac{w\sin{w}}{4} + \frac{\cos{w}}{4} + C.

Undoing the substitution,

x7cos(x4)dx=x4sin(x4)4+cos(x4)4+C.\int x^7 \cos{\p{x^4}} \,\diff{x} = \boxed{\frac{x^4\sin{\p{x^4}}}{4} + \frac{\cos{\p{x^4}}}{4} + C}.
Example 5.

Calculate extan2(ex)dx\displaystyle\int e^x\tan^2{\p{e^x}} \,\diff{x}.

Solution.

Hopefully, your first instinct is to do u=exu = e^x, which gives us du=exdx\diff{u} = e^x \,\diff{x}, so

extan2(ex)dx=tan2udu=sec2u1du=tanuu+C=tan(ex)ex+C.\begin{aligned} \int e^x\tan^2{\p{e^x}} \,\diff{x} &= \int \tan^2{u} \,\diff{u} \\ &= \int \sec^2{u} - 1 \,\diff{u} \\ &= \tan{u} - u + C \\ &= \boxed{\tan{\p{e^x}} - e^x + C}. \end{aligned}
Example 6.

Calculate dxx24x+8\displaystyle\int \frac{\diff{x}}{\sqrt{x^2 - 4x + 8}}.

Solution.

When you see a quadratic under a square root, you will usually want to use a trig substitution. However, right now, it's not clear what substitution to make, but it'll be more clear after completing the square:

x24x+8=(x2)2+4.x^2 - 4x + 8 = \p{x - 2}^2 + 4.

With this, we get

dxx24x+8=dx(x2)2+4=dx4((x2)24+1)=dx2(x22)2+1.\begin{aligned} \int \frac{\diff{x}}{\sqrt{x^2 - 4x + 8}} &= \int \frac{\diff{x}}{\sqrt{\p{x-2}^2 + 4}} \\ &= \int \frac{\diff{x}}{\sqrt{4\p{\frac{\p{x-2}^2}{4} + 1}}} \\ &= \int \frac{\diff{x}}{2\sqrt{\p{\frac{x-2}{2}}^2 + 1}}. \end{aligned}

The thing in the square root looks like the trig identity tan2θ+1=sec2θ\tan^2{\theta} + 1 = \sec^2{\theta}, which suggests the substitution

x22=tanθ    dx2=sec2θdθ.\frac{x-2}{2} = \tan{\theta} \implies \frac{\diff{x}}{2} = \sec^2{\theta} \,\diff{\theta}.

We get

dx2(x22)2+1=sec2θtan2θ+1dθ=sec2θsecθdθ=secθdθ=lnsecθ+tanθ+C.\begin{aligned} \int \frac{\diff{x}}{2\sqrt{\p{\frac{x-2}{2}}^2 + 1}} &= \int \frac{\sec^2{\theta}}{\sqrt{\tan^2{\theta} + 1}} \,\diff{\theta} \\ &= \int \frac{\sec^2{\theta}}{\sec{\theta}} \,\diff{\theta} \\ &= \int \sec{\theta} \,\diff{\theta} \\ &= \ln{\abs{\sec{\theta} + \tan{\theta}}} + C. \end{aligned}

(secθdθ\int \sec{\theta} \,\diff{\theta} is an integral you should just know.)

To finish up, we need to undo the substitution. We already know that tanθ=x22\tan{\theta} = \frac{x-2}{2}, and for secθ\sec{\theta}, we can use the trig identity

sec2θ=tan2θ+1    secθ=tan2θ+1=(x22)2+1.\begin{aligned} \sec^2{\theta} &= \tan^2{\theta} + 1 \\ \implies \sec{\theta} &= \sqrt{\tan^2{\theta} + 1} \\ &= \sqrt{\p{\frac{x-2}{2}}^2 + 1}. \end{aligned}

Plugging everything in, we get

lnsecθ+tanθ+C=ln(x22)2+1+x22+C.\ln{\abs{\sec{\theta} + \tan{\theta}}} + C = \boxed{\ln{\abs{\sqrt{\p{\frac{x-2}{2}}^2 + 1} + \frac{x-2}{2}}} + C}.