27.4 Integrating Rational Functions

AHL 5.16

In this section you will learn
  • the standard integrals that give \(\arctan\) and \(\arcsin\)
  • how to integrate \(\dfrac{f'(x)}{a^2 + \big[f(x)\big]^2}\) and \(\dfrac{f'(x)}{\sqrt{a^2 - \big[f(x)\big]^2}}\)
  • how to use partial fractions when the denominator factorises
  • how to complete the square when the quadratic does not factorise
  • how to split the numerator when it is linear
  • (Extension) the logarithm forms for \(\dfrac{1}{x^2 - a^2}\) and \(\dfrac{1}{a^2 - x^2}\)

A rational function is \(\dfrac{f(x)}{g(x)}\), where \(f\) and \(g\) are polynomials. The form of the denominator and the numerator tells you which method to use.

Standard forms: arctan and arcsin

From the HL derivatives, \(\dfrac{\mathrm{d}}{\mathrm{d}x}\arctan\dfrac{x}{a} = \dfrac{a}{a^2 + x^2}\) and \(\dfrac{\mathrm{d}}{\mathrm{d}x}\arcsin\dfrac{x}{a} = \dfrac{1}{\sqrt{a^2 - x^2}}\) (for \(a > 0\)).

Standard integrals (\(a > 0\)) In the HL formula booklet

\[ \int \frac{1}{a^2 + x^2}\,\mathrm{d}x = \frac{1}{a}\arctan\left(\frac{x}{a}\right) + C \]

\[ \int \frac{1}{\sqrt{a^2 - x^2}}\,\mathrm{d}x = \arcsin\left(\frac{x}{a}\right) + C, \quad \lvert x\rvert < a \]

  • \(a\): a positive constant (\(a > 0\))
  • \(C\): the constant of integration

When the sign in the denominator is a minus without a square root, the answer is a logarithm. Both results come from partial fractions, for example \(\dfrac{1}{x^2 - a^2} = \dfrac{1}{2a}\left(\dfrac{1}{x - a} - \dfrac{1}{x + a}\right)\).

\[ \int \frac{1}{x^2 - a^2}\,\mathrm{d}x = \frac{1}{2a}\ln\left\lvert\frac{x - a}{x + a}\right\rvert + C, \qquad \int \frac{1}{a^2 - x^2}\,\mathrm{d}x = \frac{1}{2a}\ln\left\lvert\frac{a + x}{a - x}\right\rvert + C. \]

These are not in the formula booklet. In an IB question you would normally be led through the partial fractions.

Example 1 Find

(a) \(\displaystyle\int \frac{5}{\sqrt{3 - x^2}}\,\mathrm{d}x\)

(b) \(\displaystyle\int \frac{1}{25 + 4x^2}\,\mathrm{d}x\)

(a) \(a^2 = 3\), so \(a = \sqrt{3}\): \(\;\displaystyle\int \frac{5}{\sqrt{3 - x^2}}\,\mathrm{d}x = 5\arcsin\left(\frac{x}{\sqrt{3}}\right) + C\).

(b) Make the coefficient of \(x^2\) equal to \(1\) first: \(25 + 4x^2 = 4\left(\dfrac{25}{4} + x^2\right)\), so \(a = \dfrac{5}{2}\).

\[ \int \frac{1}{4}\cdot\frac{1}{\frac{25}{4} + x^2}\,\mathrm{d}x = \frac{1}{4}\cdot\frac{2}{5}\arctan\left(\frac{2x}{5}\right) + C = \frac{1}{10}\arctan\left(\frac{2x}{5}\right) + C \]

The forms with a function \(f(x)\)

