Appendix A: Summations Two types of summation problems in algorithms: 1) Prove by induction that formula is correct 2) Find the function that the sum equals.

Slides:



Advertisements
Similar presentations
The Comparison Test Let 0 a k b k for all k.. Mika Seppälä The Comparison Test Comparison Theorem A Assume that 0 a k b k for all k. If the series converges,
Advertisements

1.1The Principle of Mathematical Induction 1.2Divisibility Chapter Summary Case Study Mathematical Induction 1.
MCA 202: Discrete Mathematics Instructor Neelima Gupta
11 Computer Algorithms Lecture 6 Recurrence Ch. 4 (till Master Theorem) Some of these slides are courtesy of D. Plaisted et al, UNC and M. Nicolescu, UNR.
Algorithms Recurrences. Definition – a recurrence is an equation or inequality that describes a function in terms of its value on smaller inputs Example.
Infinite Sequences and Series
Tirgul 2 Asymptotic Analysis. Motivation: Suppose you want to evaluate two programs according to their run-time for inputs of size n. The first has run-time.
MTH 252 Integral Calculus Chapter 6 – Integration Section 6.4 – The Definition of Area as a Limit; Sigma Notation Copyright © 2005 by Ron Wallace, all.
Data Structures, Spring 2004 © L. Joskowicz 1 Data Structures – LECTURE 3 Recurrence equations Formulating recurrence equations Solving recurrence equations.
Data Structures, Spring 2006 © L. Joskowicz 1 Data Structures – LECTURE 3 Recurrence equations Formulating recurrence equations Solving recurrence equations.
25 June 2015Comp 122, Spring 2004 Asymptotic Notation, Review of Functions & Summations.
Problems to Solve Involving Induction Proof by Induction Basis Step: Does it work for n=0?
Chapter 4: Solution of recurrence relationships
Copyright © 2007 Pearson Education, Inc. Slide 8-1.
Geometric Sequences and Series Part III. Geometric Sequences and Series The sequence is an example of a Geometric sequence A sequence is geometric if.
Every slope is a derivative. Velocity = slope of the tangent line to a position vs. time graph Acceleration = slope of the velocity vs. time graph How.
Sequences and Series (T) Students will know the form of an Arithmetic sequence.  Arithmetic Sequence: There exists a common difference (d) between each.
Number Sequences Lecture 7: Sep 29 ? overhang. This Lecture We will study some simple number sequences and their properties. The topics include: Representation.
Lecture 9. Arithmetic and geometric series and mathematical induction
Example We can also evaluate a definite integral by interpretation of definite integral. Ex. Find by interpretation of definite integral. Sol. By the interpretation.
Mathematics Review and Asymptotic Notation
Given the marginal cost, find the original cost equation. C ' ( x ) = 9 x 2 – 10 x + 7 ; fixed cost is $ 20. In algebra, we were told that what ever was.
Chapter 2 Mathematical preliminaries 2.1 Set, Relation and Functions 2.2 Proof Methods 2.3 Logarithms 2.4 Floor and Ceiling Functions 2.5 Factorial and.
CMPT 438 Algorithms Chapter 3 Asymptotic Notations.
9.4 Part 1 Convergence of a Series. The first requirement of convergence is that the terms must approach zero. n th term test for divergence diverges.
9.4 Mathematical Induction
Mathematical Background and Linked Lists. 2 Iterative Algorithm for Sum Find the sum of the first n integers stored in an array v : sum (v[], n) temp_sum.
Chapter 9: Selection Order Statistics What are an order statistic? min, max median, i th smallest, etc. Selection means finding a particular order statistic.
11-4 INTRO TO SERIES DEFINITION A SERIES IS THE SUM OF THE TERMS OF A SEQUENCE. SEQUENCE VS. SERIES 2, 4, 8, … …
Section 9.2 – Series and Convergence. Goals of Chapter 9.
Appendix A: Summations Motivation: Evaluating and/or bounding sums are frequently needed in the solution of recurrences Two types of evaluation problems:
Mathematical Induction Digital Lesson. Copyright © by Houghton Mifflin Company, Inc. All rights reserved. 2 Mathematical induction is a legitimate method.
Arithmetic Series 19 May Summations Summation – the sum of the terms in a sequence {2, 4, 6, 8} → = 20 Represented by a capital Sigma.
1 Section 5.2 Summations and Closed Forms A closed form is an expression that can be computed by applying a fixed number of familiar operations to the.
12 INFINITE SEQUENCES AND SERIES. In general, it is difficult to find the exact sum of a series.  We were able to accomplish this for geometric series.
Copyright © Cengage Learning. All rights reserved.
MTH253 Calculus III Chapter 11, Part I (sections 11.1 – 11.6) Sequences Series Convergence Tests.
Section 10.5 Let X be any random variable with (finite) mean  and (finite) variance  2. We shall assume X is a continuous type random variable with p.d.f.
Recursion and Induction Themes –Recursion –Recurrence Definitions –Recursive Relations –Induction (prove properties of recursive programs and objects defined.
4.2 Area Definition of Sigma Notation = 14.
Chapter 4: Solution of recurrence relationships Techniques: Substitution: proof by induction Tree analysis: graphical representation Master theorem: Recipe.
Lesson 5-2R Riemann Sums. Objectives Understand Riemann Sums.
Assignment 1: due 1/13/16 Geometric sum Prove by induction on integers that.
Problem of the Day The graph of a function f is shown above.Which of the following statements about f is false? A) f is continuous at x = a B) f has a.
5.3 Definite Integrals. Example: Find the area under the curve from x = 1 to x = 2. The best we can do as of now is approximate with rectangles.
Chapter 9: Selection of Order Statistics What are an order statistic? min, max median, i th smallest, etc. Selection means finding a particular order statistic.
Copyright © Cengage Learning. All rights reserved The Integral Test and Estimates of Sums.
Analysis of Algorithms CS 477/677 Instructor: Monica Nicolescu Lecture 2.
Mathematical Induction. The Principle of Mathematical Induction Let S n be a statement involving the positive integer n. If 1.S 1 is true, and 2.the truth.
INFINITE SEQUENCES AND SERIES In general, it is difficult to find the exact sum of a series.  We were able to accomplish this for geometric series and.
Introduction to Algorithms: Recurrences
Chapter 8 Infinite Series.
Accel PRecalc Unit #4: Sequences & Series Lesson #3: Finite Geometric Sequences and Series
Copyright © Cengage Learning. All rights reserved.
Geometric Sequences and Series
Copyright © Cengage Learning. All rights reserved.
Should know some common ones:
Section 2.1 Arithmetic Sequences and Series
Introduction to Algorithms
Copyright © Cengage Learning. All rights reserved.
Quiz 1, Monday 1/28/19 Chapters 1,2 and 3 HW assignments 1-5.
Summations Alexandra Stefan.
Chapter 11: Further Topics in Algebra
Assignment 1: due 1/9/19 Geometric sum: Prove by induction on integers that Give a structured proof using the technique if S(n-1) then S(n). Include the.
11.3a: Positive-Term Series
Mathematical Induction
Chapter 9: Selection of Order Statistics
Mathematical Induction
11.4 Mathematical Induction
Chapter 1 Automata CE year IV.
Presentation transcript:

