Skip to main content

Math 220-2: Kursobjekt

Section 1.21 Rational functions

Definition 1.21.1. Rational function.

A rational function is a function that can be expressed as a quotient of two polynomials.

Remark 1.21.5.

There is a more general statement of partial fraction decomposition for the case where the irreducible factors of \(q\) include repeated linear and/or quadratic terms, but we will not cover it. Consult the textbook if you are curious.

Example 1.21.6. Rational function.

Compute \(\displaystyle\int \frac{x+2}{x^2-1}\, dx\)
Solution.
We have
\begin{align*} \frac{x+2}{x^2-1}=\frac{A}{x-1}+\frac{B}{x+1}\amp \implies x+2=A(x+1)+B(x-1) \text{.} \end{align*}
Evaluating the right-hand side at \(x=1\) and \(x=-1\) yields
\begin{align*} 3 \amp = 2A\\ 1 \amp = -2B\text{,} \end{align*}
and thus \(A=3/2\text{,}\) \(B=-1/2\text{.}\) We conclude
\begin{align*} \int \frac{x+2}{x^2-1}\, dx \amp= \int \frac{3}{2}\frac{1}{x+1}-\frac{1}{2}\frac{1}{x-1}\, dx \\ \amp = \frac{3}{2}\ln\abs{x+1}-\frac{1}{2}\ln\abs{x-1}+C\text{.} \end{align*}

Example 1.21.7. Long division first.

Compute \(\displaystyle\int \frac{x^2}{x^2+2x-1}\, dx\)
Solution.
First perform polynomial division with remainder to write
\begin{equation*} \frac{x^2}{x^2+2x-1}=1-\frac{2x-1}{x^2+2x-1}\text{.} \end{equation*}
Next, we factor \(x^2+2x-1=(x-\alpha)(x-\beta)\text{,}\) where
\begin{align*} \alpha \amp = -1+\sqrt{2} \amp \beta\amp =-1-\sqrt{2}\text{.} \end{align*}
Now perform partial fraction decomposition
\begin{align*} \frac{2x-1}{(x-\alpha)(x-\beta)} \amp = \frac{A}{x-\alpha}+\frac{B}{x-\beta}\\ 2x-1 \amp = A(x-\beta)+B(x-\alpha)\text{.} \end{align*}
Evaluating the last identity at \(x=\alpha\) and \(x=\beta\text{,}\) we conclude
\begin{align*} 2\alpha-1 \amp = A(\alpha-\beta)\\ 2\beta-1 \amp = B(\beta-\alpha)\text{,} \end{align*}
or equivalently,
\begin{align*} -3+2\sqrt{2} \amp = 2\sqrt{2}A\\ -3-2\sqrt{2} \amp= -2\sqrt{2}B\text{.} \end{align*}
We conclude that \(A=\frac{1}{2\sqrt{2}}(-3+2\sqrt{2})=\frac{4-3\sqrt{2}}{4}\) and \(B=\frac{1}{2\sqrt{2}}(-3-2\sqrt{2})=\frac{4+3\sqrt{2}}{4}\text{,}\) and thus
\begin{align*} \int \frac{x^2}{x^2+2x-1}\, dx \amp = \int 1-\frac{4-3\sqrt{2}}{4}\frac{1}{x-\alpha}-\frac{4+3\sqrt{2}}{4}\frac{1}{x-\beta}\, dx\\ \amp = x-\frac{4-3\sqrt{2}}{4}\ln\abs{x-(-1+\sqrt{2})}-\frac{4+3\sqrt{2}}{4}\ln\abs{x-(-1-\sqrt{2})}+C \end{align*}

Example 1.21.8. Three distinct roots.

