Divide and Conquer. Maximum/minimum. Integer Multiplication. CS125 Lecture 4 Fall 2015

Save this PDF as:
 WORD  PNG  TXT  JPG

Size: px
Start display at page:

Download "Divide and Conquer. Maximum/minimum. Integer Multiplication. CS125 Lecture 4 Fall 2015"

Transcription

1 CS125 Lecture 4 Fall 2015 Divide ad Coquer We have see oe geeral paradigm for fidig algorithms: the greedy approach. We ow cosider aother geeral paradigm, kow as divide ad coquer. We have already see a example of divide ad coquer algorithms: mergesort. The idea behid mergesort is to take a list, divide it ito two smaller sublists, coquer each sublist by sortig it, ad the combie the two solutios for the subproblems ito a sigle solutio. These three basic steps divide, coquer, ad combie lie behid most divide ad coquer algorithms. With mergesort, we kept dividig the list ito halves util there was just oe elemet left. I geeral, we may divide the problem ito smaller problems i ay coveiet fashio. Also, i practice it may ot be best to keep dividig util the istaces are completely trivial. Istead, it may be wise to divide util the istaces are reasoably small, ad the apply a algorithm that is fast o small istaces. For example, with mergesort, it might be best to divide lists util there are oly four elemets, ad the sort these small lists quickly by isertio sort. Maximum/miimum Suppose we wish to fid the miimum ad maximum items i a list of umbers. How may comparisos does it take? A atural approach is to try a divide ad coquer algorithm. Split the list ito two sublists of equal size. (Assume that the iitial list size is a power of two.) Fid the maxima ad miima of the sublists. Two more comparisos the suffice to fid the maximum ad miimum of the list. Hece, if T () is the umber of comparisos, the T () = 2T (/2) + 2. (The 2T (/2) term comes from coquerig the two problems ito which we divide the origial; the 2 term comes from combiig these solutios.) Also, clearly T (2) = 1. By iductio we fid T () = (3/2) 2, for a power of 2. Iteger Multiplicatio The stadard multiplicatio algorithm takes time Θ( 2 ) to multiply together two digit umbers. This algorithm is so atural that we may thik that o algorithm could be better. Here, we will show that better algorithms 4-1

2 Lecture exist (at least i terms of asymptotic behavior). Imagie splittig each umber x ad y ito two parts: x = 10 /2 a + b,y = 10 /2 c + d. The xy = 10 ac + 10 /2 (ad + bc) + bd. The additios ad the multiplicatios by powers of 10 (which are just shifts!) ca all be doe i liear time. We have therefore reduced our multiplicatio problem ito four smaller multiplicatios problems, so the recurrece for the time T () to multiply two -digit umbers becomes T () = 4T (/2) + O(). The 4T (/2) term arises from coquerig the smaller problems; the O() is the time to combie these problems ito the fial solutio (usig additios ad shifts). Ufortuately, whe we solve this recurrece, the ruig time is still Θ( 2 ), so it seems that we have ot gaied aythig. The key thig to otice here is that four multiplicatios is too may. Ca we somehow reduce it to three? It may ot look like it is possible, but it is usig a simple trick. The trick is that we do ot eed to compute ad ad bc separately; we oly eed their sum ad + bc. Now ote that (a + b)(c + d) = (ad + bc) + (ac + bd). So if we calculate ac, bd, ad (a + b)(c + d), we ca compute ad + bc by the subtractig the first two terms from the third! Of course, we have to do a bit more additio, but sice the bottleeck to speedig up this multiplicatio algorithm is the umber of smaller multiplicatios required, that does ot matter. The recurrece for T () is ow T () = 3T (/2) + O(), ad we fid that T () = log , improvig o the quadratic algorithm. If oe were to implemet this algorithm, it would probably be best ot to divide the umbers dow to oe digit. The covetioal algorithm, because it uses fewer additios, is probably more efficiet for small values of. Moreover, o a computer, there would be o reaso to cotiue dividig oce the legth is so small that the multiplicatio ca be doe i oe stadard machie multiplicatio operatio! It also turs out that usig a more complicated algorithm (based o a similar idea) the asymptotic time for multiplicatio ca be made arbitrarily close to liear that is, for ay ε > 0 there is a algorithm that rus i time O( 1+ε ).

3 Lecture Strasse s algorithm Divide ad coquer algorithms ca similarly improve the speed of matrix multiplicatio. Recall that whe multiplyig two matrices, A = a i j ad B = b jk, the resultig matrix C = c ik is give by c ik = a i j b jk. j I the case of multiplyig together two by matrices, this gives us a Θ( 3 ) algorithm; computig each c ik takes Θ() time, ad there are 2 etries to compute. Let us agai try to divide up the problem. We ca break each matrix ito four submatrices, each of size /2 by /2. Multiplyig the origial matrices ca be broke dow ito eight multiplicatios of the submatrices, with some additios. A C B D E G F H = AE + BG CE + DG AF + BH CF + DH Lettig T () be the time to multiply together two by matrices by this algorithm, we have T () = 8T (/2)+ Θ( 2 ). Ufortuately, this does ot improve the ruig time; it is still Θ( 3 ). As i the case of multiplyig itegers, we have to be a little tricky to speed up matrix multiplicatio. (Strasse deserves a great deal of credit for comig up with this trick!) We compute the followig seve products: P 1 = A(F H) P 2 = (A + B)H P 3 = (C + D)E P 4 = D(G E) P 5 = (A + D)(E + H) P 6 = (B D)(G + H) P 7 = (A C)(E + F) The we ca fid the appropriate terms of the product by additio: AE + BG = P 5 + P 4 P 2 + P 6

