Presentation is loading. Please wait.

Presentation is loading. Please wait.

Summations Alexandra Stefan.

Similar presentations


Presentation on theme: "Summations Alexandra Stefan."β€” Presentation transcript:

1 Summations Alexandra Stefan

2 Math background - Review
Series (the terms) and their summations: Geometric Arithmetic (This information is in the following slides and the class cheat sheet) Integrals From the Integrals cheat sheet see: The fundamental theorem of calculus Part II: Common integrals Cheat sheets and other useful links are on the Slides and Resources webpage.

3 Book Reference Book (CLRS) references for this lecture: Apendix A, especially pages , page 1150 (bounding the terms), Pages (approximation by integrals)

4 Overview Summations Summation of arithmetic series:
Where a1 is the first term and d is the step. Summation of geometric series: π‘˜=0 𝑛 π‘₯π‘˜ 0< π‘₯< , 𝛩(1) π‘₯> , 𝛩( π‘₯ 𝑛 ) π‘₯= , 𝛩(𝑛) (easy to check: 1+1+…+1) Approximation by integrals Induction You suspect/guess that a summation S = 𝛩 𝑓 𝑁 and prove/verify it using induction. See Dr. Bob Weems, β€œNotes 3: Summations”, section 3.D. Very useful exercise in strengthening one’s math skills.

5 Summations Summations are formulas of the sort: π‘˜=0 𝑛 𝑓(π‘˜)
Used to solve recurrences. Oftentimes, establishing upper bounds is sufficient, since we use big-Oh notation. If 𝑓 π‘˜ β‰₯0 , then: π‘˜=0 𝒏 𝑓 π‘˜ ≀ π‘˜=0 ∞ 𝑓 π‘˜ Summing to infinity may give a simpler formula.

6 Summation of Arithmetic Series
Examples: 1,5,9,13,17,21,…., β€˜Step’ between terms: d = 4 First term: a1 = 1 Note that 1,2,3,…,n is a special case where the step is +1. 3,13,23,33,43,…. Step? First term (a1)? General formula: Here d is the step and a1 is the first term Summation: Summation of consecutive terms: Do not confuse the summation of terms with the count of terms! (See a future slide)

7 Summation of Geometric Series 0< π‘₯<1
Suppose that 𝟎< 𝒙<𝟏: Finite summations: π‘˜=0 𝑛 π‘₯π‘˜ = 1 βˆ’ π‘₯ 𝑛+1 1 βˆ’ π‘₯ = 𝛩 ?? Infinite summations: π‘˜=0 ∞ π‘₯π‘˜ = 1 1 βˆ’ π‘₯ Important to note: π‘˜=0 𝑛 π‘₯π‘˜ ≀ π‘˜=0 ∞ π‘₯π‘˜ = 1 1 βˆ’ π‘₯ Therefore, π‘˜=0 𝑛 π‘₯π‘˜ =𝛩 1 . Why?

8 Summation of Geometric Series 0< π‘₯<1
Suppose that 𝟎< 𝒙<𝟏: Finite summations: π‘˜=0 𝑛 π‘₯π‘˜ = 1 βˆ’ π‘₯ 𝑛+1 1 βˆ’ π‘₯ = 𝛩 1 Infinite summations: π‘˜=0 ∞ π‘₯π‘˜ = 1 1 βˆ’ π‘₯ Important to note: π‘˜=0 𝑛 π‘₯π‘˜ ≀ π‘˜=0 ∞ π‘₯π‘˜ = 1 1 βˆ’ π‘₯ Therefore, π‘˜=0 𝑛 π‘₯π‘˜ =𝛩 1 . Why? Because 1 1 βˆ’ π‘₯ is independent of n. Strictly speaking we showed that it is O(1), but the sum is also β‰  0 and so it is Ξ©(1).

9 Summation of Geometric Series π‘₯β‰₯1
π‘₯>1 The formula is the same, and can be rewritten as: π‘˜=0 𝑛 π‘₯π‘˜ = π‘₯ 𝑛+1 βˆ’1 π‘₯βˆ’1 Remember this formula! For example: … + 5𝑛= 5 𝑛+1 βˆ’1 5βˆ’1 =𝛩 5𝑛 5 is a constant and so: 5 𝑛+1 = 5βˆ—5 𝑛 =𝛩 5𝑛 (Exponential!) π‘₯= =>

10 Do not confuse the summation of terms with the count of terms!
Progression: 1,2,3,…n Summation of terms: 1+2+…+n = n(n+1)/2=Θ(n2) Count of terms: 1,2,3,…,n => n terms => Θ(n) Progression:1, 2, 4, …, 2i, ...2n Summation: Count of terms: n+1 Progression:1, 2, 4, …, 2i, ...2p≀n (last power of 2 less or equal to n) Count of terms: 1+lgn (more precisely: 1+floor(lgn))

