Rational Functions Explorer

f(x) = k(x − z)/(x − p): drag the zero and the pole on the graph, or set z, p and k. Every intercept and asymptote is worked out underneath.

Vertical asymptotes Q(a)=0, P(a)≠0 ⇒ x=aQ(a)=0,\ P(a)\ne0\ \Rightarrow\ x=a
Holes (x−a)P1(x)(x−a)Q1(x), Q1(a)≠0 ⇒ (a, P1(a)Q1(a))\frac{(x-a)P_{1}(x)}{(x-a)Q_{1}(x)},\ Q_{1}(a)\ne0\ \Rightarrow\ \left(a,\ \tfrac{P_{1}(a)}{Q_{1}(a)}\right)
Horizontal asymptote deg⁡P<deg⁡Q: y=0deg⁡P=deg⁡Q: y=anbn\begin{aligned}&\deg P<\deg Q:\ y=0\\&\deg P=\deg Q:\ y=\frac{a_{n}}{b_{n}}\end{aligned}
Oblique asymptote deg⁡P=deg⁡Q+1: PQ=mx+c+RQy=mx+c\begin{aligned}&\deg P=\deg Q+1:\ \frac{P}{Q}=mx+c+\frac{R}{Q}\\&y=mx+c\end{aligned}
This page’s family k x−zx−p=k+k(p−z)x−pk\,\frac{x-z}{x-p}=k+\frac{k(p-z)}{x-p}
Loading interactive simulation...

Lesson

The theory — Rational Functions Explorer

A rational function is a quotient P(x)/Q(x) of two polynomials. It is undefined where Q(x) = 0.

Where the formula comes from

  1. Factorise and cancel. A factor common to top and bottom cancels. Where it was zero and what is left of the denominator is not, the graph has a hole: the simplified function has a value there, the original has none.
    x2−4x2−x−2=(x−2)(x+2)(x−2)(x+1)=x+2x+1,  x≠2\begin{aligned}\frac{x^{2}-4}{x^{2}-x-2}&=\frac{(x-2)(x+2)}{(x-2)(x+1)}\\&=\frac{x+2}{x+1},\ \ x\ne2\end{aligned}
  2. Vertical asymptotes are the zeros of the denominator that survive the cancelling. Near one the function grows without bound, with a sign that depends on the side.
    x+1=0 ⇒ x=−1f(−1.01)=−99,f(−0.99)=101\begin{aligned}&x+1=0\ \Rightarrow\ x=-1\\&f(-1.01)=-99,\qquad f(-0.99)=101\end{aligned}
  3. Intercepts. The zeros of the cancelled numerator, at points where the original denominator is not zero, are the x-intercepts; f(0) is the y-intercept.
    x+2=0 ⇒ x=−2;f(0)=21=2x+2=0\ \Rightarrow\ x=-2;\qquad f(0)=\frac{2}{1}=2
  4. Far out, compare degrees. Dividing top and bottom by the highest power of x shows the limit: 0 when the bottom has the higher degree, the ratio of leading coefficients when the degrees are equal.
    x+2x+1=1+2x1+1x→1(x→±∞)\frac{x+2}{x+1}=\frac{1+\frac{2}{x}}{1+\frac{1}{x}}\to1\quad(x\to\pm\infty)
  5. One degree more on top gives a slant. Divide, and the quotient is the line the curve approaches; the remainder over Q tends to 0.
    x2+3x+1x+1=x+2−1x+1 → y=x+2\frac{x^{2}+3x+1}{x+1}=x+2-\frac{1}{x+1}\ \to\ y=x+2

Put the zero on top of the pole and the blow-up vanishes

Drag the zero until it sits exactly on the pole and something odd happens: the curve stops exploding and flattens into a horizontal line. With z = p the factor (x − z) cancels the denominator outright, leaving the constant k everywhere — except at x = p, where the original formula still divides by zero. So the graph is a straight line with one point punched out of it, and this tool switches from reporting an asymptote to reporting a hole at (p, k). A denominator root is a pole only if the numerator does not cancel it; otherwise it is a removable hole, invisible at any zoom level.