4 Lecture AF + BH = P 1 + P 2 CE + DG = P 3 + P 4 CF + DH = P 5 + P 1 P 3 P 7 Now we have T () = 7T (/2) + Θ( 2 ), which give a ruig time of T () = Θ( log7 ). Faster algorithms requirig more complex splits exist; however, they are geerally too slow to be useful i practice. Strasse s algorithm, however, ca improve the stadard matrix multiplicatio algorithm for reasoably sized matrices, as we will see i our secod programmig assigmet. FFT We will ow cosider aother divide ad coquer algorithm, the Fast Fourier trasform (FFT). The Fast Fourier trasform is a classic algorithm that has prove icredibly useful across a wide spectrum of applicatios, ad as such remais i widespread use today. The algorithm is based o a clever idea that is worth emphasizig before we begi. The key poit is that it is very importat to cosider how to represet your data. I this case, he key to the Fast Fourier trasform is a exceedigly clever ad o-ituitive represetatio of polyomials. To motivate the FFT, suppose we are keepig track of traffic low alog a highway. We have a hardware device that samples the traffic every five miutes. That is, it outputs the umber of cars that have passed i the last five miutes at five miute itervals. Let us call these samples a 0,a 1,a 2,... We may wat to keep a ruig average of the traffic over the last half a hour. I that case, we would wat to compute +5 1 i= 6 a i. Alteratively, we may wat to keep a weighted average of the traffic over the last half a hour. If we are judgig traffic flow, it makes sese that the last five miutes are perhaps more importat tha a whole half hour ago. At the same time, it would be a mistake to discout the previous iformatio etirely; if we look oly at five miute itervals, we might overreact to radom traffic fluctuatios. Suppose we use weightig coefficiets b 0,b 1,...,b 5. The most recet time iterval will be weight by b 0, ad so o. The after a is output we wish to compute the weighted average c give by c = 5 b 0 a i.

5 Lecture This sum of products should look familiar. It is the coefficiet of x 5 i the product of ( 5 )( 5 a i x i b i x ). i Ideed, more geerally, if we look at the various coefficiets of we ca obtai several values of c at oce. ( i)( k 5 i x b i x ), a i This sort of processig occurs ofte, especially i digital sigal processig. With this motivatio, we see that it is of great iterest to compute the product of two give polyomials extremely quickly. We therefore focus o determiig a efficiet algorithm for multiplyig two polyomials. That is, give A(x) ad B(x), we wish to compute the coefficiets of C(x) = A(x)B(x). Without loss of geerality, we will assume that C has degree 1, where is a power of 2. Also, we will thik of A ad B of also beig degree 1; the coefficiets of some terms of A ad B will just be 0. It is clear that we ca compute the coefficiets of C i time Θ( 2 ) usig the stadard algorithm. But ca we do better? Thus far, we have bee thikig of a polyomial as beig represeted by its coefficiets. We thik of the polyomial A(x) as A(x) = 1 t=0 a tx t. But there are other ways to represet a polyomial. I particular, a polyomial of degree 1 is completely defied by poits. For example, a lie (a polyomial of degree oe) is defied by ay two poits it passes through; a quadratic is defied by ay three poits it passes through. Thus, istead of represetig A(x) by the sequece of coefficiets (a 0,a 1,...,a 1 ) (call this the coefficiet represetatio), we could represet it by the sequece of values at poits x 0,x 1,x 2,...,x 1, amely (A(x 0 ),A(x 1 ),A(x 2 ),...,A(x 1 )) (call this the poit represetatio). Now multiplyig is easy i the poit represetatio: we ca compute C(x i ) = A(x i ) B(x i ). Sice to represet the polyomial C uiquely we will eed to evaluate C at poits, we must have A ad B evaluated at poits. But assumig that we use this represetatio, we ca multiply A(x) ad B(x) with just O() multiplicatios! The problem is that we may ot wat to keep the polyomial i the poit represetatio. For example, it is hard to evaluate C at ay ew poits whe we represet it i this way, while this is a straightforward operatio i the coefficiet represetatio. Also, as we saw i our motivatio sectio, we actually wat as output the coefficiets of C. Agai, we see that differet represetatios are useful i differet situatios! What we really wat ow is a quick way to move back ad forth betwee these two represetatios. I geeral, goig back ad forth betwee the two represetatios is ot apparetly quicker tha Ω( 2 ). To do

6 Lecture better, we eed to be eve trickier. We must carefully choose which poits to use i the poit represetatio. By choosig these poits cleverly, we will be able to move back ad forth betwee represetatios i time O(log). The right poits to evaluate A ad B at tur out to be the solutios to x = 1. These solutios are the called the th roots of uity. Now, i the real umbers, of course, there are oly 2 solutios to this equatio, amely 1 ad 1. I the complex umbers, however, there are 2 differet solutios. I fact, these solutios are all powers of a geerator w, so the solutios ca be writte as w,w 2,w 3,...,w 1,w = 1. Note also that w /2 = 1! Fially, a very importat fact is that for all roots w i other tha 1, whe we add its powers 1 + w i + w 2i +...w ( 1)i, we must get 0. This is because (1 + w i + w 2i +...w ( 1)i ) (1 w i ) = 1 w i = 1 (w ) i = 0. Sice the first term i the product is ot 0 (as log as w i 1), the first term is. (Iterestigly, we do ot eve have to work over complex umbers we ca work over other mathematical structures, such as fiite fields. The poit is we just eed a geerator a w with w = 1, such that w k 1 for ay k with 1 k <.) We ow wat to fid a fast way to compute the values A(w j 1 ) = a i w i j, j = 0,..., 1. It turs out we ca use a divide ad coquer scheme. We divide the coefficiets of A ito two subsequeces: the eve subsequece a 0,a 2,... ad the odd subsequece a 1,a 3,... The A(w j ) = = a 2i w 2i j + a 2i (w 2 ) i j + w j 2i j+ j a 2i+1 w = E((w 2 ) j ) + w j O((w 2 ) j ) a 2i+1 (w 2 ) i j Now we have reduced the problem of computig A(w j ) to computig two smaller problems of size /2 of the same kid amely computig E(w j 2 ) ad O(w j 2 ), where w 2 = w 2! Notice that this recursio will work because 1,w 2,w 4,..., which are the poits where we will compute O ad E, are /2d roots of uity. (Agai, ote that there are /2 poits; we have ideed reduced to the problem to two subproblems of half the size.) To obtai A(w j ) from the subproblems, we do a multiply (by w j ) ad a additio. This is stadard divide ad coquer, with the recurrece: T () = 2T ( 2 ) + c,

