8.6: Rational Functions
- Page ID
- 916
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)A rational function is a fraction with polynomials in the numerator and denominator. For example,
\[ {x^3\over x^2+x-6}, \qquad\qquad {1\over (x-3)^2}, \qquad\qquad {x^2+1\over x^2-1}, \]
are all rational functions of \(x\). There is a general technique called "partial fractions'' that, in principle, allows us to integrate any rational function. The algebraic steps in the technique are rather cumbersome if the polynomial in the denominator has degree more than 2, and the technique requires that we factor the denominator, something that is not always possible. However, in practice one does not often run across rational functions with high degree polynomials in the denominator for which one has to find the antiderivative function. So we shall explain how to find the antiderivative of a rational function only when the denominator is a quadratic polynomial \( ax^2+bx+c\).
We should mention a special type of rational function that we already know how to integrate: If the denominator has the form \( (ax+b)^n\), the substitution \(u=ax+b\) will always work. The denominator becomes \( u^n\), and each \(x\) in the numerator is replaced by \((u-b)/a\), and \(dx=du/a\). While it may be tedious to complete the integration if the numerator has high degree, it is merely a matter of algebra.
Example \( \PageIndex{1}\
Find \( \int{x^3\over(3-2x)^5}\,dx.\)
Solution
Using the substitution \(u=3-2x\) we get
\[\eqalign{ \int{x^3\over(3-2x)^5}\,dx &={1\over -2}\int {\left({u-3\over-2}\right)^3\over u^5}\,du ={1\over 16}\int {u^3-9u^2+27u-27\over u^5}\,du\cr &={1\over 16}\int u^{-2}-9u^{-3}+27u^{-4}-27u^{-5}\,du\cr &={1\over 16}\left({u^{-1}\over-1}-{9u^{-2}\over-2}+{27u^{-3}\over-3} -{27u^{-4}\over-4}\right)+C\cr &={1\over 16}\left({(3-2x)^{-1}\over-1}-{9(3-2x)^{-2}\over-2}+ {27(3-2x)^{-3}\over-3} -{27(3-2x)^{-4}\over-4}\right)+C\cr &=-{1\over 16(3-2x)}+{9\over32(3-2x)^2}-{9\over16(3-2x)^3}+{27\over64(3-2x)^4}+C.\cr }\]
We now proceed to the case in which the denominator is a quadratic polynomial. We can always factor out the coefficient of \( x^2\) and put it outside the integral, so we can assume that the denominator has the form \( x^2+bx+c\). There are three possible cases, depending on how the quadratic factors: either \( x^2+bx+c=(x-r)(x-s)\), \( x^2+bx+c=(x-r)^2\), or it doesn't factor. We can use the quadratic formula to decide which of these we have, and to factor the quadratic if it is possible.
Example \( \PageIndex{2}\
Determine whether \( x^2+x+1\) factors, and factor it if possible.
Solution
The quadratic formula tells us that \( x^2+x+1=0\) when \[x={-1\pm\sqrt{1-4}\over 2}.\] Since there is no square root of \(-3\), this quadratic does not factor.
Example \( \PageIndex{3}\
Determine whether \( x^2-x-1\) factors, and factor it if possible.
Solution
The quadratic formula tells us that \( x^2-x-1=0\) when
\[x={1\pm\sqrt{1+4}\over 2}={1\pm\sqrt{5}\over2}.\]
Therefore
\[ x^2-x-1=\left(x-{1+\sqrt{5}\over2}\right)\left(x-{1-\sqrt{5}\over2}\right). \]
If \( x^2+bx+c=(x-r)^2\) then we have the special case we have already seen, that can be handled with a substitution. The other two cases require different approaches.
If \( x^2+bx+c=(x-r)(x-s)\), we have an integral of the form
\[\int{p(x)\over (x-r)(x-s)}\,dx\]
where \(p(x)\) is a polynomial. The first step is to make sure that \(p(x)\) has degree less than 2.
Example \( \PageIndex{4}\
Rewrite \( \int {x^3\over (x-2)(x+3)}\,dx\) in terms of an integral with a numerator that has degree less than 2.
Solution
To do this we use long division of polynomials to discover that
\[ {x^3\over (x-2)(x+3)}={x^3\over x^2+x-6}=x-1+{7x-6\over x^2+x-6}= x-1+{7x-6\over (x-2)(x+3)}, \]
so
\[ \int {x^3\over (x-2)(x+3)}\,dx=\int x-1\,dx +\int {7x-6\over (x-2)(x+3)}\,dx. \]
The first integral is easy, so only the second requires some work.
Now consider the following simple algebra of fractions: \[ {A\over x-r}+{B\over x-s}={A(x-s)+B(x-r)\over (x-r)(x-s)}= {(A+B)x-As-Br\over (x-r)(x-s)}. \[ That is, adding two fractions with constant numerator and denominators \((x-r)\) and \((x-s)\) produces a fraction with denominator \((x-r)(x-s)\) and a polynomial of degree less than 2 for the numerator. We want to reverse this process: starting with a single fraction, we want to write it as a sum of two simpler fractions. An example should make it clear how to proceed.
Example \( \PageIndex{5}\
Evaluate \[ \int {x^3\over (x-2)(x+3)}\,dx.\]
Solution
We start by writing \( {7x-6\over (x-2)(x+3)}\) as the sum of two fractions. We want to end up with
\[{7x-6\over (x-2)(x+3)}={A\over x-2}+{B\over x+3}.\]
If we go ahead and add the fractions on the right hand side we get
\[{7x-6\over (x-2)(x+3)}={(A+B)x+3A-2B\over (x-2)(x+3)}.\]
So all we need to do is find \(A\) and \(B\) so that \(7x-6=(A+B)x+3A-2B\), which is to say, we need \(7=A+B\) and \(-6=3A-2B\). This is a problem you've seen before: solve a system of two equations in two unknowns.
There are many ways to proceed; here's one: If \(7=A+B\) then \(B=7-A\) and so \(-6=3A-2B=3A-2(7-A)=3A-14+2A=5A-14\). This is easy to solve for \(A\): \( A= 8/5\), and then \(B=7-A=7-8/5=27/5\). Thus
\[ \int {7x-6\over (x-2)(x+3)}\,dx= \int {8\over5}{1\over x-2}+{27\over5}{1\over x+3}\,dx= {8\over5}\ln |x-2|+{27\over5}\ln|x+3|+C. \]
The answer to the original problem is now
\[\eqalign{ \int {x^3\over (x-2)(x+3)}\,dx &=\int x-1\,dx +\int {7x-6\over (x-2)(x+3)}\,dx\cr &={x^2\over 2}-x+{8\over5}\ln |x-2|+{27\over5}\ln|x+3|+C.\cr }\]
Now suppose that \( x^2+bx+c\) does not factor. Again we can use long division to ensure that the numerator has degree less than 2, then we complete the square.
Example \( \PageIndex{6}\
Evaluate
\[ \int {x+1\over x^2+4x+8}\,dx.\]
Solution
The quadratic denominator does not factor. We could complete the square and use a trigonometric substitution, but it is simpler to rearrange the integrand:
\[ \int {x+1\over x^2+4x+8}\,dx = \int {x+2\over x^2+4x+8}\,dx - \int {1\over x^2+4x+8}\,dx. \]
The first integral is an easy substitution problem, using \(u=x^2+4x+8\):
\[ \int {x+2\over x^2+4x+8}\,dx={1\over2}\int {du\over u}= {1\over2}\ln|x^2+4x+8|. \]
For the second integral we complete the square:
\[ x^2+4x+8=(x+2)^2+4=4\left(\left({x+2\over2}\right)^2+1\right), \]
making the integral
\[ {1\over4}\int {1\over\left({x+2\over2}\right)^2+1}\,dx. \]
Using \( u={x+2\over2}\) we get
\[ {1\over4}\int {1\over\left({x+2\over2}\right)^2+1}\,dx= {1\over4}\int {2\over u^2+1}\,dx= {1\over2}\arctan\left({x+2\over2}\right). \]
The final answer is now
\[ \int {x+1\over x^2+4x+8}\,dx={1\over2}\ln|x^2+4x+8|- {1\over2}\arctan\left({x+2\over2}\right)+C. \]