# SUMMATION NOTATION (INTRODUCTION)

## INTRODUCTION

Statistics involves many different calculations using data, but the beginning is often to calculate various sums of values. For example, when we calculate the "mean" we sum all the values and divide by the number of values. As another example, when we calculate the "sum of squares" we sum all the individual squared differences between the each value and the mean. The Summary statistics page has more information about why we would want to calculate these values.

Sometimes the calculations and sums we want to do can get more complicated so we need a notation to describe which values from our overall data set we are summing. We will also use this "summation notation" to describe other kinds of sums.

## SIMPLE 1D EXAMPLE

As a simple example let's think about a set of 5 values:

2, 4, 6, 7, 11

First, we can symbolize these five values with subscript notation, xsubscript, to indicate which one we're talking about in the data set:

x1, x2, x3, x4, x5

If we wanted to add them all up it would be:

2 + 4 + 6 + 7 + 11 = 30

Using our subscription notation it would be:

x1 + x2 + x3 + x4 + x5 = 30

The subscript notation is helpful for specifying certain values from our data set. For example, if I wanted someone to pay attention to the fourth value, instead of saying "Look at the fourth value" I could say "look at x4" which saves space and is unambiguous. If I wanted to add up the middle three values I could say "add up the second, third, and fourth values" or I could say "x2 + x3 + x4."

There is a special notation we can use for adding up set sof these values we've specified with subscription notation and it would look like this:

$${{\sum_{i=2}^{4}x_i }} = {x_2 + x_3 + x_4}$$

The big " $$\Sigma$$ " symbol is a capital SIGMA letter (a greek letter) and it represents the idea of summing up the terms afterwards. It is also called a summation symbol.

The "i=2" below the summation symbol indicates when in the list of values represented by "i" subscripts to start. In this case, it says to start with the i=2, x2 value, the second one. The letter is important because later we'll be looking at two-dimensional tables of numbers and one letter will represent the rows and the other will represent the columns - so far we just have a one-dimensional list.

The "4" above the summation symbol indicates when in the list of values represented by "i" subscripts to end. In this case, it says to end with the x4 value, the fourth one.

## SIMPLE 2D EXAMPLE

Now let's think about a slightly more complicated set of 20 values:

2     4     6     8     4
4     5     1     6     4
4     3     9     4     6
4     1     5     6     4

If I wanted to describe adding these all up it's easy, "add them all up", but if I wanted to describe adding some, but not all of them up, it gets trickier.

However, I can use my subscript notation and add a second subscript - one for the row and one for the column. The convention is to use indicate the row with the first subscript and the column with the second. Doing this I could say, for this data set, that:

X1,1 = 2
X1,4 = 8
X3,2 = 3

Note that each of these numbers only appears once in the data set above so you should be able to find the unique value and see how the row and columns in the subscription notation correspond.

Now imagine I wanted to tell someone to add up all the odd numbers.

2     4     6     8     4
4     5     1     6     4
4     3     9     4     6
4     1     5     6     4

Without subscript notation I would have to say something like, "add up the values in the second, third, and fourth rows, but only for the second and third columns."

With subscript notation I can just write:

$${{\sum_{i=2}^{4} {\sum_{i=2}^{3} x_{i,j} }}}$$

Double summations like this can sometimes seem intimidating, but we can break it down two different ways.

One way is to start with the summation on the right and expand it out. Then you can just change the index associated with the first summation:

$${{\sum_{i=2}^{4} {\sum_{j=2}^{3} x_{i,j} }}} = {{\sum_{i=2}^{4} ( x_{i,2}+ x_{i,3} ) }}$$ $${{ (x_{2,2}+ x_{2,3}) + (x_{3,2}+ x_{3,3}) + (x_{4,2}+ x_{4,3}) }}$$

The other way to do this is by expanding out the summation on the left and then placing the first index value into each second summation:

$${{\sum_{i=2}^{4} {\sum_{j=2}^{3} x_{i,j} }}} = {{\sum_{j=2}^{3}x_{2,j}}} + {{\sum_{j=2}^{3}x_{3,j}}} + {{\sum_{j=2}^{3}x_{4,j}}}$$ $${{ (x_{2,2}+ x_{2,3} ) + (x_{3,2}+ x_{3,3}) + (x_{4,2}+ x_{4,3}) }}$$

You can see that the answer ends up being the same either way. Which way you end up preferring to do it will be a matter of personal taste.

## ANOTHER 2D EXAMPLE

Now let's think about a slightly more complicated set of 35 values:

