chapter 7: asymptotics guy even moti...
TRANSCRIPT
![Page 1: Chapter 7: Asymptotics Guy Even Moti Medinahyde.eng.tau.ac.il/Even-Medina/Annotated-Slides/asymptotics-1-14.pdf · Asymptotics of Geometric Series Claim If {b n} n is a geometric](https://reader035.vdocuments.net/reader035/viewer/2022071102/5fdb976c34db7239f7569622/html5/thumbnails/1.jpg)
Digital Logic Design: a rigorous approach c�Chapter 7: Asymptotics
Guy Even Moti Medina
School of Electrical Engineering Tel-Aviv Univ.
April 6, 2020
Book Homepage:http://www.eng.tau.ac.il/~guy/Even-Medina
1 / 24
![Page 2: Chapter 7: Asymptotics Guy Even Moti Medinahyde.eng.tau.ac.il/Even-Medina/Annotated-Slides/asymptotics-1-14.pdf · Asymptotics of Geometric Series Claim If {b n} n is a geometric](https://reader035.vdocuments.net/reader035/viewer/2022071102/5fdb976c34db7239f7569622/html5/thumbnails/2.jpg)
The functions we study
We study functions that describe the number of gates in a circuit,the delay of a circuit (length of longest path), the running time ofan algorithm, number of bits in a data structure, etc. In all thesecases it is natural to assume that
�n � N : f (n) � 1.
Assumption
The functions we study are functions f : N � R�1.
2 / 24
![Page 3: Chapter 7: Asymptotics Guy Even Moti Medinahyde.eng.tau.ac.il/Even-Medina/Annotated-Slides/asymptotics-1-14.pdf · Asymptotics of Geometric Series Claim If {b n} n is a geometric](https://reader035.vdocuments.net/reader035/viewer/2022071102/5fdb976c34db7239f7569622/html5/thumbnails/3.jpg)
Order of Growth Rates
We want to compare functions asymptotically (how fast doesf (n) grow as n � �).
Ignore constants (not because they are not important, butbecause we want to focus on “high order” terms).
3 / 24
![Page 4: Chapter 7: Asymptotics Guy Even Moti Medinahyde.eng.tau.ac.il/Even-Medina/Annotated-Slides/asymptotics-1-14.pdf · Asymptotics of Geometric Series Claim If {b n} n is a geometric](https://reader035.vdocuments.net/reader035/viewer/2022071102/5fdb976c34db7239f7569622/html5/thumbnails/4.jpg)
big-O, big-Omega, big-Theta
De�nition
Let f , g : N � R�1 denote two functions.
1 We say that f (n) = O(g(n)), if there exist constants c � R+
and N � N, such that,
�n > N : f (n) � c · g(n) .
2 We say that f (n) = �(g(n)), if there exist constants c � R+
and N � N, such that,
�n > N : f (n) � c · g(n) .
3 We say that f (n) = �(g(n)), if f (n) = O(g(n)) andf (n) = �(g(n)).
What does “=” actually mean here?!
4 / 28
![Page 5: Chapter 7: Asymptotics Guy Even Moti Medinahyde.eng.tau.ac.il/Even-Medina/Annotated-Slides/asymptotics-1-14.pdf · Asymptotics of Geometric Series Claim If {b n} n is a geometric](https://reader035.vdocuments.net/reader035/viewer/2022071102/5fdb976c34db7239f7569622/html5/thumbnails/5.jpg)
Warning on Notation
What does the equality sign in f = O(g) mean?
O(g) in fact refers to a set of functions:
O(g) � {h : N � R�1 | �c�N�n > N : h(n) � c · g(n)}
Would have been much better to write f � O(g) instead off = O(g).
But we want to abuse notation and write expressions like:
(2n3 + 3n) · 5 log(n2) = O(n2 · log n2)
= O(n2 · log n) .
Justi�cation: transitivity.
5 / 24
![Page 6: Chapter 7: Asymptotics Guy Even Moti Medinahyde.eng.tau.ac.il/Even-Medina/Annotated-Slides/asymptotics-1-14.pdf · Asymptotics of Geometric Series Claim If {b n} n is a geometric](https://reader035.vdocuments.net/reader035/viewer/2022071102/5fdb976c34db7239f7569622/html5/thumbnails/6.jpg)
big-O, big-Omega, big-Theta
De�nition
Let f , g : N � R�1 denote two functions.
1 We say that f (n) = O(g(n)), if there exist constants c � R+ and N � N, suchthat,
�n > N : f (n) � c · g(n) .
2 We say that f (n) = �(g(n)), if there exist constants c � R+ and N � N, suchthat,
�n > N : f (n) � c · g(n) .
3 We say that f (n) = �(g(n)), if f (n) = O(g(n)) and f (n) = �(g(n)).
If f (n) = O(g(n)), then “asymptotically, f (n) does not grow fasterthan g(n)”.If f (n) = �(g(n)), then “asymptotically, f (n) grows as least asfast as g(n)”.Finally, if f (n) = �(g(n)), then “asymptotically, f (n) grows as fastas g(n)”.
6 / 28
![Page 7: Chapter 7: Asymptotics Guy Even Moti Medinahyde.eng.tau.ac.il/Even-Medina/Annotated-Slides/asymptotics-1-14.pdf · Asymptotics of Geometric Series Claim If {b n} n is a geometric](https://reader035.vdocuments.net/reader035/viewer/2022071102/5fdb976c34db7239f7569622/html5/thumbnails/7.jpg)
Remark
When proving that f (n) = O(g(n)), it is not necessary to �nd the“smallest” constant c .
Example
Suppose you want to prove that n +n = O(n1.1). Then, it
su�ces to prove that for n > 2100:
n +n � 106 · n1.1 .
Any other constants you can prove the statement for are just asgood!
11 / 28
![Page 8: Chapter 7: Asymptotics Guy Even Moti Medinahyde.eng.tau.ac.il/Even-Medina/Annotated-Slides/asymptotics-1-14.pdf · Asymptotics of Geometric Series Claim If {b n} n is a geometric](https://reader035.vdocuments.net/reader035/viewer/2022071102/5fdb976c34db7239f7569622/html5/thumbnails/8.jpg)
Examples
n = O(n2)
7 / 28
![Page 9: Chapter 7: Asymptotics Guy Even Moti Medinahyde.eng.tau.ac.il/Even-Medina/Annotated-Slides/asymptotics-1-14.pdf · Asymptotics of Geometric Series Claim If {b n} n is a geometric](https://reader035.vdocuments.net/reader035/viewer/2022071102/5fdb976c34db7239f7569622/html5/thumbnails/9.jpg)
Examples
log(n) = O(n)
8 / 28
![Page 10: Chapter 7: Asymptotics Guy Even Moti Medinahyde.eng.tau.ac.il/Even-Medina/Annotated-Slides/asymptotics-1-14.pdf · Asymptotics of Geometric Series Claim If {b n} n is a geometric](https://reader035.vdocuments.net/reader035/viewer/2022071102/5fdb976c34db7239f7569622/html5/thumbnails/10.jpg)
Examples
10n = O(n), 102n = O(n), . . . , 10100n = O(n)
9 / 28
![Page 11: Chapter 7: Asymptotics Guy Even Moti Medinahyde.eng.tau.ac.il/Even-Medina/Annotated-Slides/asymptotics-1-14.pdf · Asymptotics of Geometric Series Claim If {b n} n is a geometric](https://reader035.vdocuments.net/reader035/viewer/2022071102/5fdb976c34db7239f7569622/html5/thumbnails/11.jpg)
Examples
n · log log log n 6= O(n)
10 / 28
![Page 12: Chapter 7: Asymptotics Guy Even Moti Medinahyde.eng.tau.ac.il/Even-Medina/Annotated-Slides/asymptotics-1-14.pdf · Asymptotics of Geometric Series Claim If {b n} n is a geometric](https://reader035.vdocuments.net/reader035/viewer/2022071102/5fdb976c34db7239f7569622/html5/thumbnails/12.jpg)
Constant Function
Claim
f (n) = O(1) i� there exists a constant c such that f (n) � c, for
every n.
8 / 24
![Page 13: Chapter 7: Asymptotics Guy Even Moti Medinahyde.eng.tau.ac.il/Even-Medina/Annotated-Slides/asymptotics-1-14.pdf · Asymptotics of Geometric Series Claim If {b n} n is a geometric](https://reader035.vdocuments.net/reader035/viewer/2022071102/5fdb976c34db7239f7569622/html5/thumbnails/13.jpg)
![Page 14: Chapter 7: Asymptotics Guy Even Moti Medinahyde.eng.tau.ac.il/Even-Medina/Annotated-Slides/asymptotics-1-14.pdf · Asymptotics of Geometric Series Claim If {b n} n is a geometric](https://reader035.vdocuments.net/reader035/viewer/2022071102/5fdb976c34db7239f7569622/html5/thumbnails/14.jpg)
Asymptotic Algebra (big-O)
Abbreviate: fi = O(h) means fi (n) = O(h(n)).
Claim
Suppose that fi = O(gi ) for i � {1, . . . , k}, then:
max{fi}i = O(max{gi}i )�
i
fi = O(�
gi )
�
i
fi = O(�
i
gi ) .
Consequences:
2n = O(n) mult. by constant
50n2 + 2n + 1 = O(n2) polynomial with positive leading coe�cient
11 / 24
![Page 15: Chapter 7: Asymptotics Guy Even Moti Medinahyde.eng.tau.ac.il/Even-Medina/Annotated-Slides/asymptotics-1-14.pdf · Asymptotics of Geometric Series Claim If {b n} n is a geometric](https://reader035.vdocuments.net/reader035/viewer/2022071102/5fdb976c34db7239f7569622/html5/thumbnails/15.jpg)
![Page 16: Chapter 7: Asymptotics Guy Even Moti Medinahyde.eng.tau.ac.il/Even-Medina/Annotated-Slides/asymptotics-1-14.pdf · Asymptotics of Geometric Series Claim If {b n} n is a geometric](https://reader035.vdocuments.net/reader035/viewer/2022071102/5fdb976c34db7239f7569622/html5/thumbnails/16.jpg)
![Page 17: Chapter 7: Asymptotics Guy Even Moti Medinahyde.eng.tau.ac.il/Even-Medina/Annotated-Slides/asymptotics-1-14.pdf · Asymptotics of Geometric Series Claim If {b n} n is a geometric](https://reader035.vdocuments.net/reader035/viewer/2022071102/5fdb976c34db7239f7569622/html5/thumbnails/17.jpg)
![Page 18: Chapter 7: Asymptotics Guy Even Moti Medinahyde.eng.tau.ac.il/Even-Medina/Annotated-Slides/asymptotics-1-14.pdf · Asymptotics of Geometric Series Claim If {b n} n is a geometric](https://reader035.vdocuments.net/reader035/viewer/2022071102/5fdb976c34db7239f7569622/html5/thumbnails/18.jpg)
Asymptotic Algebra (big-Omega)
Claim
Suppose that fi = �(gi ) for i � {1, . . . , k}, then:
min{fi}i = �(min{gi}i )�
i
fi = �(�
gi )
�
i
fi = �(�
i
gi ) .
Consequences:
2n = �(n) mult. by constant
10�6 · n2 + 2n + 1 = �(n2) polynomial with positive leading coe�cient
12 / 24
![Page 19: Chapter 7: Asymptotics Guy Even Moti Medinahyde.eng.tau.ac.il/Even-Medina/Annotated-Slides/asymptotics-1-14.pdf · Asymptotics of Geometric Series Claim If {b n} n is a geometric](https://reader035.vdocuments.net/reader035/viewer/2022071102/5fdb976c34db7239f7569622/html5/thumbnails/19.jpg)
Asymptotics of Arithmetic Series
Claim
If {an}n is an arithmetic sequence with a0 � 0 and d > 0, then�
i�n ai = �(n · an).
Consequence:
n�
i=1
i = �(n2) .
9 / 24
![Page 20: Chapter 7: Asymptotics Guy Even Moti Medinahyde.eng.tau.ac.il/Even-Medina/Annotated-Slides/asymptotics-1-14.pdf · Asymptotics of Geometric Series Claim If {b n} n is a geometric](https://reader035.vdocuments.net/reader035/viewer/2022071102/5fdb976c34db7239f7569622/html5/thumbnails/20.jpg)
Asymptotics of Geometric Series
Claim
If {bn}n is a geometric sequence with b0 � 1 and q > 1, then�
i�n bi = �(bn).
Consequence: If q > 1, then�n
i=1 qi = �(qn).
10 / 24
![Page 21: Chapter 7: Asymptotics Guy Even Moti Medinahyde.eng.tau.ac.il/Even-Medina/Annotated-Slides/asymptotics-1-14.pdf · Asymptotics of Geometric Series Claim If {b n} n is a geometric](https://reader035.vdocuments.net/reader035/viewer/2022071102/5fdb976c34db7239f7569622/html5/thumbnails/21.jpg)
Asymptotics as an Equivalence Relation
Claim
f = O(f ) re�exivity
f = O(g) 6= g = O(f ) no symmetry
(f = O(g)) (g = O(h)) = f = O(h) transitivity
What about �?
13 / 24
![Page 22: Chapter 7: Asymptotics Guy Even Moti Medinahyde.eng.tau.ac.il/Even-Medina/Annotated-Slides/asymptotics-1-14.pdf · Asymptotics of Geometric Series Claim If {b n} n is a geometric](https://reader035.vdocuments.net/reader035/viewer/2022071102/5fdb976c34db7239f7569622/html5/thumbnails/22.jpg)
![Page 23: Chapter 7: Asymptotics Guy Even Moti Medinahyde.eng.tau.ac.il/Even-Medina/Annotated-Slides/asymptotics-1-14.pdf · Asymptotics of Geometric Series Claim If {b n} n is a geometric](https://reader035.vdocuments.net/reader035/viewer/2022071102/5fdb976c34db7239f7569622/html5/thumbnails/23.jpg)
![Page 24: Chapter 7: Asymptotics Guy Even Moti Medinahyde.eng.tau.ac.il/Even-Medina/Annotated-Slides/asymptotics-1-14.pdf · Asymptotics of Geometric Series Claim If {b n} n is a geometric](https://reader035.vdocuments.net/reader035/viewer/2022071102/5fdb976c34db7239f7569622/html5/thumbnails/24.jpg)
Big-Omega: equivalent de�nition
Claim
Assume f (n), g(n) � 1, for every n. Then,
f (n) = O(g(n)) � g(n) = �(f (n)).
14 / 24