acalculator

What are the asymptotes of f(x)?

Type a rational function, a polynomial over a polynomial. The page finds its vertical asymptotes, its horizontal or slant asymptote, and any holes.

Your numbers

Vertical asymptotes x =
-2

The vertical asymptotes of (x^2 - 4x + 1)/(x + 2) are x = -2.

Horizontal or slant asymptote y =
x - 6 (slant)
Holes at x =
none

Vertical asymptotes x =: -2. The vertical asymptotes of (x^2 - 4x + 1)/(x + 2) are x = -2.

How to calculate

Finds the asymptotes and holes of a rational function.

Example with the default inputs (Function f(x) (x^2 - 4x + 1)/(x + 2)): The vertical asymptotes of (x^2 - 4x + 1)/(x + 2) are x = -2.

Method: Vertical: zeros of the denominator where f grows without bound.

  • Zeros searched for in ±10^6.

Machine-readable copies: Markdown, JSON.

Worked examples

Each example is checked against the calculator on every build.

  1. Function f(x) (x^2 - 4x + 1)/(x + 2) gives Vertical asymptotes x = -2, Horizontal or slant asymptote y = x - 6 (slant), Holes at x = none.Source: OpenStax (Abramson, 2021), College Algebra 2e, section 5.6 Rational Functions, Example 7(b)
  2. Function f(x) (x - 2)/(x^2 - 4) gives Vertical asymptotes x = -2, Horizontal or slant asymptote y = 0 (horizontal), Holes at x = 2.Source: OpenStax (Abramson, 2021), College Algebra 2e, section 5.6 Rational Functions, Example 6

How it works

For a rational function f (a polynomial over a polynomial):

  1. f is written as one fraction P/Q (terms over a common bottom, without cancelling anything). Q is the denominator.
  2. Zeros of Q: the real zeros of Q between −∞ and ∞, found by a computer algebra system (nerdamer, open source) and on a grid, as described below. The algebra runs in the background after you start typing.
  3. Vertical asymptote or hole: for each zero c of Q, with h = 10⁻⁶ × max(1, |c|): if |f(c + h)| is over 10 |f(c + 100h)|, f grows towards c and x = c is a vertical asymptote; otherwise c is a hole (the zero cancels).
  4. Horizontal or slant asymptote: the algebra writes f as partial fractions (checked numerically at 20 points). Its polynomial part S is the sum of the terms that have no x in a denominator (0 when there are none). S must pass a check: at x = 10⁴ and 10⁶ and at x = −10⁴ and −10⁶, |f(x) − S(x)| at ±10⁶ must be at most 10⁻³ and no larger than at ±10⁴. If it does not pass (the algebra did not cancel a common factor), the same is tried on f factored first. With k = the whole number nearest log10(|S(10⁷)/S(10⁶)|): k ≥ 2 gives none (f grows like a polynomial of degree k); k = 1 gives y = S (slant); otherwise (k = 0, or S = 0) y = S (horizontal).

The page shows Vertical asymptotes x = (in increasing order, separated by commas, or none), Horizontal or slant asymptote y = (S written by the page, followed by (horizontal) or (slant), or none) and Holes at x = (or none).

How the points are found

The zeros and breaks of a function g (a zero: g passes through or touches 0; a break: g jumps, goes to ±∞, or stops being a real number) are found between two ends −∞ and ∞ (for g = Q) (each end clipped to ±10⁶) in two ways at once.

By the algebra. The computer algebra system solves g(x) = 0. A solution is an exact candidate when it is a number strictly between the ends, is not a rounded number (a whole number past 2⁵³; a fraction p/q, p and q being the numbers that multiply its top and its bottom, such as 288557167/(342919925e), when q after removing its factors 2 and 5 is over 1,000,000, or is over 1 while |p| times it is over 10¹²; or a decimal with more than 12 significant digits), and g is 0 there up to rounding: |g(c)| is at most 10⁻¹² times the sum of the sizes of the terms of g at c (the parts of g joined by + and −). So x² + 10⁻²⁰ has no zero at 0, though the algebra gives one.

On a grid. g is worked out at 8,001 points x₀ to x₈₀₀₀, evenly spaced in asinh x (so they reach ±10⁶ when an end is infinite and bunch up near 0): xᵢ = sinh(u₀ + (u₁ − u₀)(i + 0.3183)/8001), with u₀ = asinh(−10⁶) and u₁ = asinh(10⁶). For each step from xᵢ to xᵢ₊₁:

  • If g is a number at one end of the step and not a number at the other (as ln or √ of a negative number is not), the point where it stops being one is found by halving the step 80 times: a break. A value past the largest computer number, about 1.8 × 10³⁰⁸, still counts as a number with its sign (x e^(−x) and its derivatives for x below about −703), so an overflow is not a break. But when |g| is over 10³⁰⁰ at the end where g is a number (e^x − e^(2x) near x = 355, where e^(2x) overflows and the difference is not a number), the page cannot tell an overflow from the end of the domain and gives no answer (a value is too large).
  • If g has opposite signs at the two ends, the sign change is found by halving 80 times. It is a zero if |g| there is at most 10⁻⁶ of the larger of |g(xᵢ)| and |g(xᵢ₊₁)|, and a break otherwise (g jumps or goes through ±∞). If g is past the largest computer number at either end, the page gives no answer (a value is too large).
  • If g has one sign at xᵢ, xᵢ₊₁ and xᵢ₊₂ and turns at xᵢ₊₁ (a peak or a dip), the turning point r is found by halving (on the sign of g(x + h) − g(x − h), h = 10⁻⁷ × max(1, |x|)). If g(r) has the other sign, g dips through 0 and back between xᵢ and xᵢ₊₂: two zeros too close together for the grid. Unless the algebra gives at least two exact candidates strictly between xᵢ and xᵢ₊₂ (then they are the zeros), the page gives no answer (two points are too close together). If |g(r)| is at most 10⁻⁹ of the larger of |g(xᵢ)| and |g(xᵢ₊₂)|, g touches 0 there: that is a zero when an exact candidate lies within 10⁻⁶ × max(1, |candidate|) of r, and otherwise the page says a zero could not be confirmed and gives no answer. If |g(r)| is over 10⁶ times that size (or not a number), g peaks through ±∞: a break. A reason to give no answer that turns up on the way (a dip, a touch the algebra does not confirm) is given only after the whole grid, so a function with more than 30 points (sin x) gets "too many points to check".