A pole is only infinite by choice

Written as (ax+b)/(cx+d), any one-zero one-pole function is a Möbius transformation — the maps that rule complex analysis and hyperbolic geometry. Add a single point at infinity (the Riemann sphere) and the pole stops being a catastrophe: x=p simply maps to that new point, and x=∞ maps to the horizontal asymptote y=k. On the sphere the function is a smooth, reversible bijection — the "explosion" is just an artifact of the flat map.

RATIONAL FUNCTIONS — WHERE DOES THE GRAPH BLOW UP, AND WHERE DOES IT SETTLE?

Which Rational-Function Case Are You In?

f(x) = k(x − z)/(x − p) has only three numbers in it, and each one owns a feature of the graph. The zero z is where the curve crosses the axis. The pole p is where the denominator vanishes and the curve runs off to infinity. The gain k is where it settles far from both. Read those three off the formula and you have sketched the graph before plotting a single point.

Well separated — one vertical asymptote, one horizontal, one crossing x = p, y = k
Pole and zero close together — a violent spike between them |z − p| → 0 ⇒ |f| → ∞
Negative gain — the same skeleton with the branches swapped k < 0 ⇒ f → −f
Pole and zero almost on top of each other — nearly a hole (z − p)/(z − p) = 1, z ≠ p

01

Well separated — one vertical asymptote, one horizontal, one crossing

What you know: A pole and a zero at a comfortable distance. The vertical asymptote stands at x = p, the horizontal one at y = k, and the curve crosses the axis at x = z.

Feature: x = p, y = k

Worked example: f(x) = (x − 1)/(x + 2): asymptote at x = −2, crossing at x = 1, and f → 1 far out in both directions. At x = 0 the value is −0.5.

Open this case: basic
Well separated — one vertical asymptote, one horizontal, one crossing. The pole and the gain draw the two asymptotes; the zero fixes where the curve crosses. A pole and a zero at a comfortable distance. The vertical asymptote stands at x = p, the horizontal one at y = k, and the curve crosses the axis at x = z.
The pole and the gain draw the two asymptotes; the zero fixes where the curve crosses.

02

Pole and zero close together — a violent spike between them

What you know: The same shape, but the pole sits near the zero. The curve has to get from the axis to infinity across a short distance, so it climbs steeply.

Feature: |z − p| → 0 ⇒ |f| → ∞

Worked example: f(x) = 1.4(x − 0.5)/(x − 0.2): the pole at 0.2 is only 0.3 from the zero at 0.5, and f(0) is already 3.5 against a far-field value of 1.4

Open this case: steep pole
Pole and zero close together — a violent spike between them. A short gap between pole and zero forces the curve through a narrow, steep excursion. The same shape, but the pole sits near the zero. The curve has to get from the axis to infinity across a short distance, so it climbs steeply.
A short gap between pole and zero forces the curve through a narrow, steep excursion.

03

Negative gain — the same skeleton with the branches swapped

What you know: A negative k flips the whole curve about the horizontal axis. The asymptote positions do not move; the branches change which corner they occupy.

Feature: k < 0 ⇒ f → −f

Worked example: f(x) = −(x + 1.5)/(x − 1.2): asymptote at x = 1.2, crossing at x = −1.5, horizontal asymptote at y = −1, and f(0) = 1.25

Open this case: negative gain
Negative gain — the same skeleton with the branches swapped. The asymptotes are where they were, but each branch has moved to the opposite side. A negative k flips the whole curve about the horizontal axis. The asymptote positions do not move; the branches change which corner they occupy.
The asymptotes are where they were, but each branch has moved to the opposite side.

04

Pole and zero almost on top of each other — nearly a hole

What you know: When z and p are very close, the factors almost divide out. Away from that neighbourhood the function is close to the constant k, and the pole survives as a needle-thin spike.

Feature: (z − p)/(z − p) = 1, z ≠ p

Worked example: f(x) = (x − 1)/(x − 1.12): only 0.12 apart, so f(0) = 0.893, close to the far-field value of 1 — yet the asymptote at x = 1.12 is still there

