Limit in LaTeX

Write \lim followed by the condition as a subscript: \lim_{x \to a} f(x). \to draws the arrow. In a displayed equation the condition sits under “lim”; inside a line of text it moves to the side unless you add \limits.

Limit commands

  • \lim_{x \to a} f(x)
    lim x → a f ( x )

    Limit as x approaches a.

  • \lim_{x \to \infty} f(x)
    lim x → ∞ f ( x )

    Limit at infinity.

  • \lim_{x \to a^{+}} f(x)
    lim x → a + f ( x )

    Right-hand limit.

  • \lim_{x \to a^{-}} f(x)
    lim x → a − f ( x )

    Left-hand limit.

  • \lim_{n \to \infty} a_n
    lim n → ∞ a n

    Limit of a sequence.

  • \limsup_{n \to \infty} a_n
    lim sup n → ∞ a n

    Limit superior (amsmath).

  • \liminf_{n \to \infty} a_n
    lim inf n → ∞ a n

    Limit inferior (amsmath).

  • \lim\limits_{x \to 0}
    lim x → 0

    Keeps the condition under lim inside running text.

  • x \searrow 0
    x ↘ 0

    Decreasing approach, used by some authors instead of 0⁺.

Try it live

Change the formula and the preview redraws as you type. Copy the LaTeX, download a PNG or SVG, copy it for Word, or use Edit here on any example below to load it.

Templates

Limit examples

Each result below is drawn from the LaTeX under it. Copy the code, edit it on this page, or open it in the full editor.

  • Classic limit

    lim x → 0 sin ⁡ x x = 1
    LaTeX
    \lim_{x \to 0} \frac{\sin x}{x} = 1
  • Definition of e

    lim n → ∞ ( 1 + 1 n ) n = e
    LaTeX
    \lim_{n \to \infty} \left(1 + \frac{1}{n}\right)^{n} = e
  • One-sided limits

    lim x → 0 + 1 x = ∞ , lim x → 0 − 1 x = − ∞
    LaTeX
    \lim_{x \to 0^{+}} \frac{1}{x} = \infty, \quad \lim_{x \to 0^{-}} \frac{1}{x} = -\infty
  • Derivative as a limit

    f ′ ( x ) = lim h → 0 f ( x + h ) − f ( x ) h
    LaTeX
    f'(x) = \lim_{h \to 0} \frac{f(x+h) - f(x)}{h}
  • Limit superior

    lim sup n → ∞ sin ⁡ n = 1
    LaTeX
    \limsup_{n \to \infty} \sin n = 1
  • Two-variable limit

    lim ( x , y ) → ( 0 , 0 ) x y x 2 + y 2 = 0
    LaTeX
    \lim_{(x, y) \to (0, 0)} \frac{x y}{\sqrt{x^2 + y^2}} = 0
  • Limit in running text

    lim x → ∞ 1 x = 0
    LaTeX
    \textstyle \lim\limits_{x \to \infty} \frac{1}{x} = 0

    With \limits the condition stays under “lim” even at text size.

How to write a limit step by step

Use \lim, not the letters lim. The command sets “lim” upright, spaces it as an operator and knows where the subscript belongs; typed letters come out as italic variables l·i·m.

Put the whole condition in braces after _: \lim_{x \to 0}. \to and \rightarrow draw the same arrow; \to is shorter and the usual choice. For one-sided limits add ^{+} or ^{-} to the value: x \to 0^{+}.

Displayed equations put the condition under “lim”. Inline, LaTeX moves it to the right to keep the line height; \lim\limits_{…} overrides that for one limit.

LaTeX
\[
  \lim_{x \to 0} \frac{\sin x}{x} = 1
\]
In text: $\lim\limits_{n \to \infty} \frac{1}{n} = 0$.

Your own limit-like operators

For names amsmath does not define, such as ess sup or arg max, declare an operator with limits: \DeclareMathOperator*{\esssup}{ess\,sup} in the preamble, or \operatorname*{arg\,max}_{x} in place. The star is what puts the subscript underneath in displays.

Common mistakes

  • Without the backslash “lim” is three italic variables and the subscript attaches only to the m.

    Instead of
    lim_{x \to 0} f(x)
    Write
    \lim_{x \to 0} f(x)
  • Only x is in the subscript; the arrow and 0 end up on the main line.

    Instead of
    \lim_x \to 0 f(x)
    Write
    \lim_{x \to 0} f(x)
  • -> is set as a minus sign and a greater-than sign, not an arrow.

    Instead of
    \lim_{x -> 0}
    Write
    \lim_{x \to 0}

In Overleaf, MathJax and Word

  • Overleaf and pdfLaTeX

    \lim works in any document. \limsup, \liminf, \operatorname* and \DeclareMathOperator* need \usepackage{amsmath}.

  • MathJax and KaTeX

    MathJax and KaTeX render \lim, \limsup, \liminf, \limits and \operatorname* without setup. Inline math in Markdown ($…$) puts the condition to the side, just as LaTeX does.

  • Microsoft Word

    Word has a “lim” template under Function, but pasted LaTeX is not converted reliably. Write the limit here and use Copy for Word to paste an editable Word equation.

Limit in LaTeX: questions

How do I put x → 0 under lim?
Write it as a subscript: \lim_{x \to 0}. It appears underneath in displayed equations; for inline math add \limits: \lim\limits_{x \to 0}.
How do I write a limit approaching infinity?
Use \infty: \lim_{x \to \infty} f(x). For negative infinity write x \to -\infty.
How do I write a one-sided limit?
Add a plus or minus superscript to the value: \lim_{x \to a^{+}} for the right-hand limit and \lim_{x \to a^{-}} for the left-hand one.
Is \to the same as \rightarrow?
Yes, both draw →. \to is the conventional choice in limits because it is short and says what it means.

Have the formula as a picture?

Paste a screenshot or photo of the equation and get its LaTeX, ready to copy or open in the editor.

Convert an image to LaTeX