If \(x\) is replaced by a function \(f(x)\), the chain rule puts \(f'(x)\) in the numerator.

Reverse chain rule with arctan and arcsin Not in the formula booklet

\[ \begin{gathered} \int \frac{f'(x)}{a^2 + \big[f(x)\big]^2}\,\mathrm{d}x = \frac{1}{a}\arctan\left(\frac{f(x)}{a}\right) + C, \\ \int \frac{f'(x)}{\sqrt{a^2 - \big[f(x)\big]^2}}\,\mathrm{d}x = \arcsin\left(\frac{f(x)}{a}\right) + C \end{gathered} \]

  • \(f(x)\): a function of \(x\)
  • \(f'(x)\): the derivative of \(f(x)\)
  • \(a\): a positive constant (\(a > 0\))
  • \(C\): the constant of integration

Example 2 Find

(a) \(\displaystyle\int \frac{4x}{\sqrt{1 - x^4}}\,\mathrm{d}x\)

(b) \(\displaystyle\int \frac{6x^2}{9 + x^6}\,\mathrm{d}x\)

(a) \(x^4 = \left(x^2\right)^2\). Take \(f(x) = x^2\), \(f'(x) = 2x\), \(a = 1\). Then \(4x = 2f'(x)\):

\[ \int \frac{4x}{\sqrt{1 - \left(x^2\right)^2}}\,\mathrm{d}x = 2\arcsin\left(x^2\right) + C. \]

(b) \(x^6 = \left(x^3\right)^2\). Take \(f(x) = x^3\), \(f'(x) = 3x^2\), \(a = 3\). Then \(6x^2 = 2f'(x)\):

\[ \int \frac{6x^2}{9 + \left(x^3\right)^2}\,\mathrm{d}x = 2 \cdot \frac{1}{3}\arctan\left(\frac{x^3}{3}\right) + C = \frac{2}{3}\arctan\left(\frac{x^3}{3}\right) + C. \]

The denominator factorises: partial fractions

If the denominator is a quadratic with two different linear factors, split the fraction into partial fractions (see Section 3.1). Each part integrates to a logarithm.

If the fraction is improper (degree of numerator \(\geq\) degree of denominator), divide first.

Example 3 Find

(a) \(\displaystyle\int \frac{1}{x^2 - 3x + 2}\,\mathrm{d}x\)

(b) \(\displaystyle\int \frac{x^2 - 2x + 5}{x^2 - 4x + 3}\,\mathrm{d}x\)

(a) \(x^2 - 3x + 2 = (x - 1)(x - 2)\). Write \(\dfrac{1}{(x - 1)(x - 2)} = \dfrac{A}{x - 1} + \dfrac{B}{x - 2}\), so \(1 = A(x - 2) + B(x - 1)\).

\(x = 2\): \(B = 1\). \(\quad x = 1\): \(A = -1\).

\[ \int \left(\frac{1}{x - 2} - \frac{1}{x - 1}\right)\mathrm{d}x = \ln\lvert x - 2\rvert - \ln\lvert x - 1\rvert + C = \ln\left\lvert\frac{x - 2}{x - 1}\right\rvert + C \]

(b) The fraction is improper (both degrees are 2). Divide: \(x^2 - 2x + 5 = 1 \times (x^2 - 4x + 3) + (2x + 2)\), so

\[ \frac{x^2 - 2x + 5}{x^2 - 4x + 3} = 1 + \frac{2x + 2}{(x - 1)(x - 3)}. \]

\(2x + 2 = A(x - 3) + B(x - 1)\). \(\;x = 3\): \(8 = 2B\), \(B = 4\). \(\;x = 1\): \(4 = -2A\), \(A = -2\).

\[ \int \left(1 - \frac{2}{x - 1} + \frac{4}{x - 3}\right)\mathrm{d}x = x - 2\ln\lvert x - 1\rvert + 4\ln\lvert x - 3\rvert + C \]

The denominator does not factorise: complete the square

If \(ax^2 + bx + c\) does not factorise and the numerator is a constant, complete the square. The integrand then becomes one of the standard forms with \(x\) replaced by \(x + k\). Since \(\dfrac{\mathrm{d}}{\mathrm{d}x}(x + k) = 1\), the standard results apply directly.

Example 4 Find

(a) \(\displaystyle\int \frac{1}{3x^2 + 6x + 15}\,\mathrm{d}x\)

(b) Extension \(\displaystyle\int \frac{1}{1 + 4x - x^2}\,\mathrm{d}x\)

(a) \(3x^2 + 6x + 15 = 3(x^2 + 2x + 5) = 3\big[(x + 1)^2 + 4\big]\). So \(a = 2\):

\[ \int \frac{1}{3}\cdot\frac{1}{2^2 + (x + 1)^2}\,\mathrm{d}x = \frac{1}{3}\cdot\frac{1}{2}\arctan\left(\frac{x + 1}{2}\right) + C = \frac{1}{6}\arctan\left(\frac{x + 1}{2}\right) + C \]

(b) \(1 + 4x - x^2 = 5 - (x^2 - 4x + 4) = 5 - (x - 2)^2\). So \(a = \sqrt{5}\), and the logarithm form (Extension box above) gives

\[ \int \frac{1}{\left(\sqrt{5}\right)^2 - (x - 2)^2}\,\mathrm{d}x = \frac{1}{2\sqrt{5}}\ln\left\lvert\frac{\sqrt{5} + x - 2}{\sqrt{5} - x + 2}\right\rvert + C. \]

If the quadratic is under a square root, completing the square leads to \(\arcsin\).

Example 5 Find \(\displaystyle\int \frac{1}{\sqrt{6x - x^2}}\,\mathrm{d}x\).

\(6x - x^2 = -(x^2 - 6x) = -\big[(x - 3)^2 - 9\big] = 9 - (x - 3)^2\). So \(a = 3\):

\[ \int \frac{1}{\sqrt{3^2 - (x - 3)^2}}\,\mathrm{d}x = \arcsin\left(\frac{x - 3}{3}\right) + C. \]

Linear numerator: split the numerator

Suppose the numerator is linear, \(px + q\), and the quadratic \(f(x) = ax^2 + bx + c\) does not factorise. Write the numerator as a multiple of \(f'(x)\) plus a constant:

\[ \frac{px + q}{f(x)} = k_1\,\frac{f'(x)}{f(x)} + \frac{m}{f(x)}. \]

The first part gives \(k_1\ln\lvert f(x)\rvert\). The second part is the constant-numerator case above.

Example 6 Find

(a) \(\displaystyle\int \frac{x + 4}{x^2 + 6x + 13}\,\mathrm{d}x\)

(b) Extension \(\displaystyle\int \frac{x - 1}{x^2 + 2x - 2}\,\mathrm{d}x\)

(a) \(f(x) = x^2 + 6x + 13\), \(f'(x) = 2x + 6\). Then \(x + 4 = \dfrac{1}{2}(2x + 6) + 1\), and \(f(x) = (x + 3)^2 + 4\).

\[ \int \frac{x + 4}{x^2 + 6x + 13}\,\mathrm{d}x = \frac{1}{2}\int \frac{2x + 6}{x^2 + 6x + 13}\,\mathrm{d}x + \int \frac{1}{(x + 3)^2 + 2^2}\,\mathrm{d}x \]

\[ = \frac{1}{2}\ln\left(x^2 + 6x + 13\right) + \frac{1}{2}\arctan\left(\frac{x + 3}{2}\right) + C. \]

(\(f(x) > 0\) for all \(x\), so no modulus is needed.)

(b) \(f(x) = x^2 + 2x - 2\), \(f'(x) = 2x + 2\). Then \(x - 1 = \dfrac{1}{2}(2x + 2) - 2\), and \(f(x) = (x + 1)^2 - 3\).

\[ \int \frac{x - 1}{x^2 + 2x - 2}\,\mathrm{d}x = \frac{1}{2}\ln\left\lvert x^2 + 2x - 2\right\rvert - 2\int \frac{1}{(x + 1)^2 - \left(\sqrt{3}\right)^2}\,\mathrm{d}x \]

\[ = \frac{1}{2}\ln\left\lvert x^2 + 2x - 2\right\rvert - \frac{1}{\sqrt{3}}\ln\left\lvert\frac{x + 1 - \sqrt{3}}{x + 1 + \sqrt{3}}\right\rvert + C. \]

The same idea works with a square root in the denominator:

\[ \frac{px + q}{\sqrt{f(x)}} = k_1\,\frac{f'(x)}{\sqrt{f(x)}} + \frac{m}{\sqrt{f(x)}}, \qquad \int \frac{f'(x)}{\sqrt{f(x)}}\,\mathrm{d}x = 2\sqrt{f(x)} + C. \]

Example 7 Find

(a) \(\displaystyle\int \frac{x + 2}{\sqrt{1 - 9x^2}}\,\mathrm{d}x\)

(b) \(\displaystyle\int \frac{x + 5}{\sqrt{3 - 2x - x^2}}\,\mathrm{d}x\)

(a) Split: \(\dfrac{x}{\sqrt{1 - 9x^2}} + \dfrac{2}{\sqrt{1 - 9x^2}}\).

First part: \(f(x) = 1 - 9x^2\), \(f'(x) = -18x\), so \(x = -\dfrac{1}{18}f'(x)\), giving \(-\dfrac{1}{18} \cdot 2\sqrt{1 - 9x^2} = -\dfrac{1}{9}\sqrt{1 - 9x^2}\).

Second part: \(\sqrt{1 - 9x^2} = \sqrt{1 - (3x)^2}\). With \(f(x) = 3x\), \(f'(x) = 3\): \(\displaystyle\int \frac{2}{\sqrt{1 - (3x)^2}}\,\mathrm{d}x = \frac{2}{3}\arcsin 3x\).

\[ \int \frac{x + 2}{\sqrt{1 - 9x^2}}\,\mathrm{d}x = -\frac{1}{9}\sqrt{1 - 9x^2} + \frac{2}{3}\arcsin 3x + C \]

(b) \(f(x) = 3 - 2x - x^2\), \(f'(x) = -2 - 2x\). Then \(x + 5 = -\dfrac{1}{2}(-2 - 2x) + 4\). Also \(f(x) = 4 - (x + 1)^2\).

\[ \int \frac{x + 5}{\sqrt{3 - 2x - x^2}}\,\mathrm{d}x = -\frac{1}{2} \cdot 2\sqrt{3 - 2x - x^2} + 4\int \frac{1}{\sqrt{2^2 - (x + 1)^2}}\,\mathrm{d}x \]

\[ = -\sqrt{3 - 2x - x^2} + 4\arcsin\left(\frac{x + 1}{2}\right) + C. \]

Summary: integrating \(\dfrac{\text{numerator}}{\text{quadratic}}\)

  1. Is the numerator a multiple of the derivative of the denominator? → \(\ln\lvert f(x)\rvert\) (or \(2\sqrt{f(x)}\) under a root).
  2. Does the denominator factorise? → partial fractions (divide first if improper).
  3. Otherwise, constant numerator → complete the square → \(\arctan\) (or \(\arcsin\) under a root).
  4. Linear numerator → split into \(k_1 f'(x) + m\), then use 1 and 3.

Common errors

✗ Wrong ✓ Right Why
\(\int \dfrac{1}{9 + x^2}\,\mathrm{d}x = \arctan\dfrac{x}{3}\) \(\dfrac{1}{3}\arctan\dfrac{x}{3} + C\) The \(\arctan\) form has a factor \(\dfrac{1}{a}\); the \(\arcsin\) form does not.
\(\int \dfrac{1}{4 + 9x^2}\,\mathrm{d}x = \dfrac{1}{2}\arctan\dfrac{x}{2}\) \(\dfrac{1}{6}\arctan\dfrac{3x}{2} + C\) Take out \(9\) first (or use \(f(x) = 3x\)): the coefficient of \(x^2\) must be \(1\).
\(\int \dfrac{1}{x^2 + 1}\,\mathrm{d}x = \ln(x^2 + 1)\) \(\arctan x + C\) The numerator is not \(2x\).
Partial fractions on \(\dfrac{x^2 + 1}{x^2 - 1}\) straight away Divide first: \(1 + \dfrac{2}{x^2 - 1}\) The fraction is improper.
\(\int \dfrac{1}{\sqrt{4 - x^2}}\,\mathrm{d}x = \dfrac{1}{2}\arcsin\dfrac{x}{2}\) \(\arcsin\dfrac{x}{2} + C\) No \(\dfrac{1}{a}\) in the \(\arcsin\) form.

Exercises

1 Find \(\displaystyle\int \frac{1}{9 + x^2}\,\mathrm{d}x\).

\(a = 3\): \(\;\dfrac{1}{3}\arctan\left(\dfrac{x}{3}\right) + C\).

2 Find \(\displaystyle\int \frac{2}{\sqrt{16 - x^2}}\,\mathrm{d}x\).

\(a = 4\): \(\;2\arcsin\left(\dfrac{x}{4}\right) + C\).

3 Find \(\displaystyle\int \frac{1}{\sqrt{4 - 9x^2}}\,\mathrm{d}x\).

\(4 - 9x^2 = 2^2 - (3x)^2\). With \(f(x) = 3x\), \(f'(x) = 3\): \(\;\dfrac{1}{3}\arcsin\left(\dfrac{3x}{2}\right) + C\).

4 Find \(\displaystyle\int \frac{3}{1 + 4x^2}\,\mathrm{d}x\).

\(1 + (2x)^2\) with \(f(x) = 2x\), \(f'(x) = 2\), \(a = 1\): \(\;\dfrac{3}{2}\arctan 2x + C\).

5 Find \(\displaystyle\int \frac{\mathrm{e}^x}{1 + \mathrm{e}^{2x}}\,\mathrm{d}x\).

\(\mathrm{e}^{2x} = \left(\mathrm{e}^x\right)^2\). With \(f(x) = \mathrm{e}^x = f'(x)\) and \(a = 1\): \(\;\arctan\left(\mathrm{e}^x\right) + C\).

6 Find \(\displaystyle\int \frac{4}{x^2 + 2x - 3}\,\mathrm{d}x\).

\(x^2 + 2x - 3 = (x - 1)(x + 3)\). \(\;4 = A(x + 3) + B(x - 1)\): \(x = 1\) gives \(A = 1\); \(x = -3\) gives \(B = -1\).

\(\displaystyle\int \left(\frac{1}{x - 1} - \frac{1}{x + 3}\right)\mathrm{d}x = \ln\left\lvert\frac{x - 1}{x + 3}\right\rvert + C\).

7 Find \(\displaystyle\int \frac{5x + 1}{(x - 1)(2x + 1)}\,\mathrm{d}x\).

\(5x + 1 = A(2x + 1) + B(x - 1)\). \(\;x = 1\): \(6 = 3A\), \(A = 2\). \(\;x = -\dfrac{1}{2}\): \(-\dfrac{3}{2} = -\dfrac{3}{2}B\), \(B = 1\).

\(\displaystyle\int \left(\frac{2}{x - 1} + \frac{1}{2x + 1}\right)\mathrm{d}x = 2\ln\lvert x - 1\rvert + \frac{1}{2}\ln\lvert 2x + 1\rvert + C\).

8 Find \(\displaystyle\int \frac{1}{x^2 + 4x + 8}\,\mathrm{d}x\).

\(x^2 + 4x + 8 = (x + 2)^2 + 4\): \(\;\dfrac{1}{2}\arctan\left(\dfrac{x + 2}{2}\right) + C\).

9 Find \(\displaystyle\int \frac{1}{\sqrt{8 + 2x - x^2}}\,\mathrm{d}x\).

\(8 + 2x - x^2 = 9 - (x - 1)^2\): \(\;\arcsin\left(\dfrac{x - 1}{3}\right) + C\).

10 Find \(\displaystyle\int \frac{2x + 5}{x^2 + 2x + 5}\,\mathrm{d}x\).

\(2x + 5 = (2x + 2) + 3\) and \(x^2 + 2x + 5 = (x + 1)^2 + 4\).

\(\displaystyle\int \frac{2x + 2}{x^2 + 2x + 5}\,\mathrm{d}x + 3\int \frac{1}{(x + 1)^2 + 2^2}\,\mathrm{d}x = \ln\left(x^2 + 2x + 5\right) + \frac{3}{2}\arctan\left(\frac{x + 1}{2}\right) + C\).