acalculator

What is the limit by L'Hopital's rule?

Type the top f(x), the bottom g(x) and the point x approaches. The page says whether the form is 0/0 or ∞/∞, gives f′(x)/g′(x), and finds the limit.

Your numbers

Use x, + - * / ^, brackets, pi, e, sqrt, ln, sin, cos, tan.
Limit
-π

The limit of (sin(pi x))/(ln(x)) as x approaches 1 is -π.

As a decimal
-3.141592654
Form
0/0
f′(x)/g′(x) =
π x cos(π x)

Limit: -π. The limit of (sin(pi x))/(ln(x)) as x approaches 1 is -π.

How to calculate

Finds the limit of f(x)/g(x) at a number or infinity with L'Hopital's rule for 0/0 and ∞/∞ forms, checked numerically.

Example with the default inputs (Numerator f(x) sin(pi x), Denominator g(x) ln(x), x approaches 1): The limit of (sin(pi x))/(ln(x)) as x approaches 1 is -π.

Method: If f/g is 0/0 or ∞/∞ at a, lim f/g = lim f′/g′ (L'Hôpital's rule), applied up to 3 times.

  • The limit is two-sided at a number.
  • x in radians; ln is the natural logarithm.

Machine-readable copies: Markdown, JSON.

Worked examples

Each example is checked against the calculator on every build.

  1. Numerator f(x) sin(pi x), Denominator g(x) ln(x), x approaches 1 gives Limit -π, As a decimal -3.141593, Form 0/0.Source: OpenStax, Calculus Volume 1, section 4.8 L'Hôpital's Rule, Example 4.38(b). https://openstax.org/books/calculus-volume-1/pages/4-8-lhopitals-rule
  2. Numerator f(x) 1 - cos(x), Denominator g(x) x, x approaches 0 gives Limit 0, As a decimal 0, Form 0/0.
  3. Numerator f(x) 3x + 5, Denominator g(x) 2x + 1, x approaches inf gives Limit 3/2, As a decimal 1.5, Form ∞/∞.

How it works

The page finds the limit of f(x)/g(x) as x approaches a (a number, or ±∞), using L'Hôpital's rule for the forms 0/0 and ∞/∞:

lim f(x)/g(x) = lim f′(x)/g′(x)

It shows four things:

  • Form: 0/0, ∞/∞, or "not 0/0 or ∞/∞: the rule does not apply".
  • f′(x)/g′(x) = the quotient of the derivatives (0/0 and ∞/∞ only), simplified by the algebra when the simplified form checks, otherwise as it comes.
  • Limit: the limit written exactly.
  • As a decimal: the limit to 10 significant figures, rounded half up.

The form

The page looks at |f| and |g| at points approaching a. For a number a these are a + d·max(1, |a|) and a − d·max(1, |a|) for d = 10⁻², 10⁻⁴ and 10⁻⁶ (one set of three points per side); for ∞ they are x = 100, 10⁴ and 10⁶, and for −∞ their negatives. A side where the function is not a real number at the first point is skipped; at least one side must remain.

  • A function tends to 0 when, on each side, its size does not grow from one point to the next and the last is at most 1/100 of the first.
  • A function grows without bound when, on each side, its size grows from the first point to the second, does not fall from the second to the third (a size too large for a double counts as infinite), and the last is at least 2.5 times the first.

The form is 0/0 when f and g both tend to 0, ∞/∞ when both grow without bound, and otherwise the rule does not apply.

Poles close to a

First the page looks for places where f/g goes through ±∞ close to a: 400 points from 10⁻⁵ to 10⁻⁶ of the way to a on each side (d·max(1, |a|) from a, with d spaced evenly in log d), or x from 10⁵ to 10⁶ for ∞ (their negatives for −∞). Where f/g changes sign between two neighbouring points, the page halves that step 60 times; if |f/g| then ends over 1,000 times its larger size at the two points, f/g goes through ±∞ there, and the page gives no answer. tan(x)/x² at ∞ has such poles near every π/2 + kπ, so it has no limit, although tan(x)/x² is small at x = 10², 10³, …, 10⁶.

The limit

A computer algebra system (nerdamer, open source) works on f/g, and for 0/0 and ∞/∞ also on f′/g′, f″/g″ and f‴/g‴ (each derivative checked against a numeric difference quotient at 20 points). The algebra runs in the background after you start typing. It takes them in that order; for each:

  • when a is a number and the quotient is a real number at a, its limit is its value at a: simplified by the algebra when that stays exact, otherwise written as it is with a put in for x (sin(1)/e, which the algebra rounds to 288557167/(342919925e));
  • otherwise the algebra finds its limit at a.

