# Introduction to partial fractions

• In this section, we show how to integrate a rational function $f(x)=\frac{p(x)}{q(x)},$ provided that we can factorize the polynomial in the denominator $$q$$ to a product of linear polynomials and irreducible quadratic polynomials.
• To illustrate the method, observe that we have $\frac{1}{x-3}-\frac{2}{x+2}=\frac{x+2-2(x-3)}{(x-3)(x+2)}=\frac{-x+6}{x^2-x-6}.$
• Therefore, reversing the process, we get $\int\frac{-x+6}{x^2-x-6}\,\mathrm dx=\int\frac{1}{x-3}-\frac{2}{x+2}\,\mathrm dx=\ln|x-3|-2\ln|x+2|+C.$
• The method of Partial fractions works in case the degree of $$p$$ is less than the degree of $$q$$.
• Recall that if we have $p(x)=a_nx^n+a_{n-1}x^{n-1}+\dotsb+a_1x+a_0$ with $$a_n\ne0$$, then we say that the degree of $$p(x)$$ is $$n$$, and we write $$\mathrm{deg}(p)=n$$.
• If we have $$\mathrm{deg}(p)<\mathrm{deg}(q)$$, then we call the rational function $$f=\frac{p}{q}$$ proper.
• If $$f$$ is not proper, that is if $$\mathrm{deg}(p)\ge\mathrm{deg}(q)$$, then we call $$f$$ improper.
• If $$f$$ is improper, then we have to take the preliminary step of performing long division of $$p$$ by $$q$$.

# Introduction to partial fractions

• For example, consider $$f(x)=\frac{x^3-2x}{x+1}$$.
• We perform long division: \begin{align*} &\hphantom{x+1)}\underline{x^2-x-1}\\ &x+1)x^3\hphantom{{}-x}-2x\\ &\hphantom{x+1)}\underline{x^3+x^2}\\ &\hphantom{x+1)x^3}-x^2-2x\\ &\hphantom{x+1)x^3}\underline{{}-x^2-\hphantom{2}x}\\ &\hphantom{x+1)x^3-x^2}-\hphantom{2}x\\ &\hphantom{x+1)x^3-x^2}\underline{{}-\hphantom{2}x-1}\\ &\hphantom{x+1)x^3-x^2-2x-{}}1 \end{align*}
• This gives $$x^3-2x=(x+1)(x^2-x-1)+1$$, and thus $$\frac{x^3-2x}{x+1}=x^2-x-1+\frac{1}{x+1}$$.
• Therefore, we get $\int\frac{x^3-2x}{x+1}\,\mathrm dx=\int x^2-x-1+\frac{1}{x+1}\,\mathrm dx=\frac13x^3-\frac12x^2-x+\ln|x+1|+C.$

# Case I. The denominator $$q$$ is a product of distinct linear factors

• Suppose that we have $q(x)=(a_1x+b_1)(a_2x+b_2)\dotsb(a_kx+b_k),$ where no factor is a constant multiple of another.
• This means that if $$\frac{b_i}{a_i}=\frac{b_j}{a_j}$$ for some $$1\le i,j\le k$$, then we have $$i=j$$.
• In this case, there exist constants $$A_1,A_2,\dotsc,A_k$$ such that $\frac{p(x)}{q(x)}=\frac{A_1}{a_1x+b_1}+\frac{A_2}{a_2x+b_2}+\dotsb+\frac{A_k}{a_kx+b_k}.$
• The method of Partial fractions amounts to finding the constants $$A_1,A_2,\dotsc,A_n$$.
• This can be done by i) multiplying the equation by $$q(x)$$, ii) equating the coefficients in the polynomial equation we get, and iii) solving the linear equation we've gotten.

# Case I. The denominator $$q$$ is a product of distinct linear factors

• $$\int\frac{x^2-5x+4}{x^3+5x^2+6x}$$
• First, we need to factorize the denominator: $x^3+5x^2+6x=x(x^2+5x+6)=x(x+2)(x+3).$
• Then we need to multiply the equation $\frac{x^2-5x+4}{x^3+5x^2+6x}=\frac{A_1}{x}+\frac{A_2}{x+2}+\frac{A_3}{x+3}$ by $$q$$.
• We get \begin{align*} x^2-5x+4=&A_1(x+2)(x+3)+A_2x(x+3)+A_3x(x+2)\\ =&A_1(x^2+5x+6)+A_2(x^2+3x)+A_3(x^2+2x)\\ =&x^2(A_1+A_2+A_3)+x(5A_1+3A_2)+6A_1. \end{align*}

