Sums, Integrals and Limits in LaTeX: \sum, \int, \lim and \partial

Quick answer

  • Summation: $\sum_{i=1}^{n} a_i$; the subscript is the lower bound, the superscript the upper. Use \sum, not \Sigma.
  • Integral: $\int_a^b f(x)\,dx$; double, triple and contour: \iint, \iiint (amsmath), \oint.
  • Limit: $\lim_{x \to \infty} f(x)$.
  • Product: $\prod_{k=1}^{n} k$.
  • Bounds above and below in inline text: $\sum\limits_{i=1}^{n}$ or $\displaystyle\sum_{i=1}^{n}$; \nolimits does the opposite in display math.

The integral sign is \int, the sum symbol Σ is \sum, a limit is \lim, and the partial symbol ∂ is \partial. Bounds and indices go in subscripts and superscripts: $\int_a^b f(x)\,dx$, $\sum_{i=1}^{n} a_i$, $\lim_{x \to 0} f(x)$. This guide explains sigma notation and the \sum family, single and multiple integrals, limits, where the bounds go (\limits, \nolimits, \displaystyle), partial derivatives and the nabla operator, upright differentials, series, the big-operator family, and the usual mistakes.

You wantWrite
Sum from 1 to n$\sum_{i=1}^{n} a_i$
Definite integral$\int_a^b f(x)\,\mathrm{d}x$
Limit$\lim_{x \to \infty} f(x)$
Partial derivative$\frac{\partial f}{\partial x}$
Product$\prod_{k=1}^{n} k$
Double integral$\iint_D f\,\mathrm{d}A$
Bounds above/below inline$\sum\limits_{i=1}^{n}$

Summation in LaTeX (\sum)

The capital Greek letter sigma, Σ, stands for “sum”. In sigma notation the small expression under the symbol names an index variable and its starting value, the expression above gives the final value, and the expression to the right is added up once for every value of the index. Whether you call it the sum symbol, a summation or sigma notation, the LaTeX is the same. So \sum_{i=1}^{5} i^2 means 1² + 2² + 3² + 4² + 5² = 55. In LaTeX the operator is \sum; the lower bound is a subscript and the upper bound a superscript:

% Sigma notation: index i runs from 1 to n
$\sum_{i=1}^{n} a_i$

% Expanded
\[
  \sum_{i=1}^{n} x_i = x_1 + x_2 + \cdots + x_n
\]

% Closed forms
\[
  \sum_{i=1}^{n} i = \frac{n(n+1)}{2}
  \qquad
  \sum_{k=0}^{\infty} \frac{1}{2^k} = 2
\]

% Bounds can be conditions or sets rather than numbers
\[
  \sum_{i \in S} x_i \qquad
  \sum_{n \geq 1} \frac{1}{n^2} \qquad
  \sum_{1 \le i < j \le n} a_i a_j \qquad
  \sum_{i} a_i \qquad \sum a_i
\]

% Mean and variance in sigma notation
\[
  \bar{x} = \frac{1}{n}\sum_{i=1}^{n} x_i
  \qquad
  \sigma^2 = \frac{1}{n}\sum_{i=1}^{n}(x_i - \bar{x})^2
\]

Use \sum, not \Sigma. \Sigma is the ordinary Greek letter (used for a covariance matrix or an alphabet) and is set at text height with its scripts beside it; \sum is a big operator that grows in display math and stacks its bounds. The lowercase \sigma is a different symbol again (standard deviation). The sigma symbol post on our blog covers its meanings and how to type Σ outside LaTeX, and the summation symbol page has the copy-paste variants.

Inline sums: \limits and \displaystyle

In inline mode LaTeX places the bounds to the right of the sigma to keep the line height compact. In display mode (between \[ and \] or inside equation), limits appear above and below by default. Two commands override this:

Inline: $\sum_{i=1}^{n} x_i$ puts the bounds to the side.

Stacked bounds inline: $\sum\limits_{i=1}^{n} x_i$

Full display size inline: $\displaystyle\sum_{i=1}^{n} x_i$

