Sum in LaTeX (Sigma symbol)


In school, we use the symbol + to denote the sum between two numbers or, more in general, between two algebraic quantities (like x + y). However, when we want to denote the sum of several elements that are indexed, we use a capital sigma letter \(\sum\) and a couple of limits that denote where the sum starts and ends.

For example, to denote the sum of the first ten numbers we can write:

\(1+2+3+\cdots+10=\displaystyle\sum_{n=1}^{10}n\)

1. How to write sum in LaTeX?

It is very easy to produce the summation symbol (capital sigma) inside LaTeX’s math mode using the command \sum. The limits of the sum are then written using the common symbols for subscripts _ and superscripts ^ (check this postOpens in a new tab.). For example, the previous equation was written with the code:

% Summation in LaTeX
\[
1+2+3+\cdots+10=\sum_{n=1}^{10}n
\]

2. Force limits to appear above and below the sum sign

When the sum is written inside the inline mathematical environment, that is, the one surrounded by dollar signs, the limits are typeset differently to respect the space that the line should take up. For example,

% limits of summation in inline math mode
$\sum_{n=1} ^{\infty} a_i x^i$

produces the output: \(\sum_{n=1} ^{\infty} a_i x^i\). To prevent this, we can use the command \displaystyle inside math mode, so that it behaves like displayed math mode. This will have the advantage of printing a more legible equation, but also the con of making a strange-looking line, with a lot of space around it.

For example, the previous sum will look like \(\displaystyle\sum_{n=1} ^{\infty} a_i x^i\) when used with \displaystyle:

% Adjusted limits of summation
$]\displaystyle\sum_{n=1} ^{\infty} a_i x^i$

The decision about which looks better is all yours; in general, the concrete equation determines if the legibility gained is worth the odd line or not.

We reached the end of this tutorial, If you have any remarks or suggestions, please feel free to reach us via email at admin@latex-tutorial.comOpens in a new tab.

Recent Posts