# Integration of rational function with quadratic denominator

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

## Reduction

### Reduction to the case where the numerator has smaller degree than the denominator

For further information, refer: converting a rational function from improper fraction to mixed fraction form

To get to the situation where the numerator has smaller degree than the denominator, we perform a Euclidean division and hence rewrite the rational function as the sum of a polynomial and a rational function that is in proper fraction form, i.e., the numerator has smaller degree than the denominator. The polynomial summand is integrated termwise using the integration rule for power functions. We are thus reduced to handling the proper fraction. But remember to add back the antiderivative for the polynomial to your final answer!

### Reduction to the monic denominator case

If the leading coefficient (i.e., the coefficient on the highest degree term) in the denominator is not 1, the leading coefficient can be pulled out as a constant factor from the denominator and hence out of the integration. We can thus carry out an integration with a leading coefficient of 1 for the denominator polynomial (such a polynomial is termed a monic polynomial). But remember to keep that constant on the outside and multiply it to get your final answer!

## Indefinite integration for proper fraction with monic denominator

### Summary of cases

We assume that we have performed the reductions outlined above. Thus, We consider an integration of the form:

$\int \frac{(Ax + B) \, dx}{x^2 + px + q}$

Note that $A,B,p,q$ are arbitrary constants. They may be zero or nonzero.

Sign of discriminant $p^2 - 4q$ Qualitative description of case Antiderivative (we omit the +C for space reasons) Functions whose linear combination gives antiderivative (depend only on denominator) Description of new constants in terms of $p,q$
positive denominator has distinct roots $\alpha_1, \alpha_2$
factors as
$\! (x - \alpha_1)(x - \alpha_2)$
$\frac{A\alpha_1 + B}{\alpha_1 - \alpha_2} \ln|x - \alpha_1| + \frac{A\alpha_2 + B}{\alpha_2 - \alpha_1}\ln|x - \alpha_2|$ $\! \ln|x - \alpha_1|$
$\! \ln|x - \alpha_2|$
$\! \alpha_1 = \frac{-p - \sqrt{p^2 - 4q}}{2}$
$\alpha_2 = \frac{-p + \sqrt{p^2 - 4q}}{2}$
zero denominator has repeated root $\sigma$
factors as
$\! (x - \sigma)^2$
$A\ln|x - \sigma| - \frac{A\sigma + B}{x - \sigma}$ $\! \ln|x - \sigma|$
$\! \frac{1}{x - \sigma}$
$\! \sigma = -p/2$
negative denominator is of the form
$\! (x - \beta)^2 + \gamma^2$
with $\gamma > 0$
$\frac{A}{2}\ln((x - \beta)^2 + \gamma^2) + \frac{A\beta + B}{\gamma} \arctan\left(\frac{x - \beta}{\gamma}\right)$ $\! \ln((x - \beta)^2 + \gamma^2)$
$\arctan\left(\frac{x - \beta}{\gamma}\right)$
$\! \beta = \frac{-p}{2}$
$\gamma = \sqrt{q - (p^2/4)}$

### Case that the denominator has distinct linear factors

UPSHOT: The antiderivative in this case is expressible as a linear combination with constant coefficients of the natural logarithms of the absolute values of the linear factors.
This falls under the general case of integration of rational function whose denominator has distinct linear factors

The integration formula is:

$\! \int \frac{Ax + B}{(x - \alpha_1)(x - \alpha_2)} \, dx= \frac{A\alpha_1 + B}{\alpha_1 - \alpha_2} \ln|x - \alpha_1| + \frac{A\alpha_2 + B}{\alpha_2 - \alpha_1}\ln|x - \alpha_2| + C$

Note that $\alpha_1$ and $\alpha_2$ can be determined from the quadratic formula for the roots of a quadratic polynomial. Specifically, if the polynomial in the denominator is $x^2 + px + q$, we have:

$\alpha_1 = \frac{-p - \sqrt{p^2 - 4q}}{2}, \qquad \alpha_2 = \frac{-p + \sqrt{p^2 - 4q}}{2}$

Here are the details of how the formula is obtained:

### Case that the denominator has repeated linear factors

UPSHOT: The antiderivative in this case is a constant divided by the linear factor plus a constant times the natural logarithm of the linear factor.

The integration formula is:

$\int \frac{Ax + B}{(x - \sigma)^2} \, dx = A\ln|x - \sigma| - \frac{A\sigma + B}{x - \sigma} + C$

If the denominator is of the form $x^2 + px + q$, then this case arises iff $p^2 = 4q$ and we have $\sigma = -p/2$.

