Summation (CSCI 2824, Spring 2015)

In this lecture we will cover the basic notation for summation (and product).

Concepts learned:

  1. Summations and summation notation.

  2. Product notation.

Summation

Given a sequence of numbers a_1,a_2,ldots, (defined using closed form or a recurrence), we define the summation of the first n terms of the sequence as

 s_n = a_1 + a_2 + a_3 + ldots + a_{n-1} + a_n

We write this summation succinctly as:

 s_n = sum_{j=1}^n a_j

The symbol sum (the Greek alphabet Sigma) is the summation operator. The notation j=1 at the bottom of the summation is the lower limit of the sum and the n at the top is the upper limit.

Example 1:

 sum_{k=1}^4 2k = 2+4+6+8 .

 sum_{j=1}^5 1 = 1+1+1+1+1.

 sum_{i=1}^6 3^i = 3^1+3^2+3^3+3^4+3^5+3^6.

Once again we think in terms of code:

Adding up a Sequence

int SumSequence(int n, int [] A){
  int j;
  int sum = 0;
  for (j=1; j <= n; ++j){
     sum = sum + A[j];
  }
  return sum;
}

If the sequence a_n is given, then the summation of its first n terms s_n itself is a sequence given by the following recurrence:

 s_{n} = s_{n-1} + a_n, mbox{for} n geq 2

with the base case

 s_1 = a_1

Take the sequence a_n = n written in the closed form for convenience. What about the summation of the first n terms of this sequence?

 s_{n} = s_{n-1} + a_n = s_{n-1} + n, mbox{for} n geq 2

The base case is s_1 = a_1 = 1.

The closed form for s_n (the summation) is given by

 s_n = frac{n (n+1)}{2} ,.

It is really the summation of first n numbers. Here is how the 10 year old Gauss supposedly (and famously) reasoned this out:

 begin{array}{r c c c c c c c c c c c c c c } s_n &=& 1 &+& 2 &+& 3 &+& ldots &+& (n-1) &+& n & leftarrow mbox{Original Summation} s_n &=& n &+& (n-1)&+& (n-2) &+& ldots &+& 2 &+& 1 & leftarrow mbox{Rewriting it backwards} hline  2 s_n &=& (n+1) &+& (n+1) & +& (n+1) &+& ldots &+& (n+1) &+& (n+1) & leftarrow mbox{Add the two ways of writing the same summation} end{array}

The last equation gives us

 2 s_n = n ( n + 1)

which gives us the required closed form for s_n.

Observation Getting closed form representations for sequences and summations is often a difficult art in itself. Carl Fredrich Gauss was one of the unrivalled master at this!!

Product

Given a sequence of numbers a_1,a_2,ldots, (defined using closed form or a recurrence), we define the

roduct of the first n terms of the sequence as

 s_n = a_1 times a_2 times a_3 times ldots times a_{n-1} times a_n

We write this summation succinctly as:

 s_n = prod_{j=1}^n a_j

The symbol prod (the Greek alphabet Pi) is the summation operator. The notation j=1 at the bottom of the summation is the lower limit of the sum and the n at the top is the upper limit.

Example 1:

 prod_{k=1}^4 k = 1times2times3times4 .

 prod_{j=1}^5 1 = 1times1times1times1times1.

 prod_{i=1}^6 3^i = 3^1times3^2times3^3times3^4times3^5times3^6 = 3^{sum_{i=1}^6}3^i.