# Formula for population variance, issues with placement?

From trying to construct the formula by hand, I had come up with the following:

\sigma^2 = \frac{\sum_{i=1}^{n}(x_i - \mu)^2} {n}


Now this looks fairly correct, however the _i=1 and ^n do not show above and below, rather above and right as you would expect it:

I cannot find an example or reference to find the correct one. What should be used?

-

If you want the \sum operator to have the limits i=1 and n to be displayed above/below it, you need to add a \displaystyle in front of it:

\sigma^2 = \frac{\displaystyle\sum_{i=1}^{n}(x_i - \mu)^2} {n}


-
... or \limits just after \sum, e.g., \sum\limits – Gonzalo Medina Aug 27 '11 at 23:03

The following is an excerpt from Section 2.4.4 Sums, products, unions, integrals, etc. from Mathematics into Type by Ellen Swanson:

2.4.4a Sums and products

In text, the subscripts and superscripts usually follow the symbols, while in display they are normally printed above and below.

In the past some publishers used to place subscripts and superscripts to the right of sums and products both in text and display to avoid extra typesetting costs. Aesthetically it is preferable to set them in display as shown above, and with modern computer typesetting systems it is no more expensive. In text, though, beware of expressions like

where the prime has some specific meaning, and moving the N to the side may cause confusion.

For unions and intersections, the treatment is similar to that for sums and products.

For integrals:

When a single integral is used, the subscripts and superscripts always follow the symbol. For multiple integrals used in display, the subscripts and superscripts may be centered above and below them.

In your particular case, you have three options if the formula is to appear displayed:

1. To leave the formula as it is.
2. To use \displaystyle\sum which will place the indices above and below and will also increase the size of the summation sign.
3. To use \sum\limits which will also place the indices above and below but without increasing the size of the summation sign.

The following code illustrates these options:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

$\sigma^2 = \frac{\sum_{i=1}^{n}(x_i - \mu)^2} {n}$

$\sigma^2 = \frac{\displaystyle\sum_{i=1}^{n}(x_i - \mu)^2} {n}$

$\sigma^2 = \frac{\sum\limits_{i=1}^{n}(x_i - \mu)^2} {n}$

\end{document}


If the formula is to appear in text, then it would be preferable to use something like the following:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

text text text text text text text text  text text text text  text text text text  text text text text
$\sigma^2 = (1/n)\sum_{i=1}^{n}(x_i - \mu)^2$ text text text text text text text text  text text text text  text text text text  text text text text

\end{document}


-