### Case that the denominator has negative discriminant

UPSHOT: The antiderivative in this case is a constant times an arc tangent function plus a constant times the natural logarithm of the absolute value of the quadratic.

We have:

$\int \frac{Ax + B}{(x - \beta)^2 + \gamma^2} \, dx = \frac{A}{2}\ln((x - \beta)^2 + \gamma^2) + \frac{A\beta + B}{\gamma} \arctan\left(\frac{x - \beta}{\gamma}\right) + C$

Given a denominator in the form $x^2 + px + q$, it can be rewritten as $(x - \beta)^2 + \gamma^2$ where:

$\beta = \frac{-p}{2}, \qquad \gamma = \sqrt{q - (p^2/4)}$

## Definite integration

We discuss here only the reduced case that we deal with for the indefinite integration.

### Case that the denominator has distinct linear factors

Using the same notation as for the indefinite integration, we have an integration of the form:

$\! \frac{(Ax + B) \, dx}{(x - \alpha_1)(x - \alpha_2)}$

The antiderivative is:

$\frac{A\alpha_1 + B}{\alpha_1 - \alpha_2} \ln|x - \alpha_1| + \frac{A\alpha_2 + B}{\alpha_2 - \alpha_1}\ln|x - \alpha_2| + C$

where, if the quadratic in the denominator originally is $x^2 + px + q$:

$\alpha_1 = \frac{-p - \sqrt{p^2 - 4q}}{2}, \qquad \alpha_2 = \frac{-p + \sqrt{p^2 - 4q}}{2}$

The integrand is not defined at the points $\alpha_1, \alpha_2$. In fact, the domain of the function is a union of three separate open intervals: $(-\infty,\alpha_1)$, $(\alpha_1,\alpha_2)$, and $(\alpha_2,\infty)$.

A generic antiderivative for the function across all the intervals may have different values for the constant $C$ on each interval.

Moreover, we can drop the absolute value signs and be specific about the inputs to the $\ln$s within each interval:

Interval Antiderivative on the interval
$(-\infty,\alpha_1)$ $\frac{A\alpha_1 + B}{\alpha_1 - \alpha_2} \ln(\alpha_1 - x) + \frac{A\alpha_2 + B}{\alpha_2 - \alpha_1}\ln(\alpha_2 - x) + C$
$\! (\alpha_1,\alpha_2)$ $\frac{A\alpha_1 + B}{\alpha_1 - \alpha_2} \ln(x - \alpha_1) + \frac{A\alpha_2 + B}{\alpha_2 - \alpha_1}\ln(\alpha_2 - x) + C$
$(\alpha_2,\infty)$ $\frac{A\alpha_1 + B}{\alpha_1 - \alpha_2} \ln(x - \alpha_1) + \frac{A\alpha_2 + B}{\alpha_2 - \alpha_1}\ln(x - \alpha_2) + C$

The integral can be computed to give a finite numerical value on any interval properly contained completely within one of these intervals. We now address the question of whether we can compute improper integrals, i.e., integrals where one of the limits is one of the values $-\infty,\alpha_1,\alpha_2,\infty$.

• An improper integral extending to $\alpha_1$ will be finite only if $A\alpha_1 + B = 0$. Note that if that were the case, the rational function would not have been in a reduced form, i.e., there would have been a common factor between the numerator and denominator. In fact, in this case, the original rational function would have a removable discontinuity at $\alpha_1$.
• An improper integral extending to $\alpha_2$ will be finite only if $A\alpha_2 + B = 0$. Note that if that were the case, the rational function would not have been in a reduced form, i.e., there would have been a common factor between the numerator and denominator. In fact, in this case, the original rational function would have a removable discontinuity at $\alpha_1$.
• An improper integral extending to $-\infty$ will be finite only if $A = 0$, so the numerator is constant. This agrees with the degree difference test. For the antiderivative given above, the limiting value at $-\infty$ is 0.
• An improper integral extending to $+\infty$ will be finite only if $A = 0$, so the numerator is constant. This agrees with the degree difference test. For the antiderivative given above, the limiting value at $+\infty$ is 0.

### Case that the denominator has repeated linear factors

Using the same notation as for the indefinite integration, we are trying to do the integration:

$\! \int \frac{Ax + B \, dx}{(x - \sigma)^2}$

The antiderivative is:

$\! A \ln|x - \sigma| - \frac{A\sigma + B}{x - \sigma} + C$

where $C$ is an arbitrary constant. Further, if the denominator was originally $x^2 + px + q$, then $\sigma = -p/2$ and $p^2 = 4q$.