Open this case: near cancel
Pole and zero almost on top of each other — nearly a hole. Almost a constant everywhere, except for the narrow window where the pole still wins. When z and p are very close, the factors almost divide out. Away from that neighbourhood the function is close to the constant k, and the pole survives as a needle-thin spike.
Almost a constant everywhere, except for the narrow window where the pole still wins.

Problems solved in full

  1. Intercepts and asymptotes 5 steps

    For f(x) = 2(x − 3)/(x + 1), find the intercepts and the asymptotes, and say which corners the branches occupy.

    Open this problem in the tool

    1. Zero: the numerator is 0 at x = 3, where the denominator is not.

      2(x−3)=0 ⇒ x=32(x-3)=0\ \Rightarrow\ x=3
    2. Vertical asymptote: the denominator is 0 at x = −1.

      x+1=0 ⇒ x=−1x+1=0\ \Rightarrow\ x=-1
    3. Horizontal asymptote: divide top and bottom by x.

      2(x−3)x+1=2−6x1+1x→2(x→±∞)\frac{2(x-3)}{x+1}=\frac{2-\frac{6}{x}}{1+\frac{1}{x}}\to2\quad(x\to\pm\infty)
    4. y-intercept: put x = 0.

      f(0)=2(0−3)0+1=−6f(0)=\frac{2(0-3)}{0+1}=-6
    5. Split it to see the branches: the part over x + 1 is negative to the right of −1, so the right branch lies below y = 2 and the left branch above it.

      2(x−3)x+1=2(x+1)−8x+1=2−8x+1\frac{2(x-3)}{x+1}=\frac{2(x+1)-8}{x+1}=2-\frac{8}{x+1}

    Answer

    Zero x = 3, y-intercept −6, asymptotes x = −1 and y = 2; f(x) = 2 − 8/(x + 1), branches top left and bottom right.

    f(x)=2−8x+1:x=3,  y=−6,  x=−1,  y=2f(x)=2-\frac{8}{x+1}:\quad x=3,\ \ y=-6,\ \ x=-1,\ \ y=2
  2. A hole 3 steps

    f(x) = (x² − 4)/(x² − x − 2). Find any holes, the asymptotes and the intercepts.

    Show solution
    1. Factorise both. x − 2 is common.

      f(x)=(x−2)(x+2)(x−2)(x+1)f(x)=\frac{(x-2)(x+2)}{(x-2)(x+1)}
    2. Cancel it. The original is undefined at x = 2; the simplified form gives the height of the hole.

      =x+2x+1,  x≠2;2+22+1=43=\frac{x+2}{x+1},\ \ x\ne2;\qquad\frac{2+2}{2+1}=\frac43
    3. What is left: the vertical asymptote from x + 1, the zero from x + 2, equal degrees for the horizontal asymptote.

      x+1=0⇒x=−1;x+2=0⇒x=−2y→11=1;f(0)=−4−2=2\begin{aligned}&x+1=0\Rightarrow x=-1;\qquad x+2=0\Rightarrow x=-2\\&y\to\frac11=1;\qquad f(0)=\frac{-4}{-2}=2\end{aligned}

    Answer

    Hole at (2, 4/3); asymptotes x = −1 and y = 1; zero x = −2; y-intercept 2.

    (2,43);x=−1, y=1;x=−2;f(0)=2\left(2,\tfrac43\right);\quad x=-1,\ y=1;\quad x=-2;\quad f(0)=2
  3. Horizontal asymptotes by degree 3 steps

    Find the horizontal asymptote, if any, of (a) (3x + 1)/(x² + 1), (b) (6x² − x)/(2x² + 5), (c) x³/(x² + 1).

    Show solution
    1. (a) The bottom has the higher degree.

      3x+1x2+1=3x+1x21+1x2→0\frac{3x+1}{x^{2}+1}=\frac{\frac{3}{x}+\frac{1}{x^{2}}}{1+\frac{1}{x^{2}}}\to0
    2. (b) Equal degrees: the ratio of the leading coefficients.

      6x2−x2x2+5=6−1x2+5x2→62=3\frac{6x^{2}-x}{2x^{2}+5}=\frac{6-\frac1x}{2+\frac{5}{x^{2}}}\to\frac62=3
    3. (c) The top has the higher degree, by one, so there is no horizontal asymptote; division gives a slant one.

      x3x2+1=x−xx2+1\frac{x^{3}}{x^{2}+1}=x-\frac{x}{x^{2}+1}

    Answer

    (a) y = 0, (b) y = 3, (c) none: the curve approaches y = x.

    y=0;y=3;y=xy=0;\qquad y=3;\qquad y=x
  4. An oblique asymptote 3 steps

    Find the asymptotes of f(x) = (x² + 3x + 1)/(x + 1).

    Show solution
    1. The top has degree one more than the bottom. Divide.

      x2+3x+1=(x+1)(x+2)−1 ⇒ f(x)=x+2−1x+1x^{2}+3x+1=(x+1)(x+2)-1\ \Rightarrow\ f(x)=x+2-\frac{1}{x+1}
    2. The remainder term tends to 0 as x grows either way.

      1x+1→0(x→±∞)\frac{1}{x+1}\to0\quad(x\to\pm\infty)
    3. The denominator is 0 at x = −1, and the numerator is not (it is −1 there).

      x+1=0⇒x=−1,(−1)2+3(−1)+1=−1≠0x+1=0\Rightarrow x=-1,\qquad(-1)^{2}+3(-1)+1=-1\ne0

    Answer

    Vertical x = −1; oblique y = x + 2.

    x=−1;y=x+2x=-1;\qquad y=x+2
  5. Crossing the horizontal asymptote 2 steps

    Does f(x) = (x² − 2x)/(x² + 1) cross its horizontal asymptote? If so, where?

    Show solution
    1. Equal degrees, so the horizontal asymptote is y = 1.

      x2−2xx2+1→11=1\frac{x^{2}-2x}{x^{2}+1}\to\frac11=1
    2. Set f(x) = 1 and solve. The x² terms cancel and leave a linear equation.

      x2−2xx2+1=1  ⟺  x2−2x=x2+1  ⟺  x=−12\frac{x^{2}-2x}{x^{2}+1}=1\iff x^{2}-2x=x^{2}+1\iff x=-\frac12

    Answer

    Yes, once, at (−1/2, 1). A horizontal asymptote describes the far ends only.

    (−12, 1)\left(-\tfrac12,\ 1\right)
  6. A rational inequality 3 steps

    Solve (x − 3)/(x + 1) > 0.

    Open this problem in the tool

    Show solution
    1. The sign can change only at the zero, 3, and at the pole, −1. They split the line into three intervals.

      x<−1,−1<x<3,x>3x<-1,\qquad-1<x<3,\qquad x>3
    2. Test one point in each.

      f(−2)=−5−1=5>0f(0)=−31=−3<0f(4)=15>0\begin{aligned}&f(-2)=\frac{-5}{-1}=5>0\\&f(0)=\frac{-3}{1}=-3<0\\&f(4)=\frac15>0\end{aligned}
    3. x = 3 gives 0, which is not greater than 0, and x = −1 is not in the domain.

      f(3)=0≯0,x=−1∉dom⁡ff(3)=0\not>0,\qquad x=-1\notin\operatorname{dom}f

    Answer

    x < −1 or x > 3

    x<−1  ∨  x>3x<-1\ \ \lor\ \ x>3
  7. A function from its features 2 steps

    Find f(x) = k(x − z)/(x − p) with vertical asymptote x = 2, horizontal asymptote y = 3 and y-intercept −3.

    Open this problem in the tool

    Show solution
    1. The vertical asymptote gives p, and the horizontal one gives k.

      x=2⇒p=2;y=3⇒k=3x=2\Rightarrow p=2;\qquad y=3\Rightarrow k=3
    2. The y-intercept fixes z.

      f(0)=3(0−z)0−2=3z2=−3 ⇒ z=−2f(0)=\frac{3(0-z)}{0-2}=\frac{3z}{2}=-3\ \Rightarrow\ z=-2

    Answer

    f(x) = 3(x + 2)/(x − 2)

    f(x)=3(x+2)x−2f(x)=\frac{3(x+2)}{x-2}
  8. The curve reaching its horizontal asymptote at y = 1 5 steps

    f(x) = (x − 1)/(x + 2) has a horizontal asymptote at y = 1. Work out whether the curve ever actually reaches it.

    Open this problem in the tool

    Show solution
    1. The zero and the pole read straight off the factored form: the numerator vanishes at 1, the denominator at −2.

      f(x)=0  ⟺  x=1;x+2=0  ⟺  x=−2 (vertical asymptote)f(x)=0\iff x=1;\qquad x+2=0\iff x=-2\ \text{(vertical asymptote)}
    2. For large |x| both top and bottom are dominated by their x terms, so the ratio tends to the ratio of leading coefficients. That is the horizontal asymptote, and here it is 1.

      lim⁡x→±∞x−1x+2=11=1 (horizontal asymptote)\lim_{x\to\pm\infty}\frac{x-1}{x+2}=\frac{1}{1}=1\ \text{(horizontal asymptote)}
    3. Now ask the question directly instead of eyeballing the graph: set the function equal to its asymptote and solve.

    4. The x cancels and leaves −1 = 2, which is false for every x. So the curve never touches y = 1 — not far out, not anywhere.

      x−1x+2=1  ⟺  x−1=x+2  ⟺  −1=2— no solution\frac{x-1}{x+2}=1\iff x-1=x+2\iff -1=2\quad\text{— no solution}
    5. The vertical asymptote behaves oppositely. Just right of −2, at −1.99, the function is −299; just left of it, at −2.01, it is +301. It does not approach a value from both sides, it diverges in opposite directions.

      f(−1.99)=−299,f(−2.01)=+301f(-1.99)=-299,\qquad f(-2.01)=+301

    Answer

    The tool prints an x-intercept of 1, a vertical asymptote at −2 and a horizontal one at 1. The result worth keeping is that a horizontal asymptote is not a barrier — this one is never met, but that is a fact about this function and not a rule. Change the numerator to x − 1 + something that vanishes and a curve can cross its horizontal asymptote freely, even repeatedly. Vertical asymptotes are the strict ones: the function is undefined there, so it can never cross. Confusing the two is the most common mistake on this topic, and one line of algebra settles it every time.

    the curve approaches y=1 and never reaches it; the pole flips sign\text{the curve approaches}\ y=1\ \text{and never reaches it};\ \text{the pole flips sign}