Display:
\[
  \sum_{i=1}^{n} x_i          % bounds above and below
  \qquad
  \sum\nolimits_{i=1}^{n} x_i % bounds to the side
  \qquad
  \textstyle\sum_{i=1}^{n} x_i % whole thing at inline size
\]

Double sums and conditions with \substack

% Double summation
\[
  \sum_{i=1}^{m} \sum_{j=1}^{n} a_{ij}
  \qquad
  \sum_{i,j} a_{ij}
\]

% Several lines of conditions under one sigma (amsmath)
\[
  \sum_{\substack{i=1 \\ i \neq j}}^{n} a_i
  \qquad
  \sum_{\substack{0 \le i \le m \\ 0 < j < n}} P(i,j)
  \qquad
  \sum_{\substack{p \text{ prime} \\ p \le x}} \frac{1}{p}
\]

Products, coproducts, unions and intersections

Every big operator works exactly like \sum: \prod is the product Π, \coprod the coproduct, \bigcup and \bigcap the union and intersection of a family of sets.

\[
  \prod_{i=1}^{n} a_i
  \qquad
  n! = \prod_{k=1}^{n} k
  \qquad
  \coprod_{i \in I} X_i
\]
\[
  \bigcup_{i=1}^{n} A_i
  \qquad
  \bigcap_{i=1}^{n} A_i
  \qquad
  \bigsqcup_{i} X_i
  \qquad
  \bigoplus_{k} V_k
\]

% Infinite product
\[
  \prod_{n=1}^{\infty} \left(1 - \frac{x^2}{n^2 \pi^2}\right) = \frac{\sin x}{x}
\]

Your own operators with \mathop and \DeclareMathOperator*

\mathop turns any symbol or word into an operator that takes limits, and amsmath's \DeclareMathOperator* (note the star) does the same with an upright name defined once in the preamble:

\usepackage{amsmath}
\DeclareMathOperator*{\argmin}{arg\,min}   % preamble

\[
  \argmin_{x} f(x)
  \qquad
  \operatorname*{argmax}_{x} f(x)          % one-off version
  \qquad
  \mathop{\mathrm{E}}_{x \sim p}[f(x)]
  \qquad
  \mathop{\sum\sum}_{i,j} a_{ij}          % one shared subscript under two sigmas
\]

Basic Integrals

The \int command produces the integral sign. You can add lower and upper bounds with subscript and superscript syntax to create definite integrals, or omit them for indefinite integrals.

% Indefinite integral
$\int f(x) \, dx$

% Definite integral from a to b
$\int_a^b f(x) \, dx$

% Display-style definite integral
\[
  \int_0^\infty e^{-x} \, dx = 1
\]

% Definite integral with evaluated bounds
\[
  \int_0^1 x^2 \, dx = \left[ \frac{x^3}{3} \right]_0^1 = \frac{1}{3}
\]

% The thin space before dx, with and without
$\int f(x)\,dx$   % correct
$\int f(x)dx$      % too tight: f(x) runs into dx

The thin space \, before dx is a standard convention that improves readability. Unlike \sum, an integral keeps its bounds beside the sign even in display mode; \int\limits stacks them, as shown below.

Multiple Integrals: \iint, \iiint, \oint, \idotsint

The amsmath package provides commands for double, triple, and contour integrals with correctly tightened spacing between the signs. These are essential for multivariable calculus, physics, and engineering.

\usepackage{amsmath}

% Double integral
\[
  \iint_D f(x,y) \, \mathrm{d}A
\]

% Triple integral
\[
  \iiint_V f(x,y,z) \, \mathrm{d}V
\]

% Contour integral (closed path)
\[
  \oint_C \mathbf{F} \cdot \mathrm{d}\mathbf{r}
\]

% n-fold integral with dots
\[
  \idotsint_{\Omega} f \, \mathrm{d}x_1 \cdots \mathrm{d}x_n
\]