7 Lecture where the work liear i comes from puttig the parts back together via multiplicatios ad additios. Of course we immediately have T () = O(log). This process is kow as the Fast Fourier Trasform, or FFT. (Aside: Aother way of expressig this is we wat to compute A(x) at the roots of uity. Note that A(x) = A 0 (x 2 ) + xa 1 (x 2 ) where A 0 is the polyomial with the eve coefficiets ad A 1 is the polyomial with the odd coefficiets. We eed to fid A 0 ad A 1 at the poits 1,w 2,w 4,... = 1,v,v 2,... where v is a (/2)d root of uity. This gives us the recursio above. ) We ve show how to go quickly from the coefficiet represetatio to a poit represetatio. How do we go back? Amazigly, this ca be doe with aother FFT! We start with a poit represetatio (C(1),C(w),C(w 2 ),...,C(w 1 )). To ivert, we thik of these values as coefficiets! (This is a tricky thought!) The we do a FFT o these coefficiets, usig w 1 istead of w i the FFT. The jth value we obtai is 1 C(w i )w i j = = 1 1 ( k=0 1 k=0 1 c k ( c k w ik )w i j w i(k j) ). Now, cosider the ier sum i the last lie. If j ad k are the same, the ier sum is just. Otherwise, we get the sum of all the powers of w but we kow this sum equals 0! Hece we have 1 C(w i )w i j = c k, so doig this iverse FFT returs to us the proper coefficiets (scaled up by a factor of ). To summarize, to multiply two polyomials A ad B i O(log) time, we do the followig: We first compute the FFT o the coefficiets (a 0,a 1,...,a 1 ) for A, ad similarly for B. This puts us i the poit represetatio. We compute C(w i ) = A(w i ) B(w i ) for i = 0,..., 1. Note that these are multiplicatos o complex umbers! We treat (C(w 0 ),C(w 1 ),...,C(w 1 )) as coefficiets, ad by computig the iverse FFT (usig w 1!) ad dividig the results by, we obtai the coefficiet represetatio (c 0,c 1,...,c 1 ).

Divide and Conquer, Solving Recurrences, Integer Multiplication Scribe: Juliana Cook (2015), V. Williams Date: April 6, 2016