Appendix A: Summations Two types of summation problems in algorithms: 1) Prove by induction that formula is correct 2) Find the function that the sum equals or is bounded by We encountered both types in analysis of insertion sort

Proof that example of induction on integers using if S(n-1) then S(n) How does “setup” change to use if S(n) then S(n+1)? What is I.H. in this method? Setup to use “if S(n-1) then S(n)” I.H.

Use the arithmetic sum to evaluate the sums in the analysis of insertion sort runtime

Important sums to remember Arithmetic  k=1 to n k = n(n+1)/2 =  (n 2 ) Geometric  k=0 to n x k = (x n+1 – 1)/(x – 1) when x  1 Harmonic  k=1 to n (1/k) = ln(n) +  (1) Geometric series  k=0 to ∞ x k = 1/(1 – x) when |x| < 1

Integration and differentiation can be used to evaluate sums derivative: d{  f(x)}/dx =  df/dx integral:  dx {  f(x)} =   dx f(x) Example: eq. A.8 p1148 Show  k=0 to ∞ k x k = x/(1 – x) 2 when 0< |x| < 1

Bounding sums Prove a bound by induction Bound ever term in sum Bound by integration monotone increasing and decreasing summands

Prove by induction on integers that  k=0 to n 3 k = O(3 n )

Base case n=1  k=0 to 1 3 k = 1+3=4 O(3 n=1 ) = O(3) Does 4 = O(3)? there exist c=4/3 such that 0<4<3c Similar argument applies n=2, etc. c 1 = O(c 2 ) for any constants c 1 and c 2.

Proof of  k=0 to n 3 k = O(3 n ) using if S(n-1) then S(n) Setup  k=0 to n 3 k =  k=0 to n-1 3 k + 3 n Assume (I.H.)  k=0 to n-1 3 k = O(3 n-1 ) Based on our assumption: there exist a c>0 such that  k=0 to n-1 3 k < c 3 n-1 To find the constraints on c and n, solve the inequality  k=0 to n 3 k < c 3 n n < c 3 n RTA

Proof of  k=0 to n 3 k = O(3 n ) using if S(n-1) then S(n) To find the constraints on c and n, solve the inequality  k=0 to n 3 k < c 3 n n < c 3 n Focus on the 2 nd inequality c 3 n n < c 3 n c 3 n (1/3+ 1/c) < c 3 n (1/3+ 1/c) < 1 Since any dependence on n has been eliminated, we could use = to solve for c = 3/2. This approach cannot be used when the inequality still depends on both c and n. Result will be c as a function of n, which does not satisfy the definition of Big O.

When the problem includes the statement “Show the constraints on c and n.”, I am asking for a solution of the inequality even if a constant value of c can be found using the = option. If there is not constraint on n, simply state this and assign n 0 a value of 1.

CptS 350 Spring 2016 [All problems are from Cormen et al, 3nd Edition] Homework Assignment 5: due 2/5/16 1.ex A.1-3 p 1149 hint: use derviatives 2.ex A.1-6 p 1149 hint: let g k (n)=O(f k (n)) and use definition of Big O

Example of bound sum by bounding every term Show that (n/2) 2 <  k=1 to n k < n 2

Bound by integration: monotone increasing summand Shaded area is integral of continuous function f(x) Sum equals area of “upper sum” rectangles Same f(x) different limits on integration Sum equals area of “lower sum” rectangles

Note the difference for monotone increasing and decreasing summand Method not applicable if summand is not monotone increasing or decreasing

Use bounding by integrals for informal proof that  k=1 to n k -1 =  (ln(n))

CptS 350 Spring 2016 [All problems are from Cormen et al, 3nd Edition] Homework Assignment 6: due 2/8/16 1.ex A.2-1 p 1156 (hint: use integration) 2.part a of prop A-1 p 1156 using bound each term