% Separate bounds on each sign: two \int with a negative space between
\[
  \int_{0}^{1}\!\!\int_{0}^{1} f(x,y) \, \mathrm{d}x \, \mathrm{d}y
  \qquad
  \int_0^\infty \int_0^\infty e^{-(x^2+y^2)} \, \mathrm{d}x \, \mathrm{d}y = \frac{\pi}{4}
\]

% Bounds under the sign with \limits
\[
  \int\limits_0^1 f(x) \, \mathrm{d}x
  \qquad
  \iint\limits_D f \, \mathrm{d}A
\]
CommandOutputDescription
\intSingle integral signStandard integral
\iintDouble integral signDouble integral (amsmath)
\iiintTriple integral signTriple integral (amsmath)
\iiiintQuadruple integral signFour-fold integral (amsmath)
\ointContour integral signClosed path / contour integral
\oiintClosed surface integral signClosed surface integral (esint)
\idotsintIntegral with dotsn-fold integral (amsmath)
\int\limitsBounds above and belowWorks on every integral sign

Upright Differentials: \mathrm{d}x and \,

The “d” in dx is an operator, not a variable, and ISO 80000-2 asks for it to be upright: \mathrm{d}x. Many mathematics journals are happy with italic dx. Whichever you choose, put a thin space \, between the integrand and the differential, and define a macro so the choice is made once:

% Italic d (traditional) vs upright d (ISO)
\[
  \int f(x) \, dx
  \qquad
  \int f(x) \, \mathrm{d}x
  \qquad
  \frac{dy}{dx}
  \qquad
  \frac{\mathrm{d}y}{\mathrm{d}x}
\]

% Define it once
\newcommand{\dd}{\mathrm{d}}
\[
  \int_0^1 f(x) \, \dd x
  \qquad
  \frac{\dd y}{\dd x}
  \qquad
  \frac{\dd^2 y}{\dd x^2}
  \qquad
  \dd s^2 = \dd x^2 + \dd y^2
\]

