# Rational Functions: Asymptotes, Holes, Derivatives and Integrals

> Rational functions P(x)/Q(x): domain, vertical and horizontal asymptotes, holes, derivatives with the quotient rule and integrals by partial fractions.

Source: https://practicecalculus.com/functions/rational-functions
Updated: 2026-11-03

$$ f(x) = \frac{P(x)}{Q(x)}, \quad Q(x) \ne 0 $$

## At a glance

- **Domain:** All $x$ with $Q(x) \ne 0$
- **Derivative:** $\frac{P'(x)Q(x) - P(x)Q'(x)}{Q(x)^2}$
- **Integral:** $\int \frac{A}{x - r}\,dx = A\ln|x - r| + C$
- **Vertical asymptotes:** Zeros of $Q$ that do not cancel
- **Horizontal asymptote:** Compare the degrees of $P$ and $Q$
- **Integration method:** Long division, then partial fractions

## Key takeaways

- A rational function is a ratio of two polynomials, defined wherever the denominator is not zero.
- A zero of the denominator gives a vertical asymptote, or a hole if the factor cancels with the numerator.
- Differentiate with the quotient rule; integrate with long division and partial fractions.
- The degrees of the numerator and denominator decide the horizontal or slant asymptote.

A **rational function** is one polynomial divided by another. They are defined everywhere except where the denominator is zero, and the behavior near those points, asymptotes and holes, is what makes them central to limits, curve sketching and integration.

## Definition and formula

$$f(x) = \frac{P(x)}{Q(x)}, \qquad Q(x) \ne 0$$

$P$ and $Q$ are [polynomials](/functions/polynomial-functions) and $Q$ is not the zero polynomial. The simplest example is the [reciprocal function](/functions/reciprocal-function) $\frac{1}{x}$. Others include $\frac{2x + 1}{x - 1}$ and $\frac{x^2 - 4}{x - 2}$.

## Graph of a rational function

```graph
title: 'Graph of the rational function y = (2x + 1)/(x - 1) with its asymptotes'
caption: 'The vertical asymptote is $x = 1$ and the horizontal asymptote is $y = 2$, the ratio of the leading coefficients.'
x: [-6, 8]
y: [-8, 12]
functions:
  - expr: (2x + 1)/(x - 1)
    label: y = (2x + 1)/(x - 1)
  - expr: '2'
    label: y = 2 (horizontal asymptote)
    dashed: true
vertical:
  - {x: 1, label: 'x = 1'}
```

## Asymptotes and holes

Factor $P$ and $Q$ completely first.

- **Hole.** A factor $(x - a)$ that cancels from top and bottom leaves a removable discontinuity at $x = a$. Example: $\frac{x^2 - 4}{x - 2} = x + 2$ for $x \ne 2$, a line with a hole at $(2, 4)$.
- **Vertical asymptote.** A zero $a$ of the denominator that remains after cancelling. Near $x = a$ the function heads to $\pm\infty$, so the [one-sided limits](/blog/what-is-a-limit) are infinite.
- **Horizontal asymptote.** From [limits at infinity](/blog/limits-at-infinity), with $\deg P = m$ and $\deg Q = n$:

| Degrees | Behavior as $x \to \pm\infty$ |
| --- | --- |
| $m < n$ | asymptote $y = 0$ |
| $m = n$ | asymptote $y = \frac{\text{leading coeff of } P}{\text{leading coeff of } Q}$ |
| $m = n + 1$ | slant asymptote from long division |
| $m > n + 1$ | no line asymptote |

## Derivative of a rational function

Use the [quotient rule](/rules/quotient-rule):

$$\frac{d}{dx}\,\frac{P(x)}{Q(x)} = \frac{P'(x)Q(x) - P(x)Q'(x)}{Q(x)^2}$$

The derivative is again a rational function with the same points excluded from its domain.

## Integrating rational functions

There is no single formula. The standard method is:

1. If $\deg P \ge \deg Q$, divide to get a polynomial plus a proper fraction.
2. Factor $Q$ and split the proper fraction with [partial fractions](/blog/partial-fractions).
3. Integrate each piece. Linear factors give logarithms, $\int \frac{A}{x - r}\,dx = A\ln|x - r| + C$; irreducible quadratics give arctangents.

## Worked examples

**Example 1: asymptotes.** For $f(x) = \frac{2x + 1}{x - 1}$, nothing cancels, so $x = 1$ is a vertical asymptote. Degrees are equal, so $y = \frac{2}{1} = 2$ is the horizontal asymptote.

**Example 2: derivative.** With $P = 2x + 1$ and $Q = x - 1$:

$$f'(x) = \frac{2(x - 1) - (2x + 1)(1)}{(x - 1)^2} = \frac{-3}{(x - 1)^2}$$

The derivative is always negative, so $f$ decreases on each side of the asymptote.

**Example 3: a limit with a hole.** $\lim_{x \to 2} \frac{x^2 - 4}{x - 2} = \lim_{x \to 2} (x + 2) = 4$.

**Example 4: integral by partial fractions.** Since $\frac{1}{x^2 - 1} = \frac{1/2}{x - 1} - \frac{1/2}{x + 1}$,

$$\int \frac{1}{x^2 - 1}\,dx = \frac{1}{2}\ln\left|\frac{x - 1}{x + 1}\right| + C$$

## Common mistakes

1. **Declaring every denominator zero an asymptote.** Cancel common factors first; cancelled factors give holes.
2. **Cancelling terms instead of factors.** $\frac{x + 4}{x + 2} \ne \frac{4}{2}$. Only common factors cancel.
3. **Mixing up the quotient rule order.** The numerator is $P'Q - PQ'$; reversing it flips the sign.
4. **Using partial fractions on an improper fraction.** Divide first when $\deg P \ge \deg Q$.

## How it connects

Rational functions are the standard source of $\frac{0}{0}$ limits, the test case for [L'Hôpital's rule](/blog/lhopitals-rule), and the main application of partial fractions in Calculus 2. Their sketches use every tool from [curve sketching](/blog/curve-sketching-with-derivatives).

## Frequently asked questions

### How do you find the vertical asymptotes of a rational function?

Factor and cancel any common factors, then set the remaining denominator equal to zero. Each zero that is left gives a vertical asymptote; a factor that cancelled gives a hole instead.

### How do you find the horizontal asymptote of a rational function?

Compare degrees. If the denominator has higher degree, the asymptote is $y = 0$. If the degrees are equal, it is the ratio of leading coefficients. If the numerator has higher degree, there is no horizontal asymptote.

### How do you differentiate a rational function?

Use the quotient rule: $\left(\frac{P}{Q}\right)' = \frac{P'Q - PQ'}{Q^2}$. For a simple denominator it can be quicker to rewrite with a negative exponent and use the chain rule.

### How do you integrate a rational function?

If the numerator degree is at least the denominator degree, do polynomial long division first. Then split the proper fraction with partial fractions, which integrate to logarithms, powers and arctangents.