The first limit L that checks is shown. The check uses f(x)/g(x) itself at the points a ± d·max(1, |a|) for d = 10⁻², 10⁻³, 10⁻⁴, 10⁻⁵, 10⁻⁶ (or x = ±10², …, ±10⁶ for ±∞), on each side where the quotient is a real number at the first point (at least one side): moving towards a, the distance |f(x)/g(x) − L| must not grow from one point to the next until it is at most 10⁻³ × max(1, |L|), which must happen by the last point. When the exact text holds a number the algebra could only give rounded (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), the page keeps looking in the later rounds for an exact form, and shows the decimal alone if none comes. Text the algebra writes with Infinity in it (1/e^Infinity) is shown as its value when that is a whole number.

The limit is two-sided: at a number, x approaches from both sides where f/g is a real number there.

What gets no answer

  • An infinite limit (eˣ/x² at ∞) or a limit that does not exist (x/x² at 0): no round gives a finite limit that checks.
  • f/g that goes through ±∞ close to a (see above).
  • A step that fails its check, finds no formula, or takes over 3 seconds.

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).
  • f and g use the variable x. Numbers can have decimals (2.5) and powers of ten (1e-3).
  • Operations: + − * / and ^ for powers. Brackets group. A number or bracket next to a letter multiplies: 2x, 3(x + 1), x sin(x).
  • Constants: pi (or π) and e.
  • Functions: sqrt, cbrt, ln (and log, the same natural logarithm), log10, exp, abs (or |x|), sin, cos, tan, sec, csc, cot, asin, acos, atan (arcsin, arccos, arctan also work), sinh, cosh, tanh and their inverses. Angles are in radians. sin x without brackets means sin(x); sin x^2 means sin(x²).
  • x approaches a number or a constant expression (0, 1, pi/2), or inf and -inf (also infinity, ∞ and oo).

Worked examples by hand

sin(πx)/ln(x) at x = 1 (OpenStax Calculus Volume 1, section 4.8, Example 4.38(b)). At 1, sin(π) = 0 and ln(1) = 0: the form is 0/0. f′/g′ = π cos(πx)/(1/x) = πx cos(πx), which is π · 1 · cos(π) = −π at 1.

(1 − cos x)/x at x = 0 (OpenStax Calculus Volume 1, section 4.8, Example 4.38(a)). Both are 0 at 0: 0/0. f′/g′ = sin(x)/1, which is 0 at 0.

(3x + 5)/(2x + 1) as x → ∞ (OpenStax Calculus Volume 1, section 4.8, Example 4.39(a)). Both grow without bound: ∞/∞. f′/g′ = 3/2, so the limit is 3/2.

Other questions people ask

What is L'Hôpital's rule?

If f(x) and g(x) both tend to 0, or both tend to ±∞, as x approaches a, then lim f(x)/g(x) = lim f′(x)/g′(x), provided the right-hand limit exists (or is infinite). It turns a limit you cannot read off into one that is often easy.

When does the rule apply?

Only to the indeterminate forms 0/0 and ∞/∞, and only when f and g are differentiable near a with g′(x) ≠ 0 there. For (x + 1)/(x + 2) at 0 the form is 1/2, not indeterminate: the limit is 1/2, while the quotient of the derivatives would wrongly give 1. The page labels the form and gives the right limit either way.

What if f′/g′ is still 0/0?

Apply the rule again: lim f/g = lim f″/g″, and so on. (1 − cos x)/x² at 0 is 0/0; so is sin(x)/(2x); and cos(x)/2 gives 1/2. The page tries up to three rounds.

How do I use it for 0 · ∞ or ∞ − ∞?

Rewrite the expression as a quotient first. x ln(x) at 0 from the right is 0 · (−∞); written as ln(x)/(1/x) it is −∞/∞, and the rule gives lim (1/x)/(−1/x²) = lim (−x) = 0. For ∞ − ∞, combine the two terms over a common denominator.

Why is there no answer for some limits?

The page shows only finite limits that it can check. An infinite limit, such as eˣ/x² at ∞, or one that does not exist, such as x/x² at 0 (−∞ on one side, ∞ on the other), gives no answer.

How is the answer checked?

Every derivative the algebra finds is checked against a numeric difference quotient, and the limit against the quotient f(x)/g(x) itself, evaluated closer and closer to a from each side. If the check fails, the page says "No verified answer".