11 Approximation by Integrals π‘šβˆ’1 𝑛 𝑓 π‘₯ 𝑑π‘₯ ≀ π‘˜=π‘š 𝑛 𝑓(π‘˜) ≀ π‘š 𝑛+1 𝑓 π‘₯ 𝑑π‘₯
when f(x) is a monotonically increasing function. In most cases***, our end result will be: π‘˜=1 𝑛 𝑓(π‘˜) = Θ( 0 𝑛 𝑓 π‘₯ 𝑑π‘₯ ) when f(x) is monotonically increasing *** For the problems we look at, you can adjust the borders since the differences should result in lower order terms (see the worked-out example). But always be prepared to check the correctness.

12 Approximation by Integrals - Theory π‘šβˆ’1 𝑛 𝑓 π‘₯ 𝑑π‘₯ ≀ π‘˜=π‘š 𝑛 𝑓(π‘˜) ≀ π‘š 𝑛+1 𝑓 π‘₯ 𝑑π‘₯
Suppose that f(x) is a monotonically increasing function: This means that π‘₯≀𝑦⇒𝑓 π‘₯ ≀𝑓(𝑦). Then, we can approximate summation π‘˜=π‘š 𝑛 𝑓(π‘˜) using integral π‘š 𝑛+1 𝑓 π‘₯ 𝑑π‘₯ . Why? Because π‘˜βˆ’1 π‘˜ 𝑓 π‘₯ 𝑑π‘₯ ≀ 𝑓(π‘˜) ≀ π‘˜ π‘˜+1 𝑓 π‘₯ 𝑑π‘₯ . Proof for: 𝑓(π‘˜) ≀ π‘˜ π‘˜+1 𝑓 π‘₯ 𝑑π‘₯ For every π‘₯ in the interval [π‘˜, π‘˜+1], π‘₯β‰₯ π‘˜. Since 𝑓(π‘₯) is increasing, if π‘₯ β‰₯ π‘˜ then 𝑓 π‘₯ β‰₯ 𝑓(π‘˜). (Remember that the integral is the sum of 𝑓 π‘₯ on the interval [π‘˜, π‘˜+1]of size 1. ) Similar proof for π‘˜βˆ’1 π‘˜ 𝑓 π‘₯ 𝑑π‘₯ ≀ 𝑓(π‘˜)

13 Approximation by Integrals - Example π‘šβˆ’1 𝑛 𝑓 π‘₯ 𝑑π‘₯ ≀ π‘˜=π‘š 𝑛 𝑓(π‘˜) ≀ π‘š 𝑛+1 𝑓 π‘₯ 𝑑π‘₯
Example: approximate T(n) = π’Œ=𝟏 𝒏 π’ŒπŸ using an integral: Notice that T(n) is a sum of π’ŒπŸ terms. We will use 𝑓(π‘₯) = π‘₯2 to approximate this summation. 𝑓(π‘₯) = π‘₯2 is a monotonically increasing function. O: T(n) = π‘˜=1 𝑛 π‘˜2 ≀ 1 𝑛+1 π‘₯2𝑑π‘₯ = 𝑛+1 3 βˆ’13 3 = 𝑛3+2𝑛2+2𝑛+1 βˆ’1 3 =𝑂(𝑛3) Ξ© : T(n) = π‘˜=1 𝑛 π‘˜2 β‰₯ 0 𝑛 π‘₯2𝑑π‘₯ = 𝑛3 βˆ’03 3 = 𝑛3 3 =Ξ©(𝑛3) => 𝑓 𝑛 = 𝛩(𝑛3)

14 Approximation by Integrals π‘šβˆ’1 𝑛 𝑓 π‘₯ 𝑑π‘₯ ≀ π‘˜=π‘š 𝑛 𝑓(π‘˜) ≀ π‘š 𝑛+1 𝑓 π‘₯ 𝑑π‘₯
when f(x) is a monotonically increasing function. π‘š 𝑛+1 𝑓 π‘₯ 𝑑π‘₯ ≀ π‘˜=π‘š 𝑛 𝑓(π‘˜) ≀ π‘šβˆ’1 𝑛 𝑓 π‘₯ 𝑑π‘₯ when f(x) is a monotonically decreasing function.

15 Worksheet 1) Find Θ for 2) Given summation: 1 + 25 + 35 + … + N5
Hint: pay attention to the borders for b). 2) Given summation: … + N5 Can you solve this in terms of Θ, Ξ© or O ?


Download ppt "Summations Alexandra Stefan."

Similar presentations


Ads by Google