complexity of computations nicholas tran department of mathematics & computer science santa...
DESCRIPTION
Running Time is measured... In terms of basic operations (digit addition) As a function of input size (number of digits)TRANSCRIPT
![Page 1: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/1.jpg)
Complexity of Computations
Nicholas TranDepartment of Mathematics & Computer
ScienceSanta Clara UniversitySanta Clara, CA 95053
USA
![Page 2: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/2.jpg)
How fast can computers add two integers ? 1 2 3
+ 4 5 6
---------
5 7 9
![Page 3: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/3.jpg)
Running Time is measured ... In terms of basic operations (digit
addition) As a function of input size
(number of digits)
![Page 4: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/4.jpg)
A(n) = n (digit additions) an an-1 an-2 ... a2 a1
+ bn bn-1 bn-2 ... b2 b1
---------------------------------------
cn+1 cn cn-1 cn-2 ... c2 c1
![Page 5: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/5.jpg)
Linear Running Time is FAST! Assume:
3GHz processor (3 billion cycles / second)
One basic operation = 10 cycles 64-bit words (19 decimal digits)
Can add 4.7 million pairs of 64-bit integers in one second!
![Page 6: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/6.jpg)
Is Linear Time Optimal ? Yes! Every bit must be examined
![Page 7: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/7.jpg)
How fast can computers multiply two integers ? 1 2
* 3 4
--------
4 8
3 6
4 0 8
![Page 8: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/8.jpg)
M(n) = n2 (digit mults) + (n-1)n (digit additions) an an-1 an-2 ... a2
a1
* bn bn-1 bn-2 ... b2 b1
---------------------------------------
![Page 9: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/9.jpg)
Quadratic Running Time is OK Assume:
3GHz processor (3 billion cycles / second)
One basic operation = 10 cycles Can multiply 300 pairs of 1024-bit
integers in one second.
![Page 10: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/10.jpg)
Is Quadratic Time optimal ? No! Divide-and-conquer method: n1.585
Fast-Fourier-Transform: n log n
![Page 11: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/11.jpg)
Divide and Conquer Multiplication
A1 an ... a1+n/2 an/2 ... a1 A0
B1 bn ... b1+n/2 bn/2 ... b1 B0
A*B = 2n(A1*B1) + 2n/2[(A1 – A0)*(B0 – B1) + A1*B1 + A0*B0] + A0*B0
![Page 12: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/12.jpg)
Running TimeM(n) = 3M(n/2) = 3*(3M(n/4)) = 3*3*(3M(n/8)) = ... = 3lg n = nlg 3 = n1.585...
![Page 13: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/13.jpg)
Open Question Linear-time algorithm for integer
multiplication ?
![Page 14: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/14.jpg)
How fast can computers multiply two matrices ? 1 2 5 6 19 22 * = 3 4 7 8 36 40
![Page 15: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/15.jpg)
MT(n) = n3 (multiplications) Result matrix has n2 entries Each entry requires n
multiplications
![Page 16: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/16.jpg)
Is Cubic Time optimal ? No! Divide-and-conquer method: n2.8074
Fastest known: n2.376
![Page 17: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/17.jpg)
Open Question Quadratic-time algorithm for matrix
multiplication ?
![Page 18: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/18.jpg)
How fast can computers compute bx ? 207314 =
163941337332542421506559015723347759364300068397756479870218390908602100383\ 07922727887209064687385169802330113993715822472651871750525058759656611\
33524136520376084888852214059673269428533014335800256092944711066046124\ 65720634680059676515229653689770006451644184755542774816379633924627617\ 05099174019255538743584629999826446047309939592097350115722833385636445\ 63886481013473075657995735436727794479189654529537393093545923092137017\ 52102655263222045614392981857588240904150531584994663864142668575382184\ 77683376171973571372801939885320527927087749711039139096117682810252441\ 30411871017236729965957901414498677146321719899287248980868996796413073\ 45380396119706515352607745909505485585157609318105039969986657456119601\ 41747323092449
![Page 19: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/19.jpg)
Naïve algorithm: x multiplications bx = b*b*...*b (x times)
![Page 20: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/20.jpg)
Better algorithm: 2n multiplications (n=lg x)b21 = b16+4+1 = b16b4b1
bb2 = b*bb4 = b2 * b2
b8 = b4 * b4
b16 = b8 * b8
![Page 21: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/21.jpg)
How fast can computers find gcd(a,b) ? Greatest common divisor of 9 and 6
is 3
![Page 22: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/22.jpg)
Naïve method: min(a,b) divisionsGcd(9, 6):
6 divides 6 but not 95 does not divide 64 does not divide 63 divides 6 AND 9
![Page 23: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/23.jpg)
Euclidean Algorithm: 5*lg min(a, b)
gcd(a, b) = gcd(b, a mod b)
gcd(1357911,361) = gcd(361, 190) = gcd(190, 171) = gcd(171, 19) = gcd(19, 0) = 19
![Page 24: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/24.jpg)
gcd(a, b) by factoring into primes
9 = 20 * 32
6 = 21 * 31
gcd(9, 6) = 20 * 31
![Page 25: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/25.jpg)
How fast can computers recognize primes ? Isprime(11) = true Isprime(314159) = true Isprime(27183) = fase
![Page 26: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/26.jpg)
Naïve method: √x divisionsTheorem: if x = ab, then either a or b is at most √x
![Page 27: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/27.jpg)
Too slow for large x! Largest known prime: 232482657 – 1
Would take 216241272 ~ 104889109 years (age of universe ~ 1010 years)
![Page 28: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/28.jpg)
Major Breakthrough Agrawal, Kayal, Saxena published
an algorithm in 2004 with running time
(lg x)6
Would take 1029 years on the largest known prime!
![Page 29: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/29.jpg)
In practice... Probabilistic algorithm (Rabin) Very fast [(lg x)2] but may make
mistake Would take 40 days on the largest
known prime
![Page 30: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/30.jpg)
How fast can computers factor integers ? 3141592653589793 = 13 * 241 * 1002742628021
![Page 31: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/31.jpg)
Open Question Fastest known algorithm for
factoring integers is faster than x but slower than lg x
Is there a fast algorithm for factoring integers ?
![Page 32: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/32.jpg)
Major Breakthrough Shor published a (lg x)3 method for
quantum computers in 2001
![Page 33: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/33.jpg)
RSA Cryptography Invented by Rivest, Shamir,
Adleman in 1978 Seems unbreakable if there are no
fast methods for integer factoring
![Page 34: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/34.jpg)
How RSA works I put on my website two integers (n,
e) n is the product of two secret big
primes p, q e is chosen so that gcd(e, (p-1)(q-1)) = 1 I compute d so that de = 1 + multiple of (p-1)(q-1)
![Page 35: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/35.jpg)
To send a message x You get (n, e) from my website and send xe (mod n)
I decrypt by computing (xe)d (mod n) = x Unless you can factor n = pq, it seems
hard to find d
![Page 36: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/36.jpg)
Example (Stinson) I put on my website (11413, 3533) 11413 = 101 * 113 gcd(3533, (100*112)) = 1 d = 6597 6597 * 3533 = 1 (mod 11200)
![Page 37: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/37.jpg)
Example (ctd.) To send me 9726, you compute 97263533 (mod 11413) = 5761 To decode I compute 57616597 (mod 11413) =
9726
![Page 38: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/38.jpg)
Exploiting Hardness of Pattern Recognition
![Page 39: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/39.jpg)
Even Harder Problems Traveling Salesman: shortest
route starting from San Jose through n cities
Partition: divide a set of n people into two groups, so that the total weight of each group is identical
![Page 40: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/40.jpg)
NP-hard Problems Solutions are hard to find but easy to
check A fast solution to any of these
problems would yield a fast solution to integer factoring
A one-million dollar prize is currently offered to a resolution of this issue
![Page 41: Complexity of Computations Nicholas Tran Department of Mathematics & Computer Science Santa Clara University Santa Clara, CA 95053 USA](https://reader035.vdocument.in/reader035/viewer/2022070605/5a4d1af57f8b9ab0599815b9/html5/thumbnails/41.jpg)
Summary