* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download EECS 310 Supplementary notes on summations
Big O notation wikipedia , lookup
Mathematics of radio engineering wikipedia , lookup
Abuse of notation wikipedia , lookup
Laws of Form wikipedia , lookup
Functional decomposition wikipedia , lookup
Hyperreal number wikipedia , lookup
Non-standard calculus wikipedia , lookup
Numerical continuation wikipedia , lookup
Collatz conjecture wikipedia , lookup
Proofs of Fermat's little theorem wikipedia , lookup
Elementary algebra wikipedia , lookup
Large numbers wikipedia , lookup
EECS 210 Supplementary notes on summations These notes discuss some general methods that can be applied to summations and contain some formulas that frequently occur. Let's begin by looking at the sum of the terms of a sequence in which all terms are the same value. For example, n n if each ai = 1, then ai = 1 = a1 + a2 + ... an = 1 + 1 + ... + 1 = n i=1 i=1 In general, if each ai = c where c is a constant, we have: n n ai = c = a1 + a2 + ... an = c + c + ... + c = n•c i=1 i=1 n Similarly, j = n•j since the index of summation is i and thus j is treated as a constant. i=1 Methods of manipulating sums and using formulas When evaluating complicated sums, there are several algebraic techniques that often enable us to break our problem up into parts which can be handled separately. Let's begin with the following formulas: n n cai = c ai i=1 n i=1 n n (ai + bi) = ai + bi iii nn-1 (ai - ai-1) = an - a0 and (ai - ai+1) = a0 - an i=1 n n+k 4) ai = ai-k 5) i=m n ari I=0 n n m-1 and ai = ai - ai i=m+k i=m = (arn+1 - a)/(r - 1) if r 1 i=1 From the text we have: i=1 (Geometric Series) i=0 n 6) i = (n)(n+1)/2 7) i=1 n i2 = (n)(n+1)(2n+1)/6 i=1 We begin with the following sequences: 1, 3, 5, 7, ..., 2n + 1 and 2, 6, 10, 14, ..., 4n - 2 In both sequences, each term is obtained from its predecessor by adding a constant--two in the first case, and four in the second. These are examples of arithmetic sequences and could be written in summation notation as follows: n n+1 (2i + 1) and (4i - 2), respectively. i=0 i=1 n n n Using 2) and 6) above, (2i +1) = 2 i + 1 = 2(n)(n + 1)/2 + (n + 1) = n2 + 2n + 1 = (n+1)2 i=0 i=0 i=0 There are a couple of things to note here. First of all, observe that each sum has n + 1 terms since the index of summation starts at 0. Second, we are able to break the sum apart into two parts and evaluate each separately. The first sum is obtained by using 1) and 6). Since the first term is 0, 6) can be used without modification. In general, an arithmetic sequence has the following form: a, (a + d), (a + 2d), ... , (a + n·d) and the corresponding sum is: n n n n n [a + (a + d) + ... + (a + n•d)] = (a + i•d) = a + i•d = a + d•i = (n + 1)a +d•(n)(n + 1)/2 i=0 i=0 i=0 i=0 i=0 Suppose you are asked to find the sum of the integers from 50 to 100, inclusive. This can be done quite easily using formula 6) and some algebra: 100 100 49 i = i - i = (100)(101)/2 - (49)(50)/2 = 5050 - 1225 = 3825 i=50 i=1 i=1 Consider the following pseudocode: x0 for i 1 to n do for j i to n do xx+1 What is the value of x when the block of code terminates? When i = 1, j goes from 1 to n and adds n to the value of x. When i = 2, j goes from 2 to n and adds n - 1 to the value of x. Then, the value of x when the loop terminates can be found by computing the following sum: n n + (n - 1) + (n - 2) + ... + 1 or i = (n)(n+1)/2 by formula 6) above. i=1 Now, let's consider an example of using one of the above formulas to find a formula for a different sum. Consider the first arithmetic sequence above, namely, the sum of consecutive odd numbers. As expressed above, indexing from 0 to n, gives us the sum of the first n+1 odd numbers. Using 2n -1 to represent an odd number and formula 6) above, we can obtain a formula for the sum of the first n odd numbers as follows: n n n 1 + 3 + ... + 2n - 1 = (2i - 1) = 2 i - 1 = 2(n)(n+1)/2 - n = n2 + n - n = n2 i=1 i=1 i=1 As a more complex example of deriving one formula from another, let's use 3) above to obtain formula n n3 = n3 - 0 = [i3 - (i – 1)3] Using 2) and 1) we then get i=1 n n n n n n3 = i3 - (i – 1)3 = i=1 i=1 i=1 n n n n i3 - ( i3 - 3 i2 + 3i - 1) = i3 - i3 + 3 i2 - 3 i + 1 i=1 i=1 n i=1 i=1 i=1 i=1 So, n3 = 3 i2 - 3 (n)(n+1)/2 +n i=1 n Then, 3 i2 n3 + 3(n)(n+1)/2 + n = n(n2 +3/2 n + 1/2) = (n/2)(2n2 + 3n + 1) i=1 n and i2 = (n/6)(2n2 + 3n + 1) = (n/6)(n + 1)(2n + 1) i=1 Other solution methods Let's begin by looking at one way of finding the sum of a geometric series that doesn't rely on formula 5) above. Although we'll look at a specific example, formula 5) can be derived in the same way. A sum that frequently arises when we study binary trees is the geometric series: 1 + 2 + 4 + ... +2n . Let S represent this sum. Multiplying by 2 we have 2S = 2 + 4 + ... +2n+1 Then, finding the difference, 2S = 2 + 4 + ... + 2n + 2n+1 -S = -1 - 2 - 4 - ... - 2n _________________________ S = -1 + 2n+1 Notice that most of the terms cancelled out leaving us with S = 2 n+1 - 1. Solving sums by telescoping is done in much the same way, namely, expanding the summation permits us to cancel several terms and obtain a concise closed form solution. Consider the following sum, and observe what happens when we group successive terms n [ k/(k+1) - (k+1)/(k+2)] = (1/2 - 2/3) + (2/3 - 3/4) + (3/4 - 4/5) + ... [(n/(n+1) - (n+1)/(n+2)] k=1 = 1/2 + (- 2/3 + 2/3) + (- 3/4 + 3/4) + ... + [-n/(n+1) +n/(n+1)] (n+1)/(n+2) = 1/2 - (n+1)/(n+2) This same approach can be employed to find sums like the following: 1/ (1•2) + 1/ (2•3) + 1/ (3•4) + ... + 1/ [n(n+1)]. Observe that the nth term can be rewritten as follows: 1/ [n(n+1)] = 1/n - 1/(n+1). Then, using telescoping we obtain the closed form solution below. n [1/k - 1/(k+1)] = (1/1 - 1/2) + (1/2 - 1/3) + (1/3 - 1/4) + ...+ [(1/n - 1/(n+1)] = 1 - 1/(n+1) k=1 n As a final example of this method, let's find the closed form solution of i·2i. Letting i=1 S be the sum, writing the terms in reverse order and finding the difference 2S - S , we have: 2S = n•2n+1 + (n-1)2n + (n-2)•2n-1 + ... + 3•24 +2•23 + 1•22 -S= - n•2n - (n-1)•2n-1 - ... - 4•24 – 3•23 - 2•22 – 1•2 giving us n S = n•2n+1 - 2n - 2n-1 - ... - 23 - 22 - 2 = n•2n+1 - 2i = n•2n+1 - (2n+1 - 2) = (n-1)•2n+1 + 2 i=1 (Note: the sum of the powers of 2 is indexed starting with 1 not with 0 in this case.) Finally, let Sn represent the sum of the first n terms of a series. Another method of finding a closed form solution for the sum is to try to create an equation with S n on both sides, but with different coefficients so that we can solve for Sn. Let's evaluate the following which is a generalization of the example we just did above: n i•ai Sn = = a + 2a2+ 3a3 + ... + n•an. Then, adding the next term to the left hand side i=1 n+1 Sn + (n+1)•an+1 n n n = i•ai = (i+1)•ai+1 = i•ai+1 + ai+1 i=1 i=0 i=0 i=0 n n = a i•a + a a i i=0 i i=0 = a•Sn + a[ (an+1 - 1)/(a - 1)] by formula 5), so Sn = [a - (n+1)•an+1 + n•an+2] / (a – 1)2 Practice problems: 1. 2 + 4 + 6 + ... + 2n 3. 2 + 6 + 10 + ... + (4n - 2) 5. 1 + 5 + 9 + ... + 4n - 3 7. 1•2 + 2•3 + 3•4 + ... + n(n + 1) 9. 22 + 42 +62 + ... + (2n)2 2. 4. 6. 8. 10. 2 + 6 + 18 + ... + 2·3n 4 + 10 + 16 + ... + (6n - 2) 1 + 3 + 6 + ... + [n(n + 1)]/2 1•3 + 2•4 + 3•5 + ... + n(n + 2) 12 + 32 + ... + (2n – 1)2 11. 12. 13. 14. 1/(1•3) + 1/(3•5) + 1/(5•7) + ... + 1/[(2n - 1)(2n + 1)] 1/(1•4) + 1/(4•7) + 1/(7•10) + ... + 1/[(3n - 2)(3n + 1)] 2/(2•3) + 2/(3•4) + 2/(4•5) + ... + 2/[(n + 1)(n + 2)] 1•2•3 + 2•3•4 + 3•4•5 + ... + n(n + 1)(n + 2)