Limits in LaTeX (lim)

\lim_{x \to a} writes a limit; in a display formula the part after _ is set below "lim". \to draws the arrow and \infty the infinity sign.

Preamble

The snippets on this page need these lines before \begin{document}:

\usepackage{amsmath}

Limit of a function or sequence

Put the whole condition in braces after _. \lim prints the letters upright and adds the correct space to what follows.

\[
  \lim_{x \to \infty} \frac{1}{x} = 0
  \qquad
  \lim_{h \to 0} \frac{f(x+h) - f(x)}{h}
\]
Change the formula

The preview is drawn in your browser by KaTeX, which knows the common math commands. The editor compiles the formula with pdfTeX.

lim⁡x→∞1x=0lim⁡h→0f(x+h)−f(x)h\lim_{x \to \infty} \frac{1}{x} = 0 \qquad \lim_{h \to 0} \frac{f(x+h) - f(x)}{h}

Open this formula in the editor

One-sided limits

A raised plus or minus marks the side: 0^+ or 0^-. Some books use the arrows \downarrow and \uparrow or \searrow and \nearrow instead.

\[
  \lim_{x \to 0^+} \frac{1}{x} = \infty
  \qquad
  \lim_{x \to 0^-} \frac{1}{x} = -\infty
  \qquad
  \lim_{x \downarrow 0} \ln x = -\infty
\]
Change the formula

The preview is drawn in your browser by KaTeX, which knows the common math commands. The editor compiles the formula with pdfTeX.

lim⁡x→0+1x=∞lim⁡x→0−1x=−∞lim⁡x↓0ln⁡x=−∞\lim_{x \to 0^+} \frac{1}{x} = \infty \qquad \lim_{x \to 0^-} \frac{1}{x} = -\infty \qquad \lim_{x \downarrow 0} \ln x = -\infty

Open this formula in the editor

Limits in a line of text

In a line of text the condition moves to the right of "lim". \lim\limits_{...} puts it below again; the line then needs more height.

Beside: $\lim_{n \to \infty} a_n$,
below: $\lim\limits_{n \to \infty} a_n$.
Result
The compiled example

Open in the editor

limsup, liminf, max, min, sup and inf

\limsup, \liminf, \max, \min, \sup and \inf take a condition in the same way. amsmath adds \varlimsup and \varliminf, which print "lim" with a line above or below.

\[
  \limsup_{n \to \infty} a_n
  \qquad
  \varliminf_{n \to \infty} a_n
  \qquad
  \max_{x \in M} f(x)
  \qquad
  \sup_{x > 0} g(x)
\]
Change the formula

The preview is drawn in your browser by KaTeX, which knows the common math commands. The editor compiles the formula with pdfTeX.

lim sup⁡n→∞anlim‾⁡n→∞anmax⁡x∈Mf(x)sup⁡x>0g(x)\limsup_{n \to \infty} a_n \qquad \varliminf_{n \to \infty} a_n \qquad \max_{x \in M} f(x) \qquad \sup_{x > 0} g(x)

Open this formula in the editor

Arrow with a condition on top

\xrightarrow{...} from amsmath draws an arrow that is as long as the text above it. An optional argument in square brackets goes below the arrow.

\[
  a_n \xrightarrow{n \to \infty} a
\]
Change the formula

The preview is drawn in your browser by KaTeX, which knows the common math commands. The editor compiles the formula with pdfTeX.

an→n→∞aa_n \xrightarrow{n \to \infty} a

Open this formula in the editor

Pitfalls

Compiled with pdfLaTeX from TeX Live 2023.

Related pages