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.
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.
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$.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.
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.
Pitfalls
- Write
\lim, notlim. Without the backslash LaTeX sets three italic letters as a product of the variables l, i and m, and the subscript hangs on the m alone. - For an operator LaTeX does not define, such as argmax, see Define a math operator in LaTeX.
Compiled with pdfLaTeX from TeX Live 2023.
Related pages
- Package
amsmath - How-to Sums and products in LaTeX
- How-to Define a math operator in LaTeX
- How-to Inline and display math in LaTeX
- Error Limit controls must follow a math operator