Supplementary problems, answers only

  1. Find the intercepts and asymptotes of f(x) = (3x − 6)/(x + 2).

    Show answer

    x-intercept 2, y-intercept −3; asymptotes x = −2 and y = 3

    x=2,  y=−3;x=−2,  y=3x=2,\ \ y=-3;\qquad x=-2,\ \ y=3
  2. Find the hole and the asymptotes of f(x) = (x² + x − 6)/(x² − 9).

    Show answer

    Hole at (−3, 5/6); asymptotes x = 3 and y = 1

    (−3,56);x=3,  y=1\left(-3,\tfrac56\right);\qquad x=3,\ \ y=1
  3. Find the oblique asymptote of f(x) = (2x² + x − 1)/(x − 1).

    Show answer

    y = 2x + 3

    y=2x+3y=2x+3
  4. Solve (x + 2)/(x − 1) ≤ 0.

    Show answer

    −2 ≤ x < 1

    −2≤x<1-2\le x<1
  5. Find the horizontal asymptote of f(x) = (4x³ − x)/(2x³ + 7).

    Show answer

    y = 2

    y=2y=2

Learning path

Beyond the quadratic

References (2)
  • Why k(x−z)/(x−p) is a Möbius map, and why circles and lines are the only shapes it produces: T. Needham, Visual Complex Analysis, Chapter 3: Möbius Transformations and Inversion. Oxford University Press, 1997.
  • The asymptotes as ordinary behaviour at a point, once infinity is a point: L. V. Ahlfors, Complex Analysis, 3rd edition. McGraw-Hill, 1979 — rational functions on the extended plane.