A zero found on the grid within 10⁻⁶ × max(1, |c|) of an exact candidate c takes its exact value and text; otherwise, when it is within 10⁻⁹ × max(1, |x|) of a fraction p/q with q = 1, 2, 3, 4, 6, 8 or 12 (the first that fits) where g is 0 up to rounding (the rule above), it is shown as p/q; otherwise as ≈ and a decimal to 10 significant figures (rounded half up). A break is shown exactly as p/q when x is within 10⁻⁹ × max(1, |x|) of p/q for q = 1, 2, 3, 4, 6, 8 or 12 (the first that fits) and g is not a real number at p/q or at p/q ± 10⁻⁹ × max(1, |x|) (a pole, a jump, or an end of the domain); otherwise as ≈ and a decimal. An exact candidate that the grid did not find (two zeros inside one step) is added. A zero right next to a pole, inside the same grid step, is found only when the algebra gives it. The same point found twice counts once (a zero before a break). Two different points within 10⁻⁶ × max(1, |x|) of each other give no answer (two points are too close together), and so do two exact candidates that close: x²(x − 10⁻⁷)² has critical numbers at 0, 5 × 10⁻⁸ and 10⁻⁷, which the page does not merge into one. More than 30 points gives no answer (too many points to check).

What you can type

  • A number has at most 15 digits in a row. A computer number keeps only about 16 digits, so a longer one (9007199254740993) would stand for a nearby number (9007199254740992), and the page asks for fewer digits instead. Write very large or very small numbers with a power of ten (1e-20).
  • A polynomial or a polynomial divided by a polynomial in x: numbers (with decimals), x, + − * /, brackets, and ^ with a whole-number power (x^-2 is allowed). pi and e may appear in coefficients. A number or bracket next to x multiplies: 2x^2, (x − 1)(x + 2).
  • Any function (sqrt, ln, sin, …) or a power that is not a whole number gives a message: this page is for rational functions.

What gets no answer

  • A polynomial part S that fails its check both ways.
  • More than 30 zeros of the denominator, or a turn that touches 0 without the algebra confirming it.
  • A step that fails its check, finds no formula, or takes over 3 seconds.

Worked examples by hand

(x² − 4x + 1)/(x + 2) (OpenStax College Algebra 2e, section 5.6, Example 7(b)). The denominator is 0 at x = −2, where the top is 4 + 8 + 1 = 13 ≠ 0: a vertical asymptote. Dividing, (x² − 4x + 1)/(x + 2) = x − 6 + 13/(x + 2), so the slant asymptote is y = x − 6. There are no holes.

(x − 2)/(x² − 4) (OpenStax College Algebra 2e, section 5.6, Example 6). x² − 4 = (x − 2)(x + 2) is 0 at x = −2 and x = 2. The factor x − 2 cancels: (x − 2)/(x² − 4) = 1/(x + 2) for x ≠ 2. So x = −2 is a vertical asymptote, x = 2 is a hole, and since the top has lower degree, the horizontal asymptote is y = 0.

Other questions people ask

What is an asymptote?

A line the graph approaches. A vertical asymptote x = c is where f(x) goes to ±∞ as x approaches c. A horizontal asymptote y = L is a value f(x) approaches as x → ±∞. A slant (oblique) asymptote y = mx + b is a line that f(x) − (mx + b) approaches 0 along.

How do I find vertical asymptotes?

Write f as one fraction and find the real zeros of the denominator. A zero that does not cancel with the numerator is a vertical asymptote; one that cancels completely is a hole. For (x − 2)/(x² − 4) = (x − 2)/((x − 2)(x + 2)), x = −2 is a vertical asymptote and x = 2 is a hole.

How do I find a horizontal asymptote?

Compare degrees. If the top has lower degree than the bottom, y = 0. If the degrees are equal, y = (leading coefficient of the top)/(leading coefficient of the bottom). If the top is one degree higher, there is a slant asymptote instead; two or more degrees higher, neither.

How do I find a slant asymptote?

Divide the top by the bottom. The quotient, a line mx + b, is the slant asymptote, and the remainder over the bottom goes to 0. (x² − 4x + 1)/(x + 2) = x − 6 + 13/(x + 2), so the slant asymptote is y = x − 6.

What is a hole?

A point where f is undefined but its graph is otherwise unbroken, because the factor that makes the bottom 0 cancels with the top. (x² − 1)/(x − 1) equals x + 1 everywhere except x = 1, where it is undefined: a hole at x = 1, and no vertical asymptote.

How is the answer checked?

The zeros of the denominator are found both by a computer algebra system and by a sign scan on a fine grid, so none is missed. The horizontal or slant asymptote comes from partial fractions, checked numerically, and f(x) minus it must shrink towards 0 at x = ±10⁴ and ±10⁶.