The physics package defines its own \dd, which inserts the thin space for you (\dd{x}, \dd[3]{x} for d³x), plus \dv and \pdv for derivatives. Two caveats: your own \newcommand{\dd} will clash with it, and physics redefines some common commands (\div becomes divergence, and it conflicts with siunitx's \qty). The newer derivative package offers \odv, \pdv and \odif without those side effects.

Partial Derivatives and the ∂ Symbol

The partial symbol ∂ is \partial. A partial derivative is a fraction with \partial in both parts; the order goes on the top \partial and on the variable below, and mixed partials list the variables with a thin space:

% First and second partial derivatives
\[
  \frac{\partial f}{\partial x}
  \qquad
  \frac{\partial^2 f}{\partial x^2}
  \qquad
  \frac{\partial^{n} f}{\partial x^{n}}
\]

% Mixed partials
\[
  \frac{\partial^2 f}{\partial x\, \partial y}
  \qquad
  \frac{\partial^3 f}{\partial x\, \partial y\, \partial z}
\]

% Operator form, subscript shorthand, evaluation at a point
\[
  \frac{\partial}{\partial t} u(x,t)
  \qquad
  \partial_x f \qquad f_x \qquad f_{xy}
  \qquad
  \left.\frac{\partial f}{\partial x}\right|_{x=0}
  \qquad
  \left(\frac{\partial f}{\partial x}\right)_{y}   % thermodynamics: y held fixed
\]

% The boundary of a region also uses \partial
\[
  \oint_{\partial \Omega} \mathbf{F} \cdot \mathrm{d}\mathbf{r}
\]

Nabla: gradient, divergence, curl and Laplacian

The nabla operator ∇ is \nabla. Gradient, divergence and curl are written with \nabla and the vector products, or with upright operator names:

\[
  \nabla f = \left( \frac{\partial f}{\partial x},
                     \frac{\partial f}{\partial y},
                     \frac{\partial f}{\partial z} \right)
  \qquad \text{gradient}
\]
\[
  \nabla \cdot \mathbf{F} \quad \text{divergence}
  \qquad
  \nabla \times \mathbf{F} \quad \text{curl}
  \qquad
  \nabla^2 f = \Delta f \quad \text{Laplacian}
\]

% Named operators (upright)
\[
  \operatorname{grad} f \qquad
  \operatorname{div} \mathbf{F} \qquad
  \operatorname{curl} \mathbf{F}
\]

% Bold or arrowed nabla when vectors are bold
$\boldsymbol{\nabla} f$ (amsmath) \quad $\vec{\nabla} f$

The physics package shortcuts

\usepackage{physics}

\[
  \dv{f}{x} \qquad \dv[2]{f}{x}         % ordinary derivatives
  \qquad
  \pdv{f}{x} \qquad \pdv[2]{f}{x} \qquad \pdv{f}{x}{y}   % partial, second, mixed
  \qquad
  \grad f \qquad \div \vb{F} \qquad \curl \vb{F} \qquad \laplacian f
\]

Limits

The \lim command typesets the "lim" operator in upright Roman text with the subscript expression placed below (in display mode) or beside (inline).

% Basic limit
$\lim_{x \to a} f(x)$

% Limit at infinity
\[
  \lim_{x \to \infty} \frac{1}{x} = 0
\]

% One-sided limits
\[
  \lim_{x \to 0^+} \frac{1}{x} = +\infty
  \qquad
  \lim_{x \to 0^-} \frac{1}{x} = -\infty
\]

% Limit superior and limit inferior
\[
  \limsup_{n \to \infty} a_n
  \qquad
  \liminf_{n \to \infty} a_n
\]

% Limit definition of derivative
\[
  f'(x) = \lim_{h \to 0} \frac{f(x+h) - f(x)}{h}
\]

% Limit definition of e
\[
  e = \lim_{n \to \infty} \left(1 + \frac{1}{n}\right)^n
\]

Controlling Limits Placement

By default, LaTeX places limits above/below big operators in display mode and to the side in inline mode. You can override this behaviour with \limits,\nolimits, and \displaystyle.

% Force limits above/below in inline mode
$\sum\limits_{i=1}^{n} a_i$

% Force limits to the side in display mode
\[
  \sum\nolimits_{i=1}^{n} a_i
\]

% Use displaystyle in inline math
$\displaystyle \sum_{i=1}^{n} a_i$

% Force limits on an integral (above/below)
\[
  \int\limits_0^1 f(x) \, dx
\]

% Comparison of placements
\[
  \sum_{i=1}^{n}          \quad \text{(default display)}
  \qquad
  \sum\nolimits_{i=1}^{n} \quad \text{(nolimits)}
\]

% textstyle forces inline behaviour in display
\[
  \textstyle \sum_{i=1}^{n} a_i
  \quad \text{vs} \quad
  \displaystyle \sum_{i=1}^{n} a_i
\]

Use \limits sparingly in inline math because it increases the line height and can disrupt vertical spacing. When you need full-size operators inside a paragraph, prefer \displaystyle instead. To make every integral in the document stack its bounds, load amsmath with the intlimits option; the nosumlimits option does the reverse for sums.

Series and Sequences

Many important formulas combine sums with limits. Here are common examples including Taylor series and Fourier series.

% Infinite series (combining sum and limit)
\[
  \sum_{n=0}^{\infty} a_n = \lim_{N \to \infty} \sum_{n=0}^{N} a_n
\]

% Taylor series expansion of e^x
\[
  e^x = \sum_{n=0}^{\infty} \frac{x^n}{n!}
      = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \cdots
\]

% Maclaurin series for sin(x)
\[
  \sin x = \sum_{n=0}^{\infty} \frac{(-1)^n}{(2n+1)!} x^{2n+1}
\]

% Fourier series
\[
  f(x) = \frac{a_0}{2} + \sum_{n=1}^{\infty}
    \left( a_n \cos\frac{n\pi x}{L} + b_n \sin\frac{n\pi x}{L} \right)
\]

% Fourier coefficients
\[
  a_n = \frac{1}{L} \int_{-L}^{L} f(x) \cos\frac{n\pi x}{L} \, dx
  \qquad
  b_n = \frac{1}{L} \int_{-L}^{L} f(x) \sin\frac{n\pi x}{L} \, dx
\]

% Geometric series
\[
  \sum_{n=0}^{\infty} r^n = \frac{1}{1-r}, \quad |r| < 1
\]

Big Operators Reference

LaTeX provides a full family of "big operators" that behave like \sum with respect to limits placement. Here is a reference table:

CommandDescriptionTypical Use
\sumSummation ΣDiscrete sums, sigma notation
\prodProduct ΠFinite / infinite products
\coprodCoproductCategory theory
\int, \iint, \ointIntegralsBounds beside the sign unless \limits
\bigcupBig unionSet theory unions
\bigcapBig intersectionSet theory intersections
\bigoplusBig direct sumLinear algebra, module theory
\bigotimesBig tensor productTensor algebra
\bigveeBig logical ORLogic, lattice theory
\bigwedgeBig logical ANDLogic, lattice theory
\bigsqcupBig square unionDisjoint unions
\biguplusBig multiset unionMultiset operations
\lim, \max, \min, \sup, \infNamed operators that take limitsAnalysis
\mathop{...}Make anything a limit-taking operatorCustom operators
% Examples of big operators with bounds
\[
  \bigcup_{i=1}^{n} A_i
  \qquad
  \bigcap_{i=1}^{n} A_i
  \qquad
  \bigoplus_{k=1}^{n} V_k
  \qquad
  \bigotimes_{k=1}^{n} W_k
\]

Practical Examples

Below are complete, real-world formulas that combine integrals, sums, and limits.

Fundamental Theorem of Calculus

% Evaluation form
\[
  \int_a^b f'(x) \, dx = f(b) - f(a)
\]

% Derivative of an integral with a variable upper bound
\[
  \frac{d}{dx} \int_a^x f(t) \, dt = f(x)
\]

Gaussian Integral

\[
  \int_{-\infty}^{\infty} e^{-x^2} \, dx = \sqrt{\pi}
\]

Euler's Identity Derivation

% Start from the Taylor series of e^{ix}
\[
  e^{ix} = \sum_{n=0}^{\infty} \frac{(ix)^n}{n!}
         = \underbrace{\sum_{k=0}^{\infty} \frac{(-1)^k x^{2k}}{(2k)!}}_{\cos x}
         + i\underbrace{\sum_{k=0}^{\infty} \frac{(-1)^k x^{2k+1}}{(2k+1)!}}_{\sin x}
\]

% Setting x = pi gives Euler's identity
\[
  e^{i\pi} + 1 = 0
\]

Taylor Expansion of ln(1+x)

\[
  \ln(1+x) = \sum_{n=1}^{\infty} \frac{(-1)^{n+1}}{n} x^n
            = x - \frac{x^2}{2} + \frac{x^3}{3} - \cdots,
  \quad |x| \leq 1
\]

Riemann Sum

% Definition of the Riemann integral as a limit of sums
\[
  \int_a^b f(x) \, dx
  = \lim_{n \to \infty} \sum_{i=1}^{n} f(x_i^*) \, \Delta x
\]

% Where
\[
  \Delta x = \frac{b - a}{n},
  \qquad
  x_i^* \in [x_{i-1}, x_i]
\]

Heat Equation

\[
  \frac{\partial u}{\partial t} = \alpha \nabla^2 u
  = \alpha \left( \frac{\partial^2 u}{\partial x^2}
                  + \frac{\partial^2 u}{\partial y^2} \right)
\]

Laplace Transform

\[
  \mathcal{L}\{f(t)\} = \int_0^{\infty} e^{-st} f(t) \, dt
\]

Residue Theorem

\[
  \oint_C f(z) \, dz = 2\pi i \sum_{k=1}^{n} \operatorname{Res}(f, z_k)
\]

Common Errors

Here are frequent errors when typesetting integrals, sums, and limits in LaTeX, along with corrected versions.

% WRONG: Missing thin space before dx
$\int f(x)dx$
% CORRECT: Add \, before dx
$\int f(x) \, dx$

% WRONG: Using \limits in inline mode (disrupts line spacing)
The sum $\sum\limits_{i=1}^{n} a_i$ is too tall.
% BETTER: Let LaTeX handle inline placement naturally
The sum $\sum_{i=1}^{n} a_i$ fits the line.

% WRONG: Bare subscript on lim (no \to)
$\lim_{x a} f(x)$
% CORRECT: Use \to for the arrow
$\lim_{x \to a} f(x)$

% WRONG: Using \Sigma instead of \sum for summation
$\Sigma_{i=1}^{n}$
% CORRECT: \sum is a big operator with proper limits
$\sum_{i=1}^{n}$

% WRONG: Forgetting braces around multi-character bounds
$\int_0^10$
% CORRECT: Wrap multi-character exponents in braces
$\int_0^{10}$

% WRONG: Missing \left and \right for tall delimiters
$[\frac{x^2}{2}]_0^1$
% CORRECT: Auto-sizing delimiters
$\left[\frac{x^2}{2}\right]_0^1$

% WRONG: the letter d as a partial
$\frac{d f}{d x}$ for a function of two variables
% CORRECT
$\frac{\partial f}{\partial x}$

% WRONG: two conditions with \\ outside \substack
$\sum_{i=1 \\ i \ne j}$     % no error, but the line breaks inside the formula
% CORRECT
$\sum_{\substack{i=1 \\ i \ne j}}$
MessageCauseFix
Undefined control sequence \iint / \substack / \idotsintamsmath not loaded\usepackage{amsmath}
Undefined control sequence \dv / \pdv / \oiintphysics (for \dv, \pdv) or esint (for \oiint) not loaded\usepackage{physics} or \usepackage{esint}
Command \dd already definedYour \newcommand clashes with physicsDrop one of them, or use \renewcommand
Missing $ inserted\sum, \int or \partial used in textWrap in $...$ or \[...\]
Double superscript / Double subscriptTwo bounds on one side, e.g. \sum_i_j\sum_{i,j} or \substack
Can be used only in preamble\DeclareMathOperator inside the documentMove it before \begin{document}, or use \operatorname* inline

Frequently Asked Questions

How do I write a summation (the sum symbol Σ) in LaTeX?

Use \sum in math mode, with the index and bounds as subscript and superscript: $\sum_{i=1}^{n} a_i$. Do not use \Sigma, which is the plain Greek capital letter and does not take limits above and below.

How do I put the limits above and below the sum in inline text?

Inline math sets the bounds beside the Σ to keep the line compact. Write $\sum\limits_{i=1}^{n} a_i$ to force them above and below, or $\displaystyle\sum_{i=1}^{n} a_i$ for a full-size operator. In display math (\[...\]) the bounds are stacked by default.

How do I write a partial derivative in LaTeX?

The partial symbol ∂ is \partial. A first partial derivative is \frac{\partial f}{\partial x}, a second is \frac{\partial^2 f}{\partial x^2}, and a mixed one is \frac{\partial^2 f}{\partial x\, \partial y}. The physics package shortens this to \pdv{f}{x}.

How do I write an integral with bounds in LaTeX?

Write $\int_a^b f(x)\,\mathrm{d}x$. The subscript is the lower bound, the superscript the upper, and \, puts a thin space before dx. \iint and \iiint from amsmath give double and triple integrals, \oint a contour integral.

Should dx be upright or italic?

Both are common. ISO 80000-2 asks for an upright d, written \mathrm{d}x; most mathematics journals accept italic dx. Define \newcommand{\dd}{\mathrm{d}} once and use \dd x everywhere so the choice is easy to change.

How do I write a limit in LaTeX?

Use \lim with the condition in a subscript: $\lim_{x \to 0} f(x)$. \to gives the arrow. In display math the subscript sits below “lim”; inline it goes to the side unless you add \limits.

Next Steps

Free LaTeX Tools

Write LaTeX math faster with AI

Octree's AI-powered editor helps you write integrals, sums, and complex mathematical notation without memorising every command.

Try Octree Free →