Compute \(\displaystyle\int\frac{x^2+1}{x^3+2x^2-x-2}\, dx\)
Solution.
First we factor \(q(x)=x^3+2x^2-x-2\text{.}\) An integer root of \(q(x)\) must divide \(2\text{,}\) thus we investigate \(\pm 1, \pm 2\) as potential roots. Since \(q(1)=1+1-1-2=0\text{,}\) we see that \(x=1\) is a root of \(q(x)\) and thus \((x-1)\) is a factor of \(q(x)\text{.}\) Performing polynomial division with remainder, we see that \(q(x)=(x-1)(x^2+3x+2)\text{.}\) Factoring the quadratic term further, we see that
\begin{equation*} q(x)=(x-1)(x+1)(x+2)\text{.} \end{equation*}
Now perform partial fractions:
\begin{align*} \frac{x^2+1}{x^3+2x^2-x-2} \amp =\frac{A}{x-1}+\frac{B}{x+1}+\frac{C}{x+2}\\ x^2+1 \amp = A(x+1)(x+2)+B(x-1)(x+2)+C(x-1)(x+1)\text{.} \end{align*}
Evaluating this identity at \(x=1, -1,-2\text{,}\) we see that
\begin{align*} 2 \amp = 6A \\ 2 \amp = -2B\\ 5 \amp = 3C \end{align*}
and thus \(A=\frac{1}{3}, B=-1, C=\frac{5}{3}\text{.}\) Thus
\begin{align*} \int\frac{x^2+1}{x^3+2x^2-x-2}\, dx \amp = \frac{1}{3}\frac{1}{x-1}-\frac{1}{x+1}+\frac{5}{3}\frac{1}{x+2}\, dx \\ \amp = \frac{1}{3}\ln\abs{x-1}-\ln\abs{x+1}+\frac{5}{3}\ln\abs{x+2}+C\text{.} \end{align*}

Example 1.21.9. Two irreducible quadratics.

Compute \(\displaystyle\int\frac{1}{x^4+3x^2+2}\)
Solution.
First note that the denominator \(q(x)=x^4+3x^2+2=(x^2)^2+3x^2+2=(x^2+1)(x^2+2)\text{,}\) where \(x^2+1\) and \(x^2+2\) are both irreducible. Now perform partial fractions:
\begin{align*} \frac{1}{x^4+3x^2+2} \amp = \frac{Ax+B}{x^2+1}+\frac{Cx+D}{x^2+2}\\ 1 \amp = (Ax+B)(x^2+2)+(Cx+D)(x^2+1)=(A+C)x^3+(B+D)x^2+(A+2C)x+B+2D\text{.} \end{align*}
Note that in this case we cannot evaluate the identity above at the roots of \(x^2+1\) and \(x^2+2\) since they have none (in the reals)! Instead we use (3) from Theorem 1.21.2 and produce a linear system by equating the coefficients of two polynomials \((A+B)x^3+(B+D)x^2+(A+2C)x+(B+2D)\) and \(0x^3+0x^2+0x+1\text{:}\)
\begin{align} A+C \amp = 0\tag{1.21.3}\\ B+D \amp = 0\tag{1.21.4}\\ 2A+C \amp = 0\tag{1.21.5}\\ 2B+D \amp = 1\text{.}\tag{1.21.6} \end{align}
Equations (1.21.3) and (1.21.5) together imply \(A=C=0\text{.}\) Equation (1.21.4) implies \(B=-D\text{;}\) equation (1.21.6) then implies \(D=-1\) and \(B=1\text{.}\) We conclude that
\begin{equation*} \frac{1}{x^4+3x^2+2}=\frac{1}{x^2+1}-\frac{1}{x^2+2} \end{equation*}
and thus
\begin{align*} \int \frac{1}{x^4+3x^2+2}\, dx \amp = \int \frac{1}{x^2+1}-\frac{1}{x^2+2}\, dx \\ = \int \frac{1}{x^2+1}-\frac{1}{2(x/\sqrt{2})^2+1)}\, dx \\ \amp = \arctan(x)-\frac{\sqrt{2}}{2}\arctan(x/\sqrt{2})+C \end{align*}

Example 1.21.10. With substitution.

Compute \(\displaystyle \frac{\sin \theta}{\cos^2\theta +\cos \theta-2}\, d\theta\)
Solution.
Resist the temptation to apply partial fraction decomposition directly to the integrand! Since the integrand is not a rational function, Theorem 1.21.3 does not apply. Instead we first do an obvious substitution:
\begin{align*} \int \frac{\sin \theta}{\cos^2\theta +\cos \theta-2}\, d\theta \amp = -\int \frac{1}{u^2 +u-2}\, du \amp (u=\cos\theta, du=-\sin\theta d\theta) \\ \amp = -\int \frac{1}{3}\frac{1}{u-1}-\frac{1}{3}\frac{1}{u+2}\, du \amp (\text{part. frac. decomp.})\\ \amp =\frac{1}{3}(\ln\abs{\cos\theta+2}-\ln\abs{\cos\theta-1})+C\\ \amp = \ln\sqrt[3]{\abs{\frac{\cos\theta+2}{\cos\theta-1}}}+C \amp (\text{log. props.}) \end{align*}
.