Contents
Introduction
In this blog post, we will learn how to write sums, products, and various types of integrals using LaTeX.
The general notation for writing sums, products, and integrals in LaTeX follows a similar structure:
\command_{optional start}^{optional end}{expression}
The LaTeX commands for sum, product and basic integral are \sum
, \prod
and \int
respectively which look like this: $\sum$, $\prod$ and $\int$.
Note that whilst $\sum$ and $\prod$ look like the Greek letters $\Sigma$ and $\Pi$ respectively, using the commands ensures that the size of the symbol adapts to fit the expression, improving readability and aesthetics. It also causes the limits to be placed above and below the symbol rather than to the right.
Compare for example:
\[\Sigma_{i=1}^{n}{x_i}\]written using \Sigma
with:
written using \sum
.
Examples
-
Sum over all values of a random variable $X$:
\[\sum_{x \in \mathcal{X}}{p(x)} = 1\]\sum_{x \in \mathcal{X}}{p(x)} = 1
-
Sum of an arithmetic series:
\[\sum_{k=1}^{n}{a_k} = \frac{n}{2}(a_1 + a_n)\]\sum_{k=1}^{n}{a_k} = \frac{n}{2}(a_1 + a_n)
-
Factorial:
\[\prod_{k=1}^{n}{k} = n!\]\prod_{k=1}^{n}{k} = n!
-
Indefinite integral:
\[\int{f(x) \, dx}\]\int{f(x) \, dx}
-
Definite integral:
\[\int_{a}^{b}{f(x) \, dx}\]\int_{a}^{b}{f(x) \, dx}
More Integrals
- Circular Integral: To represent a circular integral, we can utilize the
\oint
command. It produces a closed loop integral symbol. For instance:- Circulation of a vector field around a closed curve:
\oint_{C}{\mathbf{F} \cdot d\mathbf{r}}
- Circulation of a vector field around a closed curve:
- Multiple Integrals: LaTeX offers commands for writing multiple integrals with nested bounds. Here are examples of double and triple integrals:
- Double integral:
\iint_{D}{f(x, y) \, dA}
- Triple integral:
\iiint_{V}{\rho(x, y, z) \, dV}
- Double integral:
- Arbitrary Number of Integrals: For integrals with an arbitrary number of dimensions, LaTeX provides the
\idotsint
command. It generates a series of integral symbols with dots between them. For example:- $n$-fold integral:
\idotsint_{V}{f(x_1, x_2, \dots, x_n) \, dx_1 \, dx_2 \, \dots \, dx_n}
- $n$-fold integral:
Conclusion
To summarise, we have learned commands to write sums, products, and integrals in LaTeX. We have also seen how to write more complex integrals such as circular integrals, multiple integrals, and integrals with an arbitrary number of dimensions. These commands are widely used in mathematics and statistics, and are therefore useful to know when writing mathematical documents in LaTeX.