Page 2

sums

2

exercise! You can come up with one yourself, or find it somewhere else.) The following is probably enough to make you believe: 1 1 1 1 1 1 1 1 1 + = + + = + + + = 2 2 2 4 4 2 4 8 8 1 1 1 1 1 = + + + + = ··· 2 4 8 16 16 1 We can generalize to starting terms other than : 2 1 =

1 = i i= A 2

1

∑ 2 A + i −1

i =1

=

1

∑ 2 A − 1 · 2i

=

=

i =1

1 2 A −1

1

∑ 2i

i =1

1

Practice reproducing this deduction!

2 A −1

Finally, we give the finite series of positive powers of two: 1+2+4+8+ ··· +

N + N = 2N − 1, where N is a power of two. 2

Important to quickly recall and motivate!

In sigma notation: lg N

∑ 2i

= 2N − 1

i =0

For instance 1 + 2 + 4 + · · · + 64 = 127. The result can be proved by induction, or deduced using previous equations as follows. The first step is to reverse the order of the terms, to make them decreasing like in previous series: lg N

i =0

lg N

2i =

i =0

N = N 2i

lg N

i =0

1 2i

Then split the sum into three ranges, which we know how to compute:     lg N ∞ 1 1 1  = N 1+1− 1 = 2N − 1 = N 0 + ∑ i − ∑ N 2 2i i =1 2 i =1+lg N

Practice reproducing this or some other deduction of the equation!

Integers from 1 to N N

1+2+3+ ··· + N =

∑i

i =1

=

N ( N + 1) 2

Important to quickly recall and motivate!

An easy way to deduce this is to rewrite it as N/2 terms, each having the sum N + 1:   N N + +1 (1 + N ) + (2 + N − 1) + (3 + N − 2) + · · · + 2 2 That doesn’t make it obvious that the equation holds for odd N as well, but it does. It can be proved, e.g., by induction. In algorithm analysis, we often disregard lower order terms, terms with smaller exponents on the variable we are interested in (N in this case). If we do, it only matters that N

∑i

i =1

1 2 N 2

Important to quickly recall and motivate!

Sums  
Sums