The domain of the integrand is all real numbers except $\sigma$. Thus, it is a union of the open intervals $(-\infty,\sigma)$ and $(\sigma,\infty)$. On each of the intervals, we can determine unambiguously the sign of $x - \sigma$, so we can write the antiderivative more unambiguously:

Interval Antiderivative on the interval
$\! (-\infty,\sigma)$ $\! A \ln(\sigma - x) - \frac{A\sigma + B}{x - \sigma} + C$
$\! (\sigma,\infty)$ $\! A \ln(x - \sigma) - \frac{A\sigma + B}{x - \sigma} + C$

Thus, for any interval properly contained completely within one of the two pieces, we can compute the definite integral using the above. We now consider the question of improper integrals, i.e., integrals where one of the endpoints of integration is among $-\infty, \sigma, \infty$:

• $\sigma$ is not permissible as an endpoint in any circumstance, i.e., any improper integral ending at $\sigma$ will be infinite.
• $-\infty$ as an endpoint gives a finite integral iff $A = 0$. This agrees with the degree difference test. The limit of the antiderivative above at $-\infty$ is 0.
• $+\infty$ as an endpoint gives a finite integral iff $A = 0$. This agrees with the degree difference test. The limit of the antiderivative above at $+\infty$ is 0.

### Case that the denominator has negative discriminant

We are trying to do the integration:

$\int \frac{Ax + B}{(x - \beta)^2 + \gamma^2} \, dx$

The antiderivative is:

$\! \frac{A}{2}\ln((x - \beta)^2 + \gamma^2) + \frac{A\beta + B}{\gamma} \arctan\left(\frac{x - \beta}{\gamma}\right) + C$

Given a denominator in the form $x^2 + px + q$, it can be rewritten as $(x - \beta)^2 + \gamma^2$ where:

$\beta = \frac{-p}{2}, \qquad \gamma = \sqrt{q - (p^2/4)}$

The integrand, and also its antiderivative, are defined for all real numbers. In particular, it makes sense to take the definite integral over any finite interval and get a finite answer. We now consider the improper integrals:

• $-\infty$ is permissible as an endpoint for integration iff $A = 0$. This agrees with the degree difference test. In that case, the limit of the antiderivative above is $-B\pi/(2\gamma)$.
• $+\infty$ is permissible as an endpoint for integration iff $A = 0$. This agrees with the degree difference test. In that case, the limit of the antiderivative above is $B\pi/(2\gamma)$.

In particular, if $A = 0$, we can integrate the function over the entire real line and get a finite answer. That answer is $B\pi/\gamma$.

## Examples

### Reduced case examples

Consider the integration problem:

$\int \frac{x \, dx}{x^2 + x + 1}$

Here's how we would do it directly in terms of the formula: [SHOW MORE] Alternatively, instead of directly using the formula, we can retrace the steps of its derivation to obtain the antiderivative: [SHOW MORE]

## Partial fractions and linear algebra interpretation

### Reduced form case

Fill this in later -- something goes in here about the choice of basis functions for partial functions, corresponding antiderivatives, dealing with two-dimensional vector space in all three cases, but the choice of basis functions we use differs in the different cases.

### General case

Fill this in later -- something about the answer being a polynomial + something for the reduced form case.

## Repeated antidifferentiation

The strategies used above can be applied to calculate higher antiderivatives of rational functions with quadratic denominator. The key idea, which is used to prove the more general observation that rational functions can be repeatedly integrated within elementarily expressible functions, is the following corollary of integration by parts, obtained by taking 1 as the part to integrate in the left side outer integration:

$\int \left(\int f(x) \, dx\right) 1 \, dx = x \int f(x) \, dx - \int xf(x) \, dx$

The key thing to note here is that since $f$ has a quadratic denominator, so does $xf(x)$. In particular:

Integrating $f$ twice $\equiv$ Integrating both $f$ and $xf(x)$, both of which are rational functions with quadratic denominator.

Similarly,

Integrating $f$ $k$ times $\equiv$ Integrating the rational functions $f(x), xf(x), \dots x^{k-1}f(x)$

In particular, what this means is that the generic expression for the $k^{th}$ antiderivative is a polynomial plus a linear combination of the two antiderivative basis functions that depend only on the denominator.

## Variational analysis

Consider an integration of the form:

$\int_v^w \frac{(Ax + B) \, dx}{x^2 + px + q}$

where $v$ and $w$ are fixed real numbers independent of $x$. Now, suppose we choose to vary one of the four numbers $A,B,p,q$ keeping the others fixed. Then, the value of the resulting definite integral becomes a function of the one variable that we are changing.