# Case I. The denominator $$q$$ is a product of distinct linear factors

• Equating the coefficients, we get the system of linear equations \begin{align*} \hphantom{6}A_1+\hphantom{3}A_2+\hphantom{2}A_3&=1\\ 5A_1+3A_2+2A_3&=-5\\ 6A_1\hphantom{{}+3A_2+2A_3}&=4. \end{align*}
• We immediately get $$A_1=\frac23$$. Substituting this to the first two equations, we get \begin{align} \hphantom3A_2+\hphantom2A_3&=\frac13\tag{I}\\ 3A_2+2A_3&=-\frac{25}{3}\tag{II}. \end{align}
• Using this, we get \begin{align*} II-2I:&A_2=-9\\ -II+3I:&A_3=\frac{28}{3}. \end{align*}
• We have gotten $\frac{x^2-5x+4}{x^3+5x^2+6x}=\frac{A_1}{x}+\frac{A_2}{x+2}+\frac{A_3}{x+3}=\frac23\frac{1}{x}-9\frac{1}{x+2}+\frac{28}{3}\frac{1}{x+3}.$
• Now we can integrate: $\int\frac{x^2-5x+4}{x^3+5x^2+6x}\,\mathrm dx=\int\frac23\frac{1}{x}-9\frac{1}{x+2}+\frac{28}{3}\frac{1}{x+3}\,\mathrm dx=\frac23\ln|x|-9\ln|x+2|+\frac{28}{3}\ln|x+3|+C.$
• Exercises. 7.4: 7, 11, 15, 27

# Case II. $$q$$ is a product of linear factors, some of which are repeated

• Suppose that the factor $$(a_1x+b_1)$$ is repeated $$r$$ times; that is, $$(a_1x+b_1)^r$$ occurs in the factorization of $$q(x)$$. Then we need to replace the single term $$\frac{A_1}{a_1x+b_1}$$ by the sum $\frac{A_1}{a_1x+b_1}+\frac{A_2}{(a_1x+b_1)^2}+\dotsb+\frac{A_r}{(a_1x+b_1)^r}.$
• $$\int\frac{x^2+2x-3}{x^3-x^2-x+1}\,\mathrm dx$$.
• Since we have $$q(1)=0$$, we know that $$x-1$$ divides $$q(x)$$.
• Performing the division, we get $q(x)=(x-1)(x^2-1)=(x-1)^2(x+1).$
• Therefore, we need $\frac{x^2+2x-3}{(x-1)^2(x+1)}=\frac{A_1}{x-1}+\frac{A_2}{(x-1)^2}+\frac{A_3}{x+1}.$
• Multiplying the equation with $$q$$, we get \begin{align*} x^2+2x-3=&A_1(x-1)(x+1)+A_2(x+1)+A_3(x-1)^2\\ =&A_1(x^2-1)+A_2(x+1)+A_3(x^2-2x+1)\\ =&x^2(A_1+A_3)+x(A_2-2A_3)+(-A_1+A_2+A_3). \end{align*}

# Case II. $$q$$ is a product of linear factors, some of which are repeated

• This gives the system of linear equations \begin{align} \hphantom{-}A_1\hphantom{{}+A_2}+\hphantom{2}A_3&=1\tag{I}\\ \hphantom{-A_1+{}}A_2-2A_3&=2\tag{II}\\ -A_1+A_2+\hphantom{2}A_3&=-3.\tag{III} \end{align}
• $$\mathrm{I}+\mathrm{III}$$ gives an additional equation $$$A_2+2A_3=-2.\tag{IV}$$$
• Then $$\mathrm{II}+\mathrm{IV}$$ gives $$A_2=0$$, using which in II we get $$A_3=-1$$, and substituting that into I gives $$A_1=2$$.
• Now we can integrate: $\int\frac{x^2+2x-3}{x^3-x^2-x+1}\,\mathrm dx=\int\frac{2}{x-1}-\frac{1}{x+1}\,\mathrm dx=2\ln|x-1|-\ln|x+1|+C.$
• Exercises. 7.4: 16, 21.