Divide and Conquer, Solving Recurrences, Integer Multiplication Scribe: Juliana Cook (2015), V. Williams Date: April 6, 2016 CS 6, Lecture 3 Divide ad Coquer, Solvig Recurreces, Iteger Multiplicatio Scribe: Juliaa Cook (05, V Williams Date: April 6, 06 Itroductio Today we will cotiue to talk about divide ad coquer, ad go ito

More information

+ 1= x + 1. These 4 elements form a field.

+ 1= x + 1. These 4 elements form a field. Itroductio to fiite fields II Fiite field of p elemets F Because we are iterested i doig computer thigs it would be useful for us to costruct fields havig elemets. Let s costruct a field of elemets; we

More information

Solving Divide-and-Conquer Recurrences

Solving Divide-and-Conquer Recurrences Solvig Divide-ad-Coquer Recurreces Victor Adamchik A divide-ad-coquer algorithm cosists of three steps: dividig a problem ito smaller subproblems solvig (recursively) each subproblem the combiig solutios

More information

Soving Recurrence Relations

Soving Recurrence Relations Sovig Recurrece Relatios Part 1. Homogeeous liear 2d degree relatios with costat coefficiets. Cosider the recurrece relatio ( ) T () + at ( 1) + bt ( 2) = 0 This is called a homogeeous liear 2d degree

More information

Recursion and Recurrences

Recursion and Recurrences Chapter 5 Recursio ad Recurreces 5.1 Growth Rates of Solutios to Recurreces Divide ad Coquer Algorithms Oe of the most basic ad powerful algorithmic techiques is divide ad coquer. Cosider, for example,

More information

Handout: How to calculate time complexity? CSE 101 Winter 2014

Handout: How to calculate time complexity? CSE 101 Winter 2014 Hadout: How to calculate time complexity? CSE 101 Witer 014 Recipe (a) Kow algorithm If you are usig a modied versio of a kow algorithm, you ca piggyback your aalysis o the complexity of the origial algorithm

More information

Fourier Series and the Wave Equation Part 2

Fourier Series and the Wave Equation Part 2 Fourier Series ad the Wave Equatio Part There are two big ideas i our work this week. The first is the use of liearity to break complicated problems ito simple pieces. The secod is the use of the symmetries

More information

The second difference is the sequence of differences of the first difference sequence, 2

The second difference is the sequence of differences of the first difference sequence, 2 Differece Equatios I differetial equatios, you look for a fuctio that satisfies ad equatio ivolvig derivatives. I differece equatios, istead of a fuctio of a cotiuous variable (such as time), we look for

More information

ORDERS OF GROWTH KEITH CONRAD

ORDERS OF GROWTH KEITH CONRAD ORDERS OF GROWTH KEITH CONRAD Itroductio Gaiig a ituitive feel for the relative growth of fuctios is importat if you really wat to uderstad their behavior It also helps you better grasp topics i calculus

More information

Cooley-Tukey. Tukey FFT Algorithms. FFT Algorithms. Cooley

Cooley-Tukey. Tukey FFT Algorithms. FFT Algorithms. Cooley Cooley Cooley-Tuey Tuey FFT Algorithms FFT Algorithms Cosider a legth- sequece x[ with a -poit DFT X[ where Represet the idices ad as +, +, Cooley Cooley-Tuey Tuey FFT Algorithms FFT Algorithms Usig these

More information

Lecture Notes CMSC 251

Lecture Notes CMSC 251 We have this messy summatio to solve though First observe that the value remais costat throughout the sum, ad so we ca pull it out frot Also ote that we ca write 3 i / i ad (3/) i T () = log 3 (log ) 1

More information

8.3 POLAR FORM AND DEMOIVRE S THEOREM

8.3 POLAR FORM AND DEMOIVRE S THEOREM SECTION 8. POLAR FORM AND DEMOIVRE S THEOREM 48 8. POLAR FORM AND DEMOIVRE S THEOREM Figure 8.6 (a, b) b r a 0 θ Complex Number: a + bi Rectagular Form: (a, b) Polar Form: (r, θ) At this poit you ca add,

More information

Sequences and Series

Sequences and Series CHAPTER 9 Sequeces ad Series 9.. Covergece: Defiitio ad Examples Sequeces The purpose of this chapter is to itroduce a particular way of geeratig algorithms for fidig the values of fuctios defied by their

More information

In nite Sequences. Dr. Philippe B. Laval Kennesaw State University. October 9, 2008

In nite Sequences. Dr. Philippe B. Laval Kennesaw State University. October 9, 2008 I ite Sequeces Dr. Philippe B. Laval Keesaw State Uiversity October 9, 2008 Abstract This had out is a itroductio to i ite sequeces. mai de itios ad presets some elemetary results. It gives the I ite Sequeces

More information

Chapter Gaussian Elimination

Chapter Gaussian Elimination Chapter 04.06 Gaussia Elimiatio After readig this chapter, you should be able to:. solve a set of simultaeous liear equatios usig Naïve Gauss elimiatio,. lear the pitfalls of the Naïve Gauss elimiatio

More information

Lecture 4: Cauchy sequences, Bolzano-Weierstrass, and the Squeeze theorem

Lecture 4: Cauchy sequences, Bolzano-Weierstrass, and the Squeeze theorem Lecture 4: Cauchy sequeces, Bolzao-Weierstrass, ad the Squeeze theorem The purpose of this lecture is more modest tha the previous oes. It is to state certai coditios uder which we are guarateed that limits

More information

Searching Algorithm Efficiencies

Searching Algorithm Efficiencies Efficiecy of Liear Search Searchig Algorithm Efficiecies Havig implemeted the liear search algorithm, how would you measure its efficiecy? A useful measure (or metric) should be geeral, applicable to ay

More information

Page 2 of 14 = T(-2) + 2 = [ T(-3)+1 ] + 2 Substitute T(-3)+1 for T(-2) = T(-3) + 3 = [ T(-4)+1 ] + 3 Substitute T(-4)+1 for T(-3) = T(-4) + 4 After i

Page 2 of 14 = T(-2) + 2 = [ T(-3)+1 ] + 2 Substitute T(-3)+1 for T(-2) = T(-3) + 3 = [ T(-4)+1 ] + 3 Substitute T(-4)+1 for T(-3) = T(-4) + 4 After i Page 1 of 14 Search C455 Chapter 4 - Recursio Tree Documet last modified: 02/09/2012 18:42:34 Uses: Use recursio tree to determie a good asymptotic boud o the recurrece T() = Sum the costs withi each level

More information

Section IV.5: Recurrence Relations from Algorithms

Section IV.5: Recurrence Relations from Algorithms Sectio IV.5: Recurrece Relatios from Algorithms Give a recursive algorithm with iput size, we wish to fid a Θ (best big O) estimate for its ru time T() either by obtaiig a explicit formula for T() or by

More information

Module 4: Mathematical Induction

Module 4: Mathematical Induction Module 4: Mathematical Iductio Theme 1: Priciple of Mathematical Iductio Mathematical iductio is used to prove statemets about atural umbers. As studets may remember, we ca write such a statemet as a predicate

More information

1. MATHEMATICAL INDUCTION

1. MATHEMATICAL INDUCTION 1. MATHEMATICAL INDUCTION EXAMPLE 1: Prove that for ay iteger 1. Proof: 1 + 2 + 3 +... + ( + 1 2 (1.1 STEP 1: For 1 (1.1 is true, sice 1 1(1 + 1. 2 STEP 2: Suppose (1.1 is true for some k 1, that is 1

More information

13 Fast Fourier Transform (FFT)

13 Fast Fourier Transform (FFT) 13 Fast Fourier Trasform FFT) The fast Fourier trasform FFT) is a algorithm for the efficiet implemetatio of the discrete Fourier trasform. We begi our discussio oce more with the cotiuous Fourier trasform.

More information

The Field of Complex Numbers

The Field of Complex Numbers The Field of Complex Numbers S. F. Ellermeyer The costructio of the system of complex umbers begis by appedig to the system of real umbers a umber which we call i with the property that i = 1. (Note that

More information

SECTION 1.5 : SUMMATION NOTATION + WORK WITH SEQUENCES

SECTION 1.5 : SUMMATION NOTATION + WORK WITH SEQUENCES SECTION 1.5 : SUMMATION NOTATION + WORK WITH SEQUENCES Read Sectio 1.5 (pages 5 9) Overview I Sectio 1.5 we lear to work with summatio otatio ad formulas. We will also itroduce a brief overview of sequeces,

More information

Example 2 Find the square root of 0. The only square root of 0 is 0 (since 0 is not positive or negative, so those choices don t exist here).

Example 2 Find the square root of 0. The only square root of 0 is 0 (since 0 is not positive or negative, so those choices don t exist here). BEGINNING ALGEBRA Roots ad Radicals (revised summer, 00 Olso) Packet to Supplemet the Curret Textbook - Part Review of Square Roots & Irratioals (This portio ca be ay time before Part ad should mostly

More information

CS103A Handout 23 Winter 2002 February 22, 2002 Solving Recurrence Relations

CS103A Handout 23 Winter 2002 February 22, 2002 Solving Recurrence Relations CS3A Hadout 3 Witer 00 February, 00 Solvig Recurrece Relatios Itroductio A wide variety of recurrece problems occur i models. Some of these recurrece relatios ca be solved usig iteratio or some other ad

More information

Trigonometric Form of a Complex Number. The Complex Plane. axis. ( 2, 1) or 2 i FIGURE 6.44. The absolute value of the complex number z a bi is

Trigonometric Form of a Complex Number. The Complex Plane. axis. ( 2, 1) or 2 i FIGURE 6.44. The absolute value of the complex number z a bi is 0_0605.qxd /5/05 0:45 AM Page 470 470 Chapter 6 Additioal Topics i Trigoometry 6.5 Trigoometric Form of a Complex Number What you should lear Plot complex umbers i the complex plae ad fid absolute values

More information

NPTEL STRUCTURAL RELIABILITY

NPTEL STRUCTURAL RELIABILITY NPTEL Course O STRUCTURAL RELIABILITY Module # 0 Lecture 1 Course Format: Web Istructor: Dr. Aruasis Chakraborty Departmet of Civil Egieerig Idia Istitute of Techology Guwahati 1. Lecture 01: Basic Statistics

More information

Learning outcomes. Algorithms and Data Structures. Time Complexity Analysis. Time Complexity Analysis How fast is the algorithm? Prof. Dr.

Learning outcomes. Algorithms and Data Structures. Time Complexity Analysis. Time Complexity Analysis How fast is the algorithm? Prof. Dr. Algorithms ad Data Structures Algorithm efficiecy Learig outcomes Able to carry out simple asymptotic aalysisof algorithms Prof. Dr. Qi Xi 2 Time Complexity Aalysis How fast is the algorithm? Code the

More information

Fast Fourier Transform

Fast Fourier Transform 18.310 lecture otes November 18, 2013 Fast Fourier Trasform Lecturer: Michel Goemas I these otes we defie the Discrete Fourier Trasform, ad give a method for computig it fast: the Fast Fourier Trasform.

More information

Here are a couple of warnings to my students who may be here to get a copy of what happened on a day that you missed.

Here are a couple of warnings to my students who may be here to get a copy of what happened on a day that you missed. This documet was writte ad copyrighted by Paul Dawkis. Use of this documet ad its olie versio is govered by the Terms ad Coditios of Use located at http://tutorial.math.lamar.edu/terms.asp. The olie versio

More information

when n = 1, 2, 3, 4, 5, 6, This list represents the amount of dollars you have after n days. Note: The use of is read as and so on.

when n = 1, 2, 3, 4, 5, 6, This list represents the amount of dollars you have after n days. Note: The use of is read as and so on. Geometric eries Before we defie what is meat by a series, we eed to itroduce a related topic, that of sequeces. Formally, a sequece is a fuctio that computes a ordered list. uppose that o day 1, you have

More information

THE ARITHMETIC OF INTEGERS. - multiplication, exponentiation, division, addition, and subtraction

THE ARITHMETIC OF INTEGERS. - multiplication, exponentiation, division, addition, and subtraction THE ARITHMETIC OF INTEGERS - multiplicatio, expoetiatio, divisio, additio, ad subtractio What to do ad what ot to do. THE INTEGERS Recall that a iteger is oe of the whole umbers, which may be either positive,

More information

{{1}, {2, 4}, {3}} {{1, 3, 4}, {2}} {{1}, {2}, {3, 4}} 5.4 Stirling Numbers

{{1}, {2, 4}, {3}} {{1, 3, 4}, {2}} {{1}, {2}, {3, 4}} 5.4 Stirling Numbers . Stirlig Numbers Whe coutig various types of fuctios from., we quicly discovered that eumeratig the umber of oto fuctios was a difficult problem. For a domai of five elemets ad a rage of four elemets,

More information

S. Tanny MAT 344 Spring 1999. be the minimum number of moves required.

S. Tanny MAT 344 Spring 1999. be the minimum number of moves required. S. Tay MAT 344 Sprig 999 Recurrece Relatios Tower of Haoi Let T be the miimum umber of moves required. T 0 = 0, T = 7 Iitial Coditios * T = T + $ T is a sequece (f. o itegers). Solve for T? * is a recurrece,

More information

Sequences II. Chapter 3. 3.1 Convergent Sequences

Sequences II. Chapter 3. 3.1 Convergent Sequences Chapter 3 Sequeces II 3. Coverget Sequeces Plot a graph of the sequece a ) = 2, 3 2, 4 3, 5 + 4,...,,... To what limit do you thik this sequece teds? What ca you say about the sequece a )? For ǫ = 0.,

More information

Gregory Carey, 1998 Linear Transformations & Composites - 1. Linear Transformations and Linear Composites

Gregory Carey, 1998 Linear Transformations & Composites - 1. Linear Transformations and Linear Composites Gregory Carey, 1998 Liear Trasformatios & Composites - 1 Liear Trasformatios ad Liear Composites I Liear Trasformatios of Variables Meas ad Stadard Deviatios of Liear Trasformatios A liear trasformatio

More information

ARITHMETIC AND GEOMETRIC PROGRESSIONS

ARITHMETIC AND GEOMETRIC PROGRESSIONS Arithmetic Ad Geometric Progressios Sequeces Ad ARITHMETIC AND GEOMETRIC PROGRESSIONS Successio of umbers of which oe umber is desigated as the first, other as the secod, aother as the third ad so o gives

More information

CS103X: Discrete Structures Homework 4 Solutions

CS103X: Discrete Structures Homework 4 Solutions CS103X: Discrete Structures Homewor 4 Solutios Due February 22, 2008 Exercise 1 10 poits. Silico Valley questios: a How may possible six-figure salaries i whole dollar amouts are there that cotai at least

More information

1 The Binomial Theorem: Another Approach

1 The Binomial Theorem: Another Approach The Biomial Theorem: Aother Approach Pascal s Triagle I class (ad i our text we saw that, for iteger, the biomial theorem ca be stated (a + b = c a + c a b + c a b + + c ab + c b, where the coefficiets

More information

A probabilistic proof of a binomial identity

A probabilistic proof of a binomial identity A probabilistic proof of a biomial idetity Joatho Peterso Abstract We give a elemetary probabilistic proof of a biomial idetity. The proof is obtaied by computig the probability of a certai evet i two

More information

Linear Algebra II. 4 Determinants. Notes 4 1st November Definition of determinant

Linear Algebra II. 4 Determinants. Notes 4 1st November Definition of determinant MTH6140 Liear Algebra II Notes 4 1st November 2010 4 Determiats The determiat is a fuctio defied o square matrices; its value is a scalar. It has some very importat properties: perhaps most importat is

More information

Math 475, Problem Set #6: Solutions

Math 475, Problem Set #6: Solutions Math 475, Problem Set #6: Solutios A (a) For each poit (a, b) with a, b o-egative itegers satisfyig ab 8, cout the paths from (0,0) to (a, b) where the legal steps from (i, j) are to (i 2, j), (i, j 2),

More information

COMP 251 Assignment 2 Solutions

COMP 251 Assignment 2 Solutions COMP 251 Assigmet 2 Solutios Questio 1 Exercise 8.3-4 Treat the umbers as 2-digit umbers i radix. Each digit rages from 0 to 1. Sort these 2-digit umbers ith the RADIX-SORT algorithm preseted i Sectio

More information

Chapter 5: Inner Product Spaces

Chapter 5: Inner Product Spaces Chapter 5: Ier Product Spaces Chapter 5: Ier Product Spaces SECION A Itroductio to Ier Product Spaces By the ed of this sectio you will be able to uderstad what is meat by a ier product space give examples

More information

Math Discrete Math Combinatorics MULTIPLICATION PRINCIPLE:

Math Discrete Math Combinatorics MULTIPLICATION PRINCIPLE: Math 355 - Discrete Math 4.1-4.4 Combiatorics Notes MULTIPLICATION PRINCIPLE: If there m ways to do somethig ad ways to do aother thig the there are m ways to do both. I the laguage of set theory: Let

More information

Literal Equations and Formulas

Literal Equations and Formulas . Literal Equatios ad Formulas. OBJECTIVE 1. Solve a literal equatio for a specified variable May problems i algebra require the use of formulas for their solutio. Formulas are simply equatios that express

More information

Lesson 12. Sequences and Series

Lesson 12. Sequences and Series Retur to List of Lessos Lesso. Sequeces ad Series A ifiite sequece { a, a, a,... a,...} ca be thought of as a list of umbers writte i defiite order ad certai patter. It is usually deoted by { a } =, or

More information

Properties of MLE: consistency, asymptotic normality. Fisher information.

Properties of MLE: consistency, asymptotic normality. Fisher information. Lecture 3 Properties of MLE: cosistecy, asymptotic ormality. Fisher iformatio. I this sectio we will try to uderstad why MLEs are good. Let us recall two facts from probability that we be used ofte throughout

More information

1.3 Binomial Coefficients

1.3 Binomial Coefficients 18 CHAPTER 1. COUNTING 1. Biomial Coefficiets I this sectio, we will explore various properties of biomial coefficiets. Pascal s Triagle Table 1 cotais the values of the biomial coefficiets ( ) for 0to

More information

Algorithms and Data Structures DV3. Arne Andersson

Algorithms and Data Structures DV3. Arne Andersson Algorithms ad Data Structures DV3 Are Adersso Today s lectures Textbook chapters 1-4, 5 Iformatiostekologi Itroductio Overview of Algorithmic Mathematics Recurreces Itroductio to Recurreces The Substitutio

More information

THE REGRESSION MODEL IN MATRIX FORM. For simple linear regression, meaning one predictor, the model is. for i = 1, 2, 3,, n

THE REGRESSION MODEL IN MATRIX FORM. For simple linear regression, meaning one predictor, the model is. for i = 1, 2, 3,, n We will cosider the liear regressio model i matrix form. For simple liear regressio, meaig oe predictor, the model is i = + x i + ε i for i =,,,, This model icludes the assumptio that the ε i s are a sample

More information

arxiv:1012.1336v2 [cs.cc] 8 Dec 2010

arxiv:1012.1336v2 [cs.cc] 8 Dec 2010 Uary Subset-Sum is i Logspace arxiv:1012.1336v2 [cs.cc] 8 Dec 2010 1 Itroductio Daiel M. Kae December 9, 2010 I this paper we cosider the Uary Subset-Sum problem which is defied as follows: Give itegers

More information

7. Sample Covariance and Correlation

7. Sample Covariance and Correlation 1 of 8 7/16/2009 6:06 AM Virtual Laboratories > 6. Radom Samples > 1 2 3 4 5 6 7 7. Sample Covariace ad Correlatio The Bivariate Model Suppose agai that we have a basic radom experimet, ad that X ad Y

More information

A Gentle Introduction to Algorithms: Part II

A Gentle Introduction to Algorithms: Part II A Getle Itroductio to Algorithms: Part II Cotets of Part I:. Merge: (to merge two sorted lists ito a sigle sorted list.) 2. Bubble Sort 3. Merge Sort: 4. The Big-O, Big-Θ, Big-Ω otatios: asymptotic bouds

More information

WHEN IS THE (CO)SINE OF A RATIONAL ANGLE EQUAL TO A RATIONAL NUMBER?

WHEN IS THE (CO)SINE OF A RATIONAL ANGLE EQUAL TO A RATIONAL NUMBER? WHEN IS THE (CO)SINE OF A RATIONAL ANGLE EQUAL TO A RATIONAL NUMBER? JÖRG JAHNEL 1. My Motivatio Some Sort of a Itroductio Last term I tought Topological Groups at the Göttige Georg August Uiversity. This

More information

Infinite Sequences and Series

Infinite Sequences and Series CHAPTER 4 Ifiite Sequeces ad Series 4.1. Sequeces A sequece is a ifiite ordered list of umbers, for example the sequece of odd positive itegers: 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29...

More information

A Resource for Free-standing Mathematics Qualifications Working with %

A Resource for Free-standing Mathematics Qualifications Working with % Ca you aswer these questios? A savigs accout gives % iterest per aum.. If 000 is ivested i this accout, how much will be i the accout at the ed of years? A ew car costs 16 000 ad its value falls by 1%

More information

6 Algorithm analysis

6 Algorithm analysis 6 Algorithm aalysis Geerally, a algorithm has three cases Best case Average case Worse case. To demostrate, let us cosider the a really simple search algorithm which searches for k i the set A{a 1 a...

More information

4.1 Sigma Notation and Riemann Sums

4.1 Sigma Notation and Riemann Sums 0 the itegral. Sigma Notatio ad Riema Sums Oe strategy for calculatig the area of a regio is to cut the regio ito simple shapes, calculate the area of each simple shape, ad the add these smaller areas

More information

8.5 Alternating infinite series

8.5 Alternating infinite series 65 8.5 Alteratig ifiite series I the previous two sectios we cosidered oly series with positive terms. I this sectio we cosider series with both positive ad egative terms which alterate: positive, egative,

More information

.04. This means $1000 is multiplied by 1.02 five times, once for each of the remaining sixmonth

.04. This means $1000 is multiplied by 1.02 five times, once for each of the remaining sixmonth Questio 1: What is a ordiary auity? Let s look at a ordiary auity that is certai ad simple. By this, we mea a auity over a fixed term whose paymet period matches the iterest coversio period. Additioally,

More information

Confidence Intervals for One Mean

Confidence Intervals for One Mean Chapter 420 Cofidece Itervals for Oe Mea Itroductio This routie calculates the sample size ecessary to achieve a specified distace from the mea to the cofidece limit(s) at a stated cofidece level for a

More information

Equation of a line. Line in coordinate geometry. Slope-intercept form ( 斜 截 式 ) Intercept form ( 截 距 式 ) Point-slope form ( 點 斜 式 )

Equation of a line. Line in coordinate geometry. Slope-intercept form ( 斜 截 式 ) Intercept form ( 截 距 式 ) Point-slope form ( 點 斜 式 ) Chapter : Liear Equatios Chapter Liear Equatios Lie i coordiate geometr I Cartesia coordiate sstems ( 卡 笛 兒 坐 標 系 統 ), a lie ca be represeted b a liear equatio, i.e., a polomial with degree. But before

More information

represented by 4! different arrangements of boxes, divide by 4! to get ways

represented by 4! different arrangements of boxes, divide by 4! to get ways Problem Set #6 solutios A juggler colors idetical jugglig balls red, white, ad blue (a I how may ways ca this be doe if each color is used at least oce? Let us preemptively color oe ball i each color,

More information

FIBONACCI NUMBERS: AN APPLICATION OF LINEAR ALGEBRA. 1. Powers of a matrix

FIBONACCI NUMBERS: AN APPLICATION OF LINEAR ALGEBRA. 1. Powers of a matrix FIBONACCI NUMBERS: AN APPLICATION OF LINEAR ALGEBRA. Powers of a matrix We begi with a propositio which illustrates the usefuless of the diagoalizatio. Recall that a square matrix A is diogaalizable if

More information

Department of Computer Science, University of Otago

Department of Computer Science, University of Otago Departmet of Computer Sciece, Uiversity of Otago Techical Report OUCS-2006-09 Permutatios Cotaiig May Patters Authors: M.H. Albert Departmet of Computer Sciece, Uiversity of Otago Micah Colema, Rya Fly

More information

Geometric Sequences and Series. Geometric Sequences. Definition of Geometric Sequence. such that. a2 4

Geometric Sequences and Series. Geometric Sequences. Definition of Geometric Sequence. such that. a2 4 3330_0903qxd /5/05 :3 AM Page 663 Sectio 93 93 Geometric Sequeces ad Series 663 Geometric Sequeces ad Series What you should lear Recogize, write, ad fid the th terms of geometric sequeces Fid th partial

More information

Basic Elements of Arithmetic Sequences and Series

Basic Elements of Arithmetic Sequences and Series MA40S PRE-CALCULUS UNIT G GEOMETRIC SEQUENCES CLASS NOTES (COMPLETED NO NEED TO COPY NOTES FROM OVERHEAD) Basic Elemets of Arithmetic Sequeces ad Series Objective: To establish basic elemets of arithmetic

More information

3. Greatest Common Divisor - Least Common Multiple

3. Greatest Common Divisor - Least Common Multiple 3 Greatest Commo Divisor - Least Commo Multiple Defiitio 31: The greatest commo divisor of two atural umbers a ad b is the largest atural umber c which divides both a ad b We deote the greatest commo gcd

More information

DEFINITION OF INVERSE MATRIX

DEFINITION OF INVERSE MATRIX Lecture. Iverse matrix. To be read to the music of Back To You by Brya dams DEFINITION OF INVERSE TRIX Defiitio. Let is a square matrix. Some matrix B if it exists) is said to be iverse to if B B I where

More information

Review for College Algebra Final Exam

Review for College Algebra Final Exam Review for College Algebra Fial Exam (Please remember that half of the fial exam will cover chapters 1-4. This review sheet covers oly the ew material, from chapters 5 ad 7.) 5.1 Systems of equatios i

More information

B1. Fourier Analysis of Discrete Time Signals

B1. Fourier Analysis of Discrete Time Signals B. Fourier Aalysis of Discrete Time Sigals Objectives Itroduce discrete time periodic sigals Defie the Discrete Fourier Series (DFS) expasio of periodic sigals Defie the Discrete Fourier Trasform (DFT)

More information

x(x 1)(x 2)... (x k + 1) = [x] k n+m 1

x(x 1)(x 2)... (x k + 1) = [x] k n+m 1 1 Coutig mappigs For every real x ad positive iteger k, let [x] k deote the fallig factorial ad x(x 1)(x 2)... (x k + 1) ( ) x = [x] k k k!, ( ) k = 1. 0 I the sequel, X = {x 1,..., x m }, Y = {y 1,...,

More information

Running Time ( 3.1) Analysis of Algorithms. Experimental Studies ( 3.1.1) Limitations of Experiments. Pseudocode ( 3.1.2) Theoretical Analysis

Running Time ( 3.1) Analysis of Algorithms. Experimental Studies ( 3.1.1) Limitations of Experiments. Pseudocode ( 3.1.2) Theoretical Analysis Ruig Time ( 3.) Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects.

More information

NUMBERS COMMON TO TWO POLYGONAL SEQUENCES

NUMBERS COMMON TO TWO POLYGONAL SEQUENCES NUMBERS COMMON TO TWO POLYGONAL SEQUENCES DIANNE SMITH LUCAS Chia Lake, Califoria a iteger, The polygoal sequece (or sequeces of polygoal umbers) of order r (where r is r > 3) may be defied recursively

More information

Incremental calculation of weighted mean and variance

Incremental calculation of weighted mean and variance Icremetal calculatio of weighted mea ad variace Toy Fich faf@cam.ac.uk dot@dotat.at Uiversity of Cambridge Computig Service February 009 Abstract I these otes I eplai how to derive formulae for umerically

More information

BINOMIAL EXPANSIONS 12.5. In this section. Some Examples. Obtaining the Coefficients

BINOMIAL EXPANSIONS 12.5. In this section. Some Examples. Obtaining the Coefficients 652 (12-26) Chapter 12 Sequeces ad Series 12.5 BINOMIAL EXPANSIONS I this sectio Some Examples Otaiig the Coefficiets The Biomial Theorem I Chapter 5 you leared how to square a iomial. I this sectio you

More information

Convexity, Inequalities, and Norms

Convexity, Inequalities, and Norms Covexity, Iequalities, ad Norms Covex Fuctios You are probably familiar with the otio of cocavity of fuctios. Give a twicedifferetiable fuctio ϕ: R R, We say that ϕ is covex (or cocave up) if ϕ (x) 0 for

More information

1 Introduction to reducing variance in Monte Carlo simulations

1 Introduction to reducing variance in Monte Carlo simulations Copyright c 007 by Karl Sigma 1 Itroductio to reducig variace i Mote Carlo simulatios 11 Review of cofidece itervals for estimatig a mea I statistics, we estimate a uow mea µ = E(X) of a distributio by

More information

Math C067 Sampling Distributions

Math C067 Sampling Distributions Math C067 Samplig Distributios Sample Mea ad Sample Proportio Richard Beigel Some time betwee April 16, 2007 ad April 16, 2007 Examples of Samplig A pollster may try to estimate the proportio of voters

More information

7 b) 0. Guided Notes for lesson P.2 Properties of Exponents. If a, b, x, y and a, b, 0, and m, n Z then the following properties hold: 1 n b

7 b) 0. Guided Notes for lesson P.2 Properties of Exponents. If a, b, x, y and a, b, 0, and m, n Z then the following properties hold: 1 n b Guided Notes for lesso P. Properties of Expoets If a, b, x, y ad a, b, 0, ad m, Z the the followig properties hold:. Negative Expoet Rule: b ad b b b Aswers must ever cotai egative expoets. Examples: 5

More information

Confidence Intervals for One Mean with Tolerance Probability

Confidence Intervals for One Mean with Tolerance Probability Chapter 421 Cofidece Itervals for Oe Mea with Tolerace Probability Itroductio This procedure calculates the sample size ecessary to achieve a specified distace from the mea to the cofidece limit(s) with

More information

The geometric series and the ratio test

The geometric series and the ratio test The geometric series ad the ratio test Today we are goig to develop aother test for covergece based o the iterplay betwee the it compariso test we developed last time ad the geometric series. A ote about

More information

8.1 Arithmetic Sequences

8.1 Arithmetic Sequences MCR3U Uit 8: Sequeces & Series Page 1 of 1 8.1 Arithmetic Sequeces Defiitio: A sequece is a comma separated list of ordered terms that follow a patter. Examples: 1, 2, 3, 4, 5 : a sequece of the first

More information

Modified Line Search Method for Global Optimization

Modified Line Search Method for Global Optimization Modified Lie Search Method for Global Optimizatio Cria Grosa ad Ajith Abraham Ceter of Excellece for Quatifiable Quality of Service Norwegia Uiversity of Sciece ad Techology Trodheim, Norway {cria, ajith}@q2s.tu.o

More information

Solving equations. Pre-test. Warm-up

Solving equations. Pre-test. Warm-up Solvig equatios 8 Pre-test Warm-up We ca thik of a algebraic equatio as beig like a set of scales. The two sides of the equatio are equal, so the scales are balaced. If we add somethig to oe side of the

More information

Riemann Sums y = f (x)

Riemann Sums y = f (x) Riema Sums Recall that we have previously discussed the area problem I its simplest form we ca state it this way: The Area Problem Let f be a cotiuous, o-egative fuctio o the closed iterval [a, b] Fid

More information

Determining the sample size

Determining the sample size Determiig the sample size Oe of the most commo questios ay statisticia gets asked is How large a sample size do I eed? Researchers are ofte surprised to fid out that the aswer depeds o a umber of factors

More information

Lecture 2: Karger s Min Cut Algorithm

Lecture 2: Karger s Min Cut Algorithm priceto uiv. F 3 cos 5: Advaced Algorithm Desig Lecture : Karger s Mi Cut Algorithm Lecturer: Sajeev Arora Scribe:Sajeev Today s topic is simple but gorgeous: Karger s mi cut algorithm ad its extesio.

More information

1 Computing the Standard Deviation of Sample Means

1 Computing the Standard Deviation of Sample Means Computig the Stadard Deviatio of Sample Meas Quality cotrol charts are based o sample meas ot o idividual values withi a sample. A sample is a group of items, which are cosidered all together for our aalysis.

More information

4 n. n 1. You shold think of the Ratio Test as a generalization of the Geometric Series Test. For example, if a n ar n is a geometric sequence then

4 n. n 1. You shold think of the Ratio Test as a generalization of the Geometric Series Test. For example, if a n ar n is a geometric sequence then SECTION 2.6 THE RATIO TEST 79 2.6. THE RATIO TEST We ow kow how to hadle series which we ca itegrate (the Itegral Test), ad series which are similar to geometric or p-series (the Compariso Test), but of

More information

Chapter 6: Variance, the law of large numbers and the Monte-Carlo method

Chapter 6: Variance, the law of large numbers and the Monte-Carlo method Chapter 6: Variace, the law of large umbers ad the Mote-Carlo method Expected value, variace, ad Chebyshev iequality. If X is a radom variable recall that the expected value of X, E[X] is the average value

More information

Math Background: Review & Beyond. Design & Analysis of Algorithms COMP 482 / ELEC 420. Solving for Closed Forms. Obtaining Recurrences

Math Background: Review & Beyond. Design & Analysis of Algorithms COMP 482 / ELEC 420. Solving for Closed Forms. Obtaining Recurrences Math Backgroud: Review & Beyod. Asymptotic otatio Desig & Aalysis of Algorithms COMP 48 / ELEC 40 Joh Greier. Math used i asymptotics 3. Recurreces 4. Probabilistic aalysis To do: [CLRS] 4 # T() = O()

More information

Algebra Work Sheets. Contents

Algebra Work Sheets. Contents The work sheets are grouped accordig to math skill. Each skill is the arraged i a sequece of work sheets that build from simple to complex. Choose the work sheets that best fit the studet s eed ad will

More information

Factoring x n 1: cyclotomic and Aurifeuillian polynomials Paul Garrett <garrett@math.umn.edu>

Factoring x n 1: cyclotomic and Aurifeuillian polynomials Paul Garrett <garrett@math.umn.edu> (March 16, 004) Factorig x 1: cyclotomic ad Aurifeuillia polyomials Paul Garrett Polyomials of the form x 1, x 3 1, x 4 1 have at least oe systematic factorizatio x 1 = (x 1)(x 1

More information

1 Correlation and Regression Analysis

1 Correlation and Regression Analysis 1 Correlatio ad Regressio Aalysis I this sectio we will be ivestigatig the relatioship betwee two cotiuous variable, such as height ad weight, the cocetratio of a ijected drug ad heart rate, or the cosumptio

More information

Lesson 15 ANOVA (analysis of variance)

Lesson 15 ANOVA (analysis of variance) Outlie Variability -betwee group variability -withi group variability -total variability -F-ratio Computatio -sums of squares (betwee/withi/total -degrees of freedom (betwee/withi/total -mea square (betwee/withi

More information

Divergence of p 1/p. Adrian Dudek. adrian.dudek[at]anu.edu.au

Divergence of p 1/p. Adrian Dudek. adrian.dudek[at]anu.edu.au Divergece of / Adria Dudek adria.dudek[at]au.edu.au Whe I was i high school, my maths teacher cheekily told me that it s ossible to add u ifiitely may umbers ad get a fiite umber. She the illustrated this

More information