5     3     7     5     5     7     1
3     5     2     2     4     4     7
7     3     4     4     6     6     5
1     1     8     6     4     6     1
9     1     5     1     3     7     3

The summation notation to add up all the numbers is:

$${{\sum_{i=1}^{5} {\sum_{j=1}^{7} x_{i,j} }}}$$

The summation notation to add up all the EVEN numbers is:

$${{\sum_{i=2}^{4} {\sum_{j=3}^{6} x_{i,j} }}}$$

An example of how we might use this in an equation would be when we write out what the formula for the mean value of this data set is. The mean of a data set (see the Summary statistics page for more on this) is the sum of all the values divided by the number of values, this woudl be:

5     3     7     5     5     7     1
3     5     2     2     4     4     7
7     3     4     4     6     6     5
1     1     8     6     4     6     1
9     1     5     1     3     7     3

$$\text{MEAN} = {{\sum_{i=1}^{5} {\sum_{j=1}^{7} x_{i,j} }} \over {35}}$$

Note that sometimes the subscript indices are written next to the summation symbol to save space.

# Connect with StatsExamples here

### TRANSCRIPT OF VIDEO:

Slide 1.

Welcome to this video which is an introduction to summation notation.
In particular, it's how summation notation is used with data tables when doing statistics.
So, it really is all about the rows and columns.

Slide 2.

Summation notation is used in math and physics classes as shown here.
The symbol Sigma, which looks like a large e, means you're going to sum or add up the terms just to the right of the symbol. The text above and below the symbol indicates values for the first term and for the last term. The index letter indicated, in this case the letter i, is understood to increase by one for each term.
So, in the first example the sum indicates we are going to start when the value of i is one as shown below the symbol. We then add it to the next term for which the value of i will be 2 and then add it to the next term for which the value of i will be 3. And so on, until we get to the last value of 6 which is shown above the symbol.
The second example shows how we can incorporate additional calculations into each of the terms that will be added up. In this case we are squaring the value of i and adding the squares up. Note also that the value of i is beginning with 2 as indicated by the text below the summation symbol.
The third example of shows that sums can get more complicated and you don't need to worry about it, it's just I couldn't resist showing how cool math can be. This sum allows us to figure out the actual value of pi.
Most of the sums we will be using in statistics are more like the first two examples than the third.

Slide 3.

Okay, so when do we use these summations?
The most common way to organize data when we're doing statistics is in data tables like the one shown here.
This data table shows five values collected from each of four populations: west, north, east, and south.
Usually, each column is its own data set and the rows represent individual values taken from each of those sets.

Slide 4.

Note that the values on the far left are just labels, not data, so we won't be using those values in calculations.
If you're working with a data set you've been given, it's important to make sure you don't accidentally use labels as if they were data in your calculations.

Slide 5.

We use the term rows to refer to the values in the same horizontal line.
These values are in the same row just like the rows of seats in a movie theater or stadium.
The direction is side to side.
For example, the values in the yellow box are all in the same row.

Slide 6.

We use the term columns to refer to the values in the same vertical line.
The direction is up and down like the columns in a building.
For example, the values in the yellow box are all in the same column.

Slide 7.

We can therefore identify any value in the data table by specifying the row and column
The most common way to do this is to specify the row and then the column in a subscript next to the value X that indicates it's a variable value.
The row and column are separated with a comma.
For example, X subscript 2,3 would be the value in the second row and third column.
Remember that we're ignoring the values in the far left column because those are labels and not data values.
If we go down 2 rows and over 3 columns we get to the number 7.

Slide 8.

Let's quickly look at three other examples of this.
X 3,2
X 4, 1
and X 1,4

Slide 9.

For X 3,2 we would go down 3 rows and over 2 columns to the number 8.

Slide 10.

For X 4, 1 we would go down 4 rows and over 1 column to the number 1.

Slide 11.

For X 1,4 we would go down 1 row and over 4 columns to the number 4.

Slide 12.

Once we have a bunch of data in a table, and to way to specify values within that table, we typically want to compute other values from them.
This is because a huge data set is impossible to understand since there are too many numbers, but just one or two summary statistics are easier to understand.
Two symbols are commonly used to describe calculations across rows and columns.
The capital Greek Sigma symbol is used to represent a sum and the capital Greek Pi symbol is used to represent a product.

Slide 13.