# Case III. $$q$$ contains irreducible quadratic factors, none of which is a constant multiple of the other

• Consider the polynomial $$r(x)=ax^2+bx+c$$.
• Recall that if the discriminant is negative: $$b^2-4ac<0$$, then $$r(x)$$ has no real roots. In this case, we say that $$r$$ is irreducible.
• For every irreducible quadratic factor $$ax^2+bx+c$$ of $$q(x)$$, we need to include a term of the form $\frac{Ax+B}{ax^2+bx+c}$ in the Partial fractions formula.
• After we've found the constants $$A$$ and $$B$$, we need to complete the square in the denominator, and use $\int\frac{Cx+D}{x^2+\alpha^2}\,\mathrm dx=\frac{C}{2}\ln|x^2+\alpha^2|+\frac{D}{\alpha}\tan^{-1}\frac{x}{\alpha}+K.$

# Case III. $$q$$ contains irreducible quadratic factors, none of which is a constant multiple of the other

• $$\int\frac{x^2-2x+3}{x^3+x^2+x}$$.
• We have $$q(x)=x(x^2+x+1)$$. Since its discriminant is $$1-4<0$$, the polynomial $$x^2+x+1$$ is irreducible.
• Therefore, we need to solve $\frac{x^2-2x+3}{x(x^2+x+1)}=\frac{A}{x}+\frac{Bx+C}{x^2+x+1}.$
• Multiplying with $$q$$, we get \begin{align*} x^2-2x+3=&A(x^2+x+1)+(Bx+C)x\\ =&x^2(A+B)+x(A+C)+A. \end{align*}
• This gives the system of linear equations \begin{align*} A+B\hphantom{{}+C}&=3\\ A\hphantom{{}+B}+C&=-2\\ A\hphantom{{}+B+C}&=3, \end{align*} which gives $$A=3,\,B=0,\,C=-5$$.

# Case III. $$q$$ contains irreducible quadratic factors, none of which is a constant multiple of the other

• Now we can proceed: $\int\frac{x^2-2x+3}{x^3+x^2+x}\,\mathrm dx=\int\frac{3}{x}-\frac{5}{x^2+x+1}\,\mathrm dx$
• Let's integrate the second term separately. We have $$x^2+x+1=(x+\frac12)^2+\frac34$$. Therefore, the substitution $$u=x+\frac12$$ gives $\int\frac{1}{x^2+x+1}\,\mathrm dx=\frac{1}{u^2+(\sqrt3/2)^2}\,\mathrm du=\frac{2}{\sqrt3}\tan^{-1}\frac{2u}{\sqrt3}+K=\frac{2}{\sqrt3}\tan^{-1}\frac{2x+1}{\sqrt3}+K.$
• This gives the final answer: $\int\frac{3}{x}-\frac{5}{x^2+x+1}\,\mathrm dx=3\ln|x|-\frac{10}{\sqrt3}\tan^{-1}\frac{2x+1}{\sqrt3}+K.$
• Exercises. 7.4: 23, 25, 32.

# Case IV. $$q$$ contains a repeated irreducible quadratic factor

• Suppose that $$q(x)$$ has the factor $$(ax^2+bx+c)^r$$, where $$b^2-4ac<0$$. Then in the Partial fractions formula, the term $\frac{Ax+B}{ax^2+bx+c}$ needs to be replaced by the sum $\frac{A_1x+B_1}{ax^2+bx+c}+\frac{A_2x+B_2}{(ax^2+bx+c)^2}+\dotsb+\frac{A_rx+B_r}{(ax^2+bx+c)^r}.$
• To integrate the term $$\int\frac{1}{(ax^2+bx+c)^2}\,\mathrm dx$$, you need to first complete the square to get $$\int\frac{1}{(x^2+\alpha^2)^r}\,\mathrm dx$$, and then substitute $$x=\alpha\tan\theta$$.

# Case IV. $$q$$ contains a repeated irreducible quadratic factor

• $$\int\frac{x+3}{(2x^2+x+2)^2}\,\mathrm dx$$.
• We need to solve $\frac{x+3}{(2x^2+x+2)^2}=\frac{A_1x+B_1}{2x^2+x+2}+\frac{A_2x+B_2}{(2x^2+x+2)^2}.$
• Multiplying with $$q$$, we get \begin{align*} x+3=&(A_1x+B_1)(2x^2+x+2)+A_2x+B_2\\ =&x^32A_1+x^2(A_1+2B_1)+x(2A_1+2B_1+A_2)+2B_1+B_2. \end{align*}
• Equating the coefficients, we get $$A_1=0$$, $$B_1=0$$, $$A_2=1$$, $$B_2=3$$.
• Therefore, we have $\int\frac{x+3}{(2x^2+x+2)^2}\,\mathrm dx=\int\frac{x+3}{(2x^2+x+2)^2}\,\mathrm dx.$
• Let's integrate the terms separately. First, we have $\int\frac{x}{(2x^2+x+2)^2}\,\mathrm dx\stackrel{u=2x^2+x+2}{=}\frac14\int u^{-2}\,\mathrm du=-\frac{1}{4(2x^2+x+2)}+C$

# Case IV. $$q$$ contains a repeated irreducible quadratic factor

• Now let's consider $$\int\frac{1}{(2x^2+x+2)^2}\,\mathrm dx$$. First, to complete the square: $2x^2+x+2=(\sqrt2x+2^{-3/2})^2+\frac{15}{8}.$
• Let $$\alpha=\sqrt\frac{15}{8}$$, and take $\int\frac{1}{(2x^2+x+2)^2}\,\mathrm dx\stackrel{u=\sqrt2x+2^{-3/2}}{=}2^{-1/2}\int\frac{1}{(u^2+\alpha^2)^2}\,\mathrm du.$
• We can keep going by taking $$u=\alpha\theta$$: $=2^{-1/2}\int\frac{\alpha^2(\sec\theta)^2}{\alpha^4(\sec\theta)^4}\,\mathrm d\theta=2^{-1/2}\alpha^{-2}\int(\cos\theta)^2\,\mathrm d\theta=2^{-3/2}\alpha^{-2}\int1+\cos2\theta\,\mathrm d\theta=2^{-3/2}\alpha^{-2}\left(\theta+\frac12\sin2\theta\right)+C.$
• Since we have $$\tan\theta=\frac{u}{\alpha}$$, by drawing a right triangle with leg across $$\theta$$ of length $$x$$ and other leg of length $$\alpha$$ to see that $\sin\theta=\frac{u}{\sqrt{u^2+\alpha^2}}\text{ and }\cos\theta=\frac{\alpha}{\sqrt{u^2+\alpha^2}}\text{ so }\sin2\theta=2\frac{u\alpha}{u^2+\alpha^2}.$
• Therefore, the final answer is $-\frac{1}{4(2x^2+x+2)}+2^{-3/2}\alpha^{-2}\left(\tan^{-1}\frac{\sqrt2x+2^{-3/2}}{\alpha}+\frac{(\sqrt2x+2^{-3/2})\alpha}{(\sqrt2+2^{-3/2})^2+\alpha^2}\right)+C.$
• Exercises. 7.4: 35, 37.

# Rationalizing substitutions

• When an integrand contains an expression of the form $$\sqrt[n]{g(x)}$$, then the substitution $$u=\sqrt[n]{g(x)}$$ may be effective.
• $$\int\frac{\sqrt{x-3}}{x}\,\mathrm dx$$.
• Let $$u=\sqrt{x-3}$$. Then we have $$u^2+3=x$$, and $$2\sqrt{x-3}\,\mathrm du=\mathrm dx$$.
• Therefore, applying this substitution to the integral, we get $2\int\frac{u^2}{u^2+3}\,\mathrm du=2\left(u+\frac{1}{\sqrt3}\tan^{-1}\frac{u}{\sqrt3}\right)+C=2\left(\sqrt{x-3}+\frac{1}{\sqrt3}\tan^{-1}\frac{\sqrt{x-3}}{\sqrt3}\right)+C.$
• Exercises. 7.4: 39, 41, 47, 49.