We use the symbols to describe calculations across the rows and columns by using text above and below the symbols just like how we did at the very beginning of this video.
The text below the symbol tells us our starting point and the text above the symbol tells us when to finish.
Because we have rows and columns we have to specify both of them which we do with two letters. The letters i and j are the most common and we think of them as dummy variables that change their value when we're working with the sum or product symbol.
Keep in mind that the letters i and j themselves don't always match up with row and column. It's the order that matters - where the first one is the row and the second one is the column.
In our summation we are looking at X i,1 so the values for the row are changing. Looking at the values above and below the symbol, we see that the value of i starts at 1 and increases up to 3. This would give us X 1,1 plus X 2,1 plus X 3,1.
In our product we are looking at X 1, j so the values for the column are changing. Looking at the values above and below the symbol, we see that the value of j starts at 1 and increases up to 4. This would give us X 1,2 times X 1,3 times X 1,4.

Slide 14.

Looking at this sum and product with our data table from earlier we can see that the sum is X 1,1 plus X 2,1 plus X 3,1 which is 5 plus 3 plus 2 equals 10.
And the product is X 1,2 times X 1,3 times X 1,4 which is 8 times 9 times 4 equals 288.
In truth, summations are used much more than products in statistics so we won't worry about calculating products any more in the rest of this video.

Slide 15.

Let's quickly look at another example of this.
The sum of X 2,i from i equals to 2 up to i equal 4.

Slide 16.

Starting with i equals 2, the first term would be X 2,2
then i increases to 3 so the next term is X 2,3
then i increases to 4 so the next term is X 2,4
finding these in the table and then adding them up gives us 5 plus 7 plus 9 equals 21.

Slide 17.

If we want to perform calculations using more than one row or column we use double summation notation.
Don't get too freaked out, I know this can look confusing, but it's fine if you stay organized and go slow.
The best approach until you're comfortable with double summation is to carefully rewrite the expression using parentheses.
In the double summation shown, we know on the far left that i will be going from 1 to 2 to 3 and that will be its value in each of the terms in the second sum where j is changing.
To help keep track of this it can be useful to put parentheses around that second summation to keep it distinct from the first. Then we can focus on expanding the index in the first summation as shown. We can go ahead and replace the i's in the subscripts with the numbers 1 2 and 3 and then calculate each of those three summations where j is changing separate ly.

Slide 18.

Let's look at an example of this.
Here we have the double summation of X i,j with i going from 1 to 3 and j going from 2 to 4.

Slide 19.

Let's think about what this double summation represents.
We can think of this as the summation of columns 2 3 and 4, the second summation, for rows 1 2 and 3, the first summation.
Or we can think of this as the summation of rows 1 2 and 3, the first summation, for columns 2 3 and 4, the second summation.
Both of these ways of thinking about it describe that yellow box indicated.

Slide 20.

Let's write out the summation.
First we will focus on the left hand summation which uses the dummy variable i to represent the rows and it's three terms where i is 1, 2, and 3.
For each of those terms we have the summation for the dummy variable j which represents the columns from 2 to 4.
The terms we get are then ... {read these}
The usefulness of this nomenclature comes from being able to write a simple equation like this instead of having to try to verbally describe "add up the first three numbers from columns 2 through 4"

Slide 21.

As I mentioned the best approach until you're comfortable with this notation is to carefully rewrite the summations using parentheses.
And you have to be careful because the order can matter and double summations that look very similar are not necessarily identical.
For example the left pair of double summations are the same because the i's and j's have been swapped in both the subscripts and in the summation symbols. But the right pair of double summations are not the same - if you imagine what the rectangles of data look like for these cases you can see that they are not the same.

Slide 22.

Okay, so what do we use all this for?
The answer is that we can specify calculations using this notation.
For example, what is the mean of the top two rows?

Slide 23.

The mean is just the sum of all the values divided by how many there are.
In our equation, the mean is represented by a bar above the X.
Using our double summation nomenclature, that's equal to the sum from i equals 1 to 2 and j from 1 to 4 of X I,j divided by 8 because that is how many values there are.

Slide 24.

This is the same equation, but with the symbol shown in a more condensed format like this bottom equation.
This is more commonly done in textbooks and you can see how the information about the ranges of the dummy variables are specified in a similar manner.

Zoom out.

Hopefully you found this introduction to summation notation, as used in statistics when we're working with data tables, useful.
If you want to see more examples, there is another video on this channel that shows just that.
In fact, that video is the one suggested in just a moment.

End screen.

Feel free to like, subscribe, comment, and all the usual YouTube things.
Also, check out the StatsExamples website where there are a bunch of free and useful educational resources. The website also has penguins and social media accounts so you can stay in contact.

# Connect with StatsExamples here

This information is intended for the greater good; please use statistics responsibly.