fast fourier transform
play

Fast Fourier Transform Lecture 23 November 17, 2015 Sariel (UIUC) - PowerPoint PPT Presentation

NEW CS 473: Theory II, Fall 2015 Fast Fourier Transform Lecture 23 November 17, 2015 Sariel (UIUC) New CS473 1 Fall 2015 1 / 38 23.1: Introduction Sariel (UIUC) New CS473 2 Fall 2015 2 / 38 Polynomials and point value pairs Some


  1. Which implies... p ( x ) and q ( x ) : point-value pairs = ⇒ compute 1 r ( x ) = p ( x ) q ( x ) in linear time! ...but r ( x ) is in point-value representation. Bummer. 2 ...but we can compute r ( x ) from this representation. 3 Purpose: Translate quickly (i.e., O ( n log n ) time) from the 4 standard r to point-value pairs representation of polynomials. ...and back! 5 = ⇒ computing product of two polynomials in O ( n log n ) 6 time. Fast Fourier Transform is a way to do this. 7 choosing the x i values carefully, and using divide and conquer. 8 Sariel (UIUC) New CS473 9 Fall 2015 9 / 38

  2. 23.2: Computing a polynomial quickly on n values Sariel (UIUC) New CS473 10 Fall 2015 10 / 38

  3. Computing a polynomial quickly on n values Lets just use some magic. Assume: polynomials have degree n − 1 , where n = 2 k . 1 .. pad polynomials with terms having zero coefficients. 2 Magic set of numbers: Ψ = { x 1 , . . . , x n } . 3 � x 2 � � � Property: | SQ (Ψ) | = n/ 2 , where SQ (Ψ) = � x ∈ Ψ . | square(Ψ) | = | Ψ | / 2 . 4 Easy to find such set... 5 Magic: Have this property repeatedly... 6 SQ ( SQ (Ψ)) has n/ 4 distinct values. SQ ( SQ ( SQ (Ψ))) has n/ 8 values. 7 SQ i (Ψ) has n/ 2 i distinct values. 8 Oops: No such set of real numbers. 9 10 NO SUCH SET. Sariel (UIUC) New CS473 11 Fall 2015 11 / 38

  4. Computing a polynomial quickly on n values Lets just use some magic. Assume: polynomials have degree n − 1 , where n = 2 k . 1 .. pad polynomials with terms having zero coefficients. 2 Magic set of numbers: Ψ = { x 1 , . . . , x n } . 3 � x 2 � � � Property: | SQ (Ψ) | = n/ 2 , where SQ (Ψ) = � x ∈ Ψ . | square(Ψ) | = | Ψ | / 2 . 4 Easy to find such set... 5 Magic: Have this property repeatedly... 6 SQ ( SQ (Ψ)) has n/ 4 distinct values. SQ ( SQ ( SQ (Ψ))) has n/ 8 values. 7 SQ i (Ψ) has n/ 2 i distinct values. 8 Oops: No such set of real numbers. 9 10 NO SUCH SET. Sariel (UIUC) New CS473 11 Fall 2015 11 / 38

  5. Computing a polynomial quickly on n values Lets just use some magic. Assume: polynomials have degree n − 1 , where n = 2 k . 1 .. pad polynomials with terms having zero coefficients. 2 Magic set of numbers: Ψ = { x 1 , . . . , x n } . 3 � x 2 � � � Property: | SQ (Ψ) | = n/ 2 , where SQ (Ψ) = � x ∈ Ψ . | square(Ψ) | = | Ψ | / 2 . 4 Easy to find such set... 5 Magic: Have this property repeatedly... 6 SQ ( SQ (Ψ)) has n/ 4 distinct values. SQ ( SQ ( SQ (Ψ))) has n/ 8 values. 7 SQ i (Ψ) has n/ 2 i distinct values. 8 Oops: No such set of real numbers. 9 10 NO SUCH SET. Sariel (UIUC) New CS473 11 Fall 2015 11 / 38

  6. Computing a polynomial quickly on n values Lets just use some magic. Assume: polynomials have degree n − 1 , where n = 2 k . 1 .. pad polynomials with terms having zero coefficients. 2 Magic set of numbers: Ψ = { x 1 , . . . , x n } . 3 � x 2 � � � Property: | SQ (Ψ) | = n/ 2 , where SQ (Ψ) = � x ∈ Ψ . | square(Ψ) | = | Ψ | / 2 . 4 Easy to find such set... 5 Magic: Have this property repeatedly... 6 SQ ( SQ (Ψ)) has n/ 4 distinct values. SQ ( SQ ( SQ (Ψ))) has n/ 8 values. 7 SQ i (Ψ) has n/ 2 i distinct values. 8 Oops: No such set of real numbers. 9 10 NO SUCH SET. Sariel (UIUC) New CS473 11 Fall 2015 11 / 38

  7. Computing a polynomial quickly on n values Lets just use some magic. Assume: polynomials have degree n − 1 , where n = 2 k . 1 .. pad polynomials with terms having zero coefficients. 2 Magic set of numbers: Ψ = { x 1 , . . . , x n } . 3 � x 2 � � � Property: | SQ (Ψ) | = n/ 2 , where SQ (Ψ) = � x ∈ Ψ . | square(Ψ) | = | Ψ | / 2 . 4 Easy to find such set... 5 Magic: Have this property repeatedly... 6 SQ ( SQ (Ψ)) has n/ 4 distinct values. SQ ( SQ ( SQ (Ψ))) has n/ 8 values. 7 SQ i (Ψ) has n/ 2 i distinct values. 8 Oops: No such set of real numbers. 9 10 NO SUCH SET. Sariel (UIUC) New CS473 11 Fall 2015 11 / 38

  8. Computing a polynomial quickly on n values Lets just use some magic. Assume: polynomials have degree n − 1 , where n = 2 k . 1 .. pad polynomials with terms having zero coefficients. 2 Magic set of numbers: Ψ = { x 1 , . . . , x n } . 3 � x 2 � � � Property: | SQ (Ψ) | = n/ 2 , where SQ (Ψ) = � x ∈ Ψ . | square(Ψ) | = | Ψ | / 2 . 4 Easy to find such set... 5 Magic: Have this property repeatedly... 6 SQ ( SQ (Ψ)) has n/ 4 distinct values. SQ ( SQ ( SQ (Ψ))) has n/ 8 values. 7 SQ i (Ψ) has n/ 2 i distinct values. 8 Oops: No such set of real numbers. 9 10 NO SUCH SET. Sariel (UIUC) New CS473 11 Fall 2015 11 / 38

  9. Computing a polynomial quickly on n values Lets just use some magic. Assume: polynomials have degree n − 1 , where n = 2 k . 1 .. pad polynomials with terms having zero coefficients. 2 Magic set of numbers: Ψ = { x 1 , . . . , x n } . 3 � x 2 � � � Property: | SQ (Ψ) | = n/ 2 , where SQ (Ψ) = � x ∈ Ψ . | square(Ψ) | = | Ψ | / 2 . 4 Easy to find such set... 5 Magic: Have this property repeatedly... 6 SQ ( SQ (Ψ)) has n/ 4 distinct values. SQ ( SQ ( SQ (Ψ))) has n/ 8 values. 7 SQ i (Ψ) has n/ 2 i distinct values. 8 Oops: No such set of real numbers. 9 10 NO SUCH SET. Sariel (UIUC) New CS473 11 Fall 2015 11 / 38

  10. Computing a polynomial quickly on n values Lets just use some magic. Assume: polynomials have degree n − 1 , where n = 2 k . 1 .. pad polynomials with terms having zero coefficients. 2 Magic set of numbers: Ψ = { x 1 , . . . , x n } . 3 � x 2 � � � Property: | SQ (Ψ) | = n/ 2 , where SQ (Ψ) = � x ∈ Ψ . | square(Ψ) | = | Ψ | / 2 . 4 Easy to find such set... 5 Magic: Have this property repeatedly... 6 SQ ( SQ (Ψ)) has n/ 4 distinct values. SQ ( SQ ( SQ (Ψ))) has n/ 8 values. 7 SQ i (Ψ) has n/ 2 i distinct values. 8 Oops: No such set of real numbers. 9 10 NO SUCH SET. Sariel (UIUC) New CS473 11 Fall 2015 11 / 38

  11. Computing a polynomial quickly on n values Lets just use some magic. Assume: polynomials have degree n − 1 , where n = 2 k . 1 .. pad polynomials with terms having zero coefficients. 2 Magic set of numbers: Ψ = { x 1 , . . . , x n } . 3 � x 2 � � � Property: | SQ (Ψ) | = n/ 2 , where SQ (Ψ) = � x ∈ Ψ . | square(Ψ) | = | Ψ | / 2 . 4 Easy to find such set... 5 Magic: Have this property repeatedly... 6 SQ ( SQ (Ψ)) has n/ 4 distinct values. SQ ( SQ ( SQ (Ψ))) has n/ 8 values. 7 SQ i (Ψ) has n/ 2 i distinct values. 8 Oops: No such set of real numbers. 9 10 NO SUCH SET. Sariel (UIUC) New CS473 11 Fall 2015 11 / 38

  12. Computing a polynomial quickly on n values Lets just use some magic. Assume: polynomials have degree n − 1 , where n = 2 k . 1 .. pad polynomials with terms having zero coefficients. 2 Magic set of numbers: Ψ = { x 1 , . . . , x n } . 3 � x 2 � � � Property: | SQ (Ψ) | = n/ 2 , where SQ (Ψ) = � x ∈ Ψ . | square(Ψ) | = | Ψ | / 2 . 4 Easy to find such set... 5 Magic: Have this property repeatedly... 6 SQ ( SQ (Ψ)) has n/ 4 distinct values. SQ ( SQ ( SQ (Ψ))) has n/ 8 values. 7 SQ i (Ψ) has n/ 2 i distinct values. 8 Oops: No such set of real numbers. 9 10 NO SUCH SET. Sariel (UIUC) New CS473 11 Fall 2015 11 / 38

  13. Computing a polynomial quickly on n values Lets just use some magic. Assume: polynomials have degree n − 1 , where n = 2 k . 1 .. pad polynomials with terms having zero coefficients. 2 Magic set of numbers: Ψ = { x 1 , . . . , x n } . 3 � x 2 � � � Property: | SQ (Ψ) | = n/ 2 , where SQ (Ψ) = � x ∈ Ψ . | square(Ψ) | = | Ψ | / 2 . 4 Easy to find such set... 5 Magic: Have this property repeatedly... 6 SQ ( SQ (Ψ)) has n/ 4 distinct values. SQ ( SQ ( SQ (Ψ))) has n/ 8 values. 7 SQ i (Ψ) has n/ 2 i distinct values. 8 Oops: No such set of real numbers. 9 10 NO SUCH SET. Sariel (UIUC) New CS473 11 Fall 2015 11 / 38

  14. Collapsible sets Assume magic... Let us for the time being ignore this technicality, and fly, for a moment, into the land of fantasy, and assume that we do have such a set of numbers, so that | SQ i (Ψ) | = n/ 2 i numbers, for i = 0 , . . . , k . Let us call such a set of numbers collapsible . Sariel (UIUC) New CS473 12 Fall 2015 12 / 38

  15. Breaking the input polynomial into... ... two polynomials of half the degree For a set X = { x 0 , . . . , x n } and polynomial p ( x ) , let 1 �� �� � � � � p = x 0 , p ( x 0 ) , . . . , x n , p ( x n ) . X p ( x ) = � n − 1 i =0 a i x i as p ( x ) = u ( x 2 ) + x · v ( x 2 ) , where 2 n/ 2 − 1 n/ 2 − 1 � � a 2 i y i a 1+2 i y i . u ( y ) = and v ( y ) = i =0 i =0 all even degree terms in u ( · ) , all odd degree terms in v ( · ) . 3 maximum degree of u ( y ) , v ( y ) is n/ 2 . 4 Sariel (UIUC) New CS473 13 Fall 2015 13 / 38

  16. Breaking the input polynomial into... ... two polynomials of half the degree For a set X = { x 0 , . . . , x n } and polynomial p ( x ) , let 1 �� �� � � � � p = x 0 , p ( x 0 ) , . . . , x n , p ( x n ) . X p ( x ) = � n − 1 i =0 a i x i as p ( x ) = u ( x 2 ) + x · v ( x 2 ) , where 2 n/ 2 − 1 n/ 2 − 1 � � a 2 i y i a 1+2 i y i . u ( y ) = and v ( y ) = i =0 i =0 all even degree terms in u ( · ) , all odd degree terms in v ( · ) . 3 maximum degree of u ( y ) , v ( y ) is n/ 2 . 4 Sariel (UIUC) New CS473 13 Fall 2015 13 / 38

  17. Breaking the input polynomial into... ... two polynomials of half the degree For a set X = { x 0 , . . . , x n } and polynomial p ( x ) , let 1 �� �� � � � � p = x 0 , p ( x 0 ) , . . . , x n , p ( x n ) . X p ( x ) = � n − 1 i =0 a i x i as p ( x ) = u ( x 2 ) + x · v ( x 2 ) , where 2 n/ 2 − 1 n/ 2 − 1 � � a 2 i y i a 1+2 i y i . u ( y ) = and v ( y ) = i =0 i =0 all even degree terms in u ( · ) , all odd degree terms in v ( · ) . 3 maximum degree of u ( y ) , v ( y ) is n/ 2 . 4 Sariel (UIUC) New CS473 13 Fall 2015 13 / 38

  18. Breaking the input polynomial into... ... two polynomials of half the degree For a set X = { x 0 , . . . , x n } and polynomial p ( x ) , let 1 �� �� � � � � p = x 0 , p ( x 0 ) , . . . , x n , p ( x n ) . X p ( x ) = � n − 1 i =0 a i x i as p ( x ) = u ( x 2 ) + x · v ( x 2 ) , where 2 n/ 2 − 1 n/ 2 − 1 � � a 2 i y i a 1+2 i y i . u ( y ) = and v ( y ) = i =0 i =0 all even degree terms in u ( · ) , all odd degree terms in v ( · ) . 3 maximum degree of u ( y ) , v ( y ) is n/ 2 . 4 Sariel (UIUC) New CS473 13 Fall 2015 13 / 38

  19. FFT: The dividing stage p ( x ) = � n − 1 i =0 a i x i as p ( x ) = u ( x 2 ) + x · v ( x 2 ) . 1 Ψ : collapsible set of size n . 2 p (Ψ) : compute polynomial of degree n − 1 on n values. 3 Decompose: 4 n/ 2 − 1 n/ 2 − 1 � � a 2 i y i a 1+2 i y i . u ( y ) = and v ( y ) = i =0 i =0 Need to compute u ( x 2 ) , for all x ∈ Ψ . 5 Need to compute v ( x 2 ) , for all x ∈ Ψ . 6 x 2 � � � � SQ (Ψ) = � x ∈ Ψ . 7 = ⇒ Need to compute u ( SQ (Ψ)) , v ( SQ (Ψ)) . 8 u ( SQ (Ψ)) , v ( SQ (Ψ)) : comp. poly. degree n 2 − 1 on n 9 2 values. Sariel (UIUC) New CS473 14 Fall 2015 14 / 38

  20. FFT: The dividing stage p ( x ) = � n − 1 i =0 a i x i as p ( x ) = u ( x 2 ) + x · v ( x 2 ) . 1 Ψ : collapsible set of size n . 2 p (Ψ) : compute polynomial of degree n − 1 on n values. 3 Decompose: 4 n/ 2 − 1 n/ 2 − 1 � � a 2 i y i a 1+2 i y i . u ( y ) = and v ( y ) = i =0 i =0 Need to compute u ( x 2 ) , for all x ∈ Ψ . 5 Need to compute v ( x 2 ) , for all x ∈ Ψ . 6 x 2 � � � � SQ (Ψ) = � x ∈ Ψ . 7 = ⇒ Need to compute u ( SQ (Ψ)) , v ( SQ (Ψ)) . 8 u ( SQ (Ψ)) , v ( SQ (Ψ)) : comp. poly. degree n 2 − 1 on n 9 2 values. Sariel (UIUC) New CS473 14 Fall 2015 14 / 38

  21. FFT: The dividing stage p ( x ) = � n − 1 i =0 a i x i as p ( x ) = u ( x 2 ) + x · v ( x 2 ) . 1 Ψ : collapsible set of size n . 2 p (Ψ) : compute polynomial of degree n − 1 on n values. 3 Decompose: 4 n/ 2 − 1 n/ 2 − 1 � � a 2 i y i a 1+2 i y i . u ( y ) = and v ( y ) = i =0 i =0 Need to compute u ( x 2 ) , for all x ∈ Ψ . 5 Need to compute v ( x 2 ) , for all x ∈ Ψ . 6 x 2 � � � � SQ (Ψ) = � x ∈ Ψ . 7 = ⇒ Need to compute u ( SQ (Ψ)) , v ( SQ (Ψ)) . 8 u ( SQ (Ψ)) , v ( SQ (Ψ)) : comp. poly. degree n 2 − 1 on n 9 2 values. Sariel (UIUC) New CS473 14 Fall 2015 14 / 38

  22. FFT: The dividing stage p ( x ) = � n − 1 i =0 a i x i as p ( x ) = u ( x 2 ) + x · v ( x 2 ) . 1 Ψ : collapsible set of size n . 2 p (Ψ) : compute polynomial of degree n − 1 on n values. 3 Decompose: 4 n/ 2 − 1 n/ 2 − 1 � � a 2 i y i a 1+2 i y i . u ( y ) = and v ( y ) = i =0 i =0 Need to compute u ( x 2 ) , for all x ∈ Ψ . 5 Need to compute v ( x 2 ) , for all x ∈ Ψ . 6 x 2 � � � � SQ (Ψ) = � x ∈ Ψ . 7 = ⇒ Need to compute u ( SQ (Ψ)) , v ( SQ (Ψ)) . 8 u ( SQ (Ψ)) , v ( SQ (Ψ)) : comp. poly. degree n 2 − 1 on n 9 2 values. Sariel (UIUC) New CS473 14 Fall 2015 14 / 38

  23. FFT: The dividing stage p ( x ) = � n − 1 i =0 a i x i as p ( x ) = u ( x 2 ) + x · v ( x 2 ) . 1 Ψ : collapsible set of size n . 2 p (Ψ) : compute polynomial of degree n − 1 on n values. 3 Decompose: 4 n/ 2 − 1 n/ 2 − 1 � � a 2 i y i a 1+2 i y i . u ( y ) = and v ( y ) = i =0 i =0 Need to compute u ( x 2 ) , for all x ∈ Ψ . 5 Need to compute v ( x 2 ) , for all x ∈ Ψ . 6 x 2 � � � � SQ (Ψ) = � x ∈ Ψ . 7 = ⇒ Need to compute u ( SQ (Ψ)) , v ( SQ (Ψ)) . 8 u ( SQ (Ψ)) , v ( SQ (Ψ)) : comp. poly. degree n 2 − 1 on n 9 2 values. Sariel (UIUC) New CS473 14 Fall 2015 14 / 38

  24. FFT: The dividing stage p ( x ) = � n − 1 i =0 a i x i as p ( x ) = u ( x 2 ) + x · v ( x 2 ) . 1 Ψ : collapsible set of size n . 2 p (Ψ) : compute polynomial of degree n − 1 on n values. 3 Decompose: 4 n/ 2 − 1 n/ 2 − 1 � � a 2 i y i a 1+2 i y i . u ( y ) = and v ( y ) = i =0 i =0 Need to compute u ( x 2 ) , for all x ∈ Ψ . 5 Need to compute v ( x 2 ) , for all x ∈ Ψ . 6 x 2 � � � � SQ (Ψ) = � x ∈ Ψ . 7 = ⇒ Need to compute u ( SQ (Ψ)) , v ( SQ (Ψ)) . 8 u ( SQ (Ψ)) , v ( SQ (Ψ)) : comp. poly. degree n 2 − 1 on n 9 2 values. Sariel (UIUC) New CS473 14 Fall 2015 14 / 38

  25. FFT: The dividing stage p ( x ) = � n − 1 i =0 a i x i as p ( x ) = u ( x 2 ) + x · v ( x 2 ) . 1 Ψ : collapsible set of size n . 2 p (Ψ) : compute polynomial of degree n − 1 on n values. 3 Decompose: 4 n/ 2 − 1 n/ 2 − 1 � � a 2 i y i a 1+2 i y i . u ( y ) = and v ( y ) = i =0 i =0 Need to compute u ( x 2 ) , for all x ∈ Ψ . 5 Need to compute v ( x 2 ) , for all x ∈ Ψ . 6 x 2 � � � � SQ (Ψ) = � x ∈ Ψ . 7 = ⇒ Need to compute u ( SQ (Ψ)) , v ( SQ (Ψ)) . 8 u ( SQ (Ψ)) , v ( SQ (Ψ)) : comp. poly. degree n 2 − 1 on n 9 2 values. Sariel (UIUC) New CS473 14 Fall 2015 14 / 38

  26. FFT: The dividing stage p ( x ) = � n − 1 i =0 a i x i as p ( x ) = u ( x 2 ) + x · v ( x 2 ) . 1 Ψ : collapsible set of size n . 2 p (Ψ) : compute polynomial of degree n − 1 on n values. 3 Decompose: 4 n/ 2 − 1 n/ 2 − 1 � � a 2 i y i a 1+2 i y i . u ( y ) = and v ( y ) = i =0 i =0 Need to compute u ( x 2 ) , for all x ∈ Ψ . 5 Need to compute v ( x 2 ) , for all x ∈ Ψ . 6 x 2 � � � � SQ (Ψ) = � x ∈ Ψ . 7 = ⇒ Need to compute u ( SQ (Ψ)) , v ( SQ (Ψ)) . 8 u ( SQ (Ψ)) , v ( SQ (Ψ)) : comp. poly. degree n 2 − 1 on n 9 2 values. Sariel (UIUC) New CS473 14 Fall 2015 14 / 38

  27. FFT: The dividing stage p ( x ) = � n − 1 i =0 a i x i as p ( x ) = u ( x 2 ) + x · v ( x 2 ) . 1 Ψ : collapsible set of size n . 2 p (Ψ) : compute polynomial of degree n − 1 on n values. 3 Decompose: 4 n/ 2 − 1 n/ 2 − 1 � � a 2 i y i a 1+2 i y i . u ( y ) = and v ( y ) = i =0 i =0 Need to compute u ( x 2 ) , for all x ∈ Ψ . 5 Need to compute v ( x 2 ) , for all x ∈ Ψ . 6 x 2 � � � � SQ (Ψ) = � x ∈ Ψ . 7 = ⇒ Need to compute u ( SQ (Ψ)) , v ( SQ (Ψ)) . 8 u ( SQ (Ψ)) , v ( SQ (Ψ)) : comp. poly. degree n 2 − 1 on n 9 2 values. Sariel (UIUC) New CS473 14 Fall 2015 14 / 38

  28. FFT: The conquering stage Ψ : Collapsible set of size n . 1 i =0 a i x i as p ( x ) = u ( x 2 ) + x · v ( x 2 ) . p ( x ) = � n − 1 2 u ( y ) = � n/ 2 − 1 v ( y ) = � n/ 2 − 1 a 2 i y i a 1+2 i y i . and 3 i =0 i =0 u ( SQ (Ψ)) , v ( SQ (Ψ)) : Computed recursively. 4 Need to compute p (Ψ) . 5 For x ∈ Ψ : Compute p ( x ) = u ( x 2 ) + x · v ( x 2 ) . 6 Takes constant time per single element x ∈ Ψ . 7 Takes O ( n ) time overall. 8 Sariel (UIUC) New CS473 15 Fall 2015 15 / 38

  29. FFT: The conquering stage Ψ : Collapsible set of size n . 1 i =0 a i x i as p ( x ) = u ( x 2 ) + x · v ( x 2 ) . p ( x ) = � n − 1 2 u ( y ) = � n/ 2 − 1 v ( y ) = � n/ 2 − 1 a 2 i y i a 1+2 i y i . and 3 i =0 i =0 u ( SQ (Ψ)) , v ( SQ (Ψ)) : Computed recursively. 4 Need to compute p (Ψ) . 5 For x ∈ Ψ : Compute p ( x ) = u ( x 2 ) + x · v ( x 2 ) . 6 Takes constant time per single element x ∈ Ψ . 7 Takes O ( n ) time overall. 8 Sariel (UIUC) New CS473 15 Fall 2015 15 / 38

  30. FFT: The conquering stage Ψ : Collapsible set of size n . 1 i =0 a i x i as p ( x ) = u ( x 2 ) + x · v ( x 2 ) . p ( x ) = � n − 1 2 u ( y ) = � n/ 2 − 1 v ( y ) = � n/ 2 − 1 a 2 i y i a 1+2 i y i . and 3 i =0 i =0 u ( SQ (Ψ)) , v ( SQ (Ψ)) : Computed recursively. 4 Need to compute p (Ψ) . 5 For x ∈ Ψ : Compute p ( x ) = u ( x 2 ) + x · v ( x 2 ) . 6 Takes constant time per single element x ∈ Ψ . 7 Takes O ( n ) time overall. 8 Sariel (UIUC) New CS473 15 Fall 2015 15 / 38

  31. FFT: The conquering stage Ψ : Collapsible set of size n . 1 i =0 a i x i as p ( x ) = u ( x 2 ) + x · v ( x 2 ) . p ( x ) = � n − 1 2 u ( y ) = � n/ 2 − 1 v ( y ) = � n/ 2 − 1 a 2 i y i a 1+2 i y i . and 3 i =0 i =0 u ( SQ (Ψ)) , v ( SQ (Ψ)) : Computed recursively. 4 Need to compute p (Ψ) . 5 For x ∈ Ψ : Compute p ( x ) = u ( x 2 ) + x · v ( x 2 ) . 6 Takes constant time per single element x ∈ Ψ . 7 Takes O ( n ) time overall. 8 Sariel (UIUC) New CS473 15 Fall 2015 15 / 38

  32. FFT: The conquering stage Ψ : Collapsible set of size n . 1 i =0 a i x i as p ( x ) = u ( x 2 ) + x · v ( x 2 ) . p ( x ) = � n − 1 2 u ( y ) = � n/ 2 − 1 v ( y ) = � n/ 2 − 1 a 2 i y i a 1+2 i y i . and 3 i =0 i =0 u ( SQ (Ψ)) , v ( SQ (Ψ)) : Computed recursively. 4 Need to compute p (Ψ) . 5 For x ∈ Ψ : Compute p ( x ) = u ( x 2 ) + x · v ( x 2 ) . 6 Takes constant time per single element x ∈ Ψ . 7 Takes O ( n ) time overall. 8 Sariel (UIUC) New CS473 15 Fall 2015 15 / 38

  33. FFT: The conquering stage Ψ : Collapsible set of size n . 1 i =0 a i x i as p ( x ) = u ( x 2 ) + x · v ( x 2 ) . p ( x ) = � n − 1 2 u ( y ) = � n/ 2 − 1 v ( y ) = � n/ 2 − 1 a 2 i y i a 1+2 i y i . and 3 i =0 i =0 u ( SQ (Ψ)) , v ( SQ (Ψ)) : Computed recursively. 4 Need to compute p (Ψ) . 5 For x ∈ Ψ : Compute p ( x ) = u ( x 2 ) + x · v ( x 2 ) . 6 Takes constant time per single element x ∈ Ψ . 7 Takes O ( n ) time overall. 8 Sariel (UIUC) New CS473 15 Fall 2015 15 / 38

  34. FFT: The conquering stage Ψ : Collapsible set of size n . 1 i =0 a i x i as p ( x ) = u ( x 2 ) + x · v ( x 2 ) . p ( x ) = � n − 1 2 u ( y ) = � n/ 2 − 1 v ( y ) = � n/ 2 − 1 a 2 i y i a 1+2 i y i . and 3 i =0 i =0 u ( SQ (Ψ)) , v ( SQ (Ψ)) : Computed recursively. 4 Need to compute p (Ψ) . 5 For x ∈ Ψ : Compute p ( x ) = u ( x 2 ) + x · v ( x 2 ) . 6 Takes constant time per single element x ∈ Ψ . 7 Takes O ( n ) time overall. 8 Sariel (UIUC) New CS473 15 Fall 2015 15 / 38

  35. FFT: The conquering stage Ψ : Collapsible set of size n . 1 i =0 a i x i as p ( x ) = u ( x 2 ) + x · v ( x 2 ) . p ( x ) = � n − 1 2 u ( y ) = � n/ 2 − 1 v ( y ) = � n/ 2 − 1 a 2 i y i a 1+2 i y i . and 3 i =0 i =0 u ( SQ (Ψ)) , v ( SQ (Ψ)) : Computed recursively. 4 Need to compute p (Ψ) . 5 For x ∈ Ψ : Compute p ( x ) = u ( x 2 ) + x · v ( x 2 ) . 6 Takes constant time per single element x ∈ Ψ . 7 Takes O ( n ) time overall. 8 Sariel (UIUC) New CS473 15 Fall 2015 15 / 38

  36. FFT algorithm FFTAlg ( p , X )// X : A collapsible set of n elements. p ( x ) = � n − 1 i =0 a i x i input: p ( x ) : polynomial deg. n : p ( X ) output: u ( y ) = � n/ 2 − 1 v ( y ) = � n/ 2 − 1 a 2 i y i a 1+2 i y i . i =0 i =0 x 2 � � � � Y = SQ ( X ) = � x ∈ X . U = FFTAlg ( u, Y ) // U = u ( Y ) V = FFTAlg ( v, Y ) // V = v ( Y ) Out ← ∅ // p ( x ) = u ( x 2 ) + x ∗ v ( x 2 ) for x ∈ X do ( x, p ( x )) ← ( x, U [ x 2 ] + x · V [ x 2 ]) // U [ x 2 ] ≡ u ( x 2 ) Out ← Out ∪ { ( x, p ( x )) } return Out Sariel (UIUC) New CS473 16 Fall 2015 16 / 38

  37. Running time analysis... ...an old foe emerges once again to serve T ( m, n ) : Time of computing a polynomial of degree m on n 1 values. We have that: 2 T ( n − 1 , n ) = 2 T ( n/ 2 − 1 , n/ 2) + O ( n ) . The solution to this recurrence is O ( n log n ) . 3 Sariel (UIUC) New CS473 17 Fall 2015 17 / 38

  38. Running time analysis... ...an old foe emerges once again to serve T ( m, n ) : Time of computing a polynomial of degree m on n 1 values. We have that: 2 T ( n − 1 , n ) = 2 T ( n/ 2 − 1 , n/ 2) + O ( n ) . The solution to this recurrence is O ( n log n ) . 3 Sariel (UIUC) New CS473 17 Fall 2015 17 / 38

  39. Running time analysis... ...an old foe emerges once again to serve T ( m, n ) : Time of computing a polynomial of degree m on n 1 values. We have that: 2 T ( n − 1 , n ) = 2 T ( n/ 2 − 1 , n/ 2) + O ( n ) . The solution to this recurrence is O ( n log n ) . 3 Sariel (UIUC) New CS473 17 Fall 2015 17 / 38

  40. Generating Collapsible Sets How to generate collapsible sets? 1 2 Sariel (UIUC) New CS473 18 Fall 2015 18 / 38

  41. Generating Collapsible Sets How to generate collapsible sets? 1 Trick: Use complex numbers! 2 Sariel (UIUC) New CS473 18 Fall 2015 18 / 38

  42. Complex numbers – a quick reminder Complex number: pair 1 ( α, β ) of real numbers. Written as τ = α + i β . α : real part, 2 β : imaginary part. i is the root of − 1 . 3 Geometrically: a point in 4 the complex plane: polar form : τ = r cos φ + i r sin φ = r (cos φ + i sin φ ) 1 � α 2 + β 2 and φ = arcsin( β/α ) . r = 2 Sariel (UIUC) New CS473 19 Fall 2015 19 / 38

  43. Complex numbers – a quick reminder Complex number: pair 1 ( α, β ) of real numbers. Written as τ = α + i β . α : real part, 2 β : imaginary part. i is the root of − 1 . 3 Geometrically: a point in 4 the complex plane: polar form : τ = r cos φ + i r sin φ = r (cos φ + i sin φ ) 1 � α 2 + β 2 and φ = arcsin( β/α ) . r = 2 Sariel (UIUC) New CS473 19 Fall 2015 19 / 38

  44. Complex numbers – a quick reminder Complex number: pair 1 ( α, β ) of real numbers. Written as τ = α + i β . α : real part, 2 β : imaginary part. i is the root of − 1 . 3 Geometrically: a point in 4 the complex plane: polar form : τ = r cos φ + i r sin φ = r (cos φ + i sin φ ) 1 � α 2 + β 2 and φ = arcsin( β/α ) . r = 2 Sariel (UIUC) New CS473 19 Fall 2015 19 / 38

  45. Complex numbers – a quick reminder Complex number: pair Im 1 ( α, β ) of real numbers. Written as τ = α + i β . τ = α + β i α : real part, 2 β : imaginary part. β i is the root of − 1 . 3 Geometrically: a point in Re 4 the complex plane: α polar form : τ = r cos φ + i r sin φ = r (cos φ + i sin φ ) 1 � α 2 + β 2 and φ = arcsin( β/α ) . r = 2 Sariel (UIUC) New CS473 19 Fall 2015 19 / 38

  46. Complex numbers – a quick reminder Complex number: pair Im 1 ( α, β ) of real numbers. Written as τ = α + i β . τ = α + β i α : real part, 2 r β : imaginary part. β i is the root of − 1 . 3 φ Geometrically: a point in Re 4 the complex plane: α polar form : τ = r cos φ + i r sin φ = r (cos φ + i sin φ ) 1 � α 2 + β 2 and φ = arcsin( β/α ) . r = 2 Sariel (UIUC) New CS473 19 Fall 2015 19 / 38

  47. Complex numbers – a quick reminder Complex number: pair Im 1 ( α, β ) of real numbers. Written as τ = α + i β . τ = α + β i α : real part, 2 r β : imaginary part. β i is the root of − 1 . 3 φ Geometrically: a point in Re 4 the complex plane: α polar form : τ = r cos φ + i r sin φ = r (cos φ + i sin φ ) 1 � α 2 + β 2 and φ = arcsin( β/α ) . r = 2 Sariel (UIUC) New CS473 19 Fall 2015 19 / 38

  48. A useful formula: cos φ + i sin φ = e i φ By Taylor’s expansion: 1 sin x = x − x 3 3! + x 5 5! − x 7 7! + · · · , cos x = 1 − x 2 2! + x 4 4! − x 6 6! + · · · , 1! + x 2 2! + x 3 e x = 1 + x and 3! + · · · . Since i 2 = − 1 : 2 1! − x 2 2! − i x 3 3! + x 4 4! + i x 5 5! − x 6 e i x = 1 + i x 6! · · · = cos x + i sin x. Sariel (UIUC) New CS473 20 Fall 2015 20 / 38

  49. A useful formula: cos φ + i sin φ = e i φ By Taylor’s expansion: 1 sin x = x − x 3 3! + x 5 5! − x 7 7! + · · · , cos x = 1 − x 2 2! + x 4 4! − x 6 6! + · · · , 1! + x 2 2! + x 3 e x = 1 + x and 3! + · · · . Since i 2 = − 1 : 2 1! − x 2 2! − i x 3 3! + x 4 4! + i x 5 5! − x 6 e i x = 1 + i x 6! · · · = cos x + i sin x. Sariel (UIUC) New CS473 20 Fall 2015 20 / 38

  50. Back to polar form polar form : 1 τ = r cos φ + i r sin φ = r (cos φ + i sin φ ) = re iφ , τ ′ = r ′ e i φ ′ : complex numbers. τ = re i φ , 2 τ · τ ′ = re i φ · r ′ e i φ ′ = rr ′ e i( φ + φ ′ ) . 3 e i φ is 2 π periodic (i.e., e i φ = e i( φ +2 π ) ), and 1 = e i0 . 4 n th root of 1 : complex number τ – raise it to power n get 1 . 5 τ = re i φ , such that τ n = r n e i nφ = e i0 . 6 = ⇒ r = 1 , and there must be an integer j , such that 7 nφ = 0 + 2 πj = ⇒ φ = j (2 π/n ) . Sariel (UIUC) New CS473 21 Fall 2015 21 / 38

  51. Back to polar form polar form : 1 τ = r cos φ + i r sin φ = r (cos φ + i sin φ ) = re iφ , τ ′ = r ′ e i φ ′ : complex numbers. τ = re i φ , 2 τ · τ ′ = re i φ · r ′ e i φ ′ = rr ′ e i( φ + φ ′ ) . 3 e i φ is 2 π periodic (i.e., e i φ = e i( φ +2 π ) ), and 1 = e i0 . 4 n th root of 1 : complex number τ – raise it to power n get 1 . 5 τ = re i φ , such that τ n = r n e i nφ = e i0 . 6 = ⇒ r = 1 , and there must be an integer j , such that 7 nφ = 0 + 2 πj = ⇒ φ = j (2 π/n ) . Sariel (UIUC) New CS473 21 Fall 2015 21 / 38

  52. Back to polar form polar form : 1 τ = r cos φ + i r sin φ = r (cos φ + i sin φ ) = re iφ , τ ′ = r ′ e i φ ′ : complex numbers. τ = re i φ , 2 τ · τ ′ = re i φ · r ′ e i φ ′ = rr ′ e i( φ + φ ′ ) . 3 e i φ is 2 π periodic (i.e., e i φ = e i( φ +2 π ) ), and 1 = e i0 . 4 n th root of 1 : complex number τ – raise it to power n get 1 . 5 τ = re i φ , such that τ n = r n e i nφ = e i0 . 6 = ⇒ r = 1 , and there must be an integer j , such that 7 nφ = 0 + 2 πj = ⇒ φ = j (2 π/n ) . Sariel (UIUC) New CS473 21 Fall 2015 21 / 38

  53. Back to polar form polar form : 1 τ = r cos φ + i r sin φ = r (cos φ + i sin φ ) = re iφ , τ ′ = r ′ e i φ ′ : complex numbers. τ = re i φ , 2 τ · τ ′ = re i φ · r ′ e i φ ′ = rr ′ e i( φ + φ ′ ) . 3 e i φ is 2 π periodic (i.e., e i φ = e i( φ +2 π ) ), and 1 = e i0 . 4 n th root of 1 : complex number τ – raise it to power n get 1 . 5 τ = re i φ , such that τ n = r n e i nφ = e i0 . 6 = ⇒ r = 1 , and there must be an integer j , such that 7 nφ = 0 + 2 πj = ⇒ φ = j (2 π/n ) . Sariel (UIUC) New CS473 21 Fall 2015 21 / 38

  54. Roots of unity The desire to avoid war? For j = 0 , . . . , n − 1 , we get the n distinct roots of unity . γ 1 (4) = β 3 (4) = i γ 2 (8) = β 6 (8) = i γ 3 (8) = β 5 (8) γ 1 (8) = β 7 (8) γ 2 (4) = β 2 (4) = − 1 γ 4 (8) = β 4 (8) = − 1 1 1 γ 5 (8) = β 3 (8) γ 7 (8) = β 1 (8) γ 6 (8) = β 2 (8) = − i γ 3 (4) = β 1 (4) = − i ( n = 4 ) ( n = 8 ) ( n = 16 ) Sariel (UIUC) New CS473 22 Fall 2015 22 / 38

  55. Back to collapsible sets Can do all basic calculations on complex numbers in O (1) time. 1 Idea: Work over the complex numbers. 2 Use roots of unity! 3 γ : n th root of unity. There are n such roots, and let γ j ( n ) 4 denote the j th root. γ j ( n ) = cos((2 πj ) /n ) + i sin((2 πj ) /n ) = γ j . Let A ( n ) = { γ 0 ( n ) , . . . , γ n − 1 ( n ) } . | SQ ( A ( n )) | has n/ 2 entries. 5 SQ ( A ( n )) = A ( n/ 2) 6 n to be a power of 2 , then A ( n ) is the required collapsible set. 7 Sariel (UIUC) New CS473 23 Fall 2015 23 / 38

  56. Back to collapsible sets Can do all basic calculations on complex numbers in O (1) time. 1 Idea: Work over the complex numbers. 2 Use roots of unity! 3 γ : n th root of unity. There are n such roots, and let γ j ( n ) 4 denote the j th root. γ j ( n ) = cos((2 πj ) /n ) + i sin((2 πj ) /n ) = γ j . Let A ( n ) = { γ 0 ( n ) , . . . , γ n − 1 ( n ) } . | SQ ( A ( n )) | has n/ 2 entries. 5 SQ ( A ( n )) = A ( n/ 2) 6 n to be a power of 2 , then A ( n ) is the required collapsible set. 7 Sariel (UIUC) New CS473 23 Fall 2015 23 / 38

  57. Back to collapsible sets Can do all basic calculations on complex numbers in O (1) time. 1 Idea: Work over the complex numbers. 2 Use roots of unity! 3 γ : n th root of unity. There are n such roots, and let γ j ( n ) 4 denote the j th root. γ j ( n ) = cos((2 πj ) /n ) + i sin((2 πj ) /n ) = γ j . Let A ( n ) = { γ 0 ( n ) , . . . , γ n − 1 ( n ) } . | SQ ( A ( n )) | has n/ 2 entries. 5 SQ ( A ( n )) = A ( n/ 2) 6 n to be a power of 2 , then A ( n ) is the required collapsible set. 7 Sariel (UIUC) New CS473 23 Fall 2015 23 / 38

  58. Back to collapsible sets Can do all basic calculations on complex numbers in O (1) time. 1 Idea: Work over the complex numbers. 2 Use roots of unity! 3 γ : n th root of unity. There are n such roots, and let γ j ( n ) 4 denote the j th root. γ j ( n ) = cos((2 πj ) /n ) + i sin((2 πj ) /n ) = γ j . Let A ( n ) = { γ 0 ( n ) , . . . , γ n − 1 ( n ) } . | SQ ( A ( n )) | has n/ 2 entries. 5 SQ ( A ( n )) = A ( n/ 2) 6 n to be a power of 2 , then A ( n ) is the required collapsible set. 7 Sariel (UIUC) New CS473 23 Fall 2015 23 / 38

  59. Back to collapsible sets Can do all basic calculations on complex numbers in O (1) time. 1 Idea: Work over the complex numbers. 2 Use roots of unity! 3 γ : n th root of unity. There are n such roots, and let γ j ( n ) 4 denote the j th root. γ j ( n ) = cos((2 πj ) /n ) + i sin((2 πj ) /n ) = γ j . Let A ( n ) = { γ 0 ( n ) , . . . , γ n − 1 ( n ) } . | SQ ( A ( n )) | has n/ 2 entries. 5 SQ ( A ( n )) = A ( n/ 2) 6 n to be a power of 2 , then A ( n ) is the required collapsible set. 7 Sariel (UIUC) New CS473 23 Fall 2015 23 / 38

  60. Back to collapsible sets Can do all basic calculations on complex numbers in O (1) time. 1 Idea: Work over the complex numbers. 2 Use roots of unity! 3 γ : n th root of unity. There are n such roots, and let γ j ( n ) 4 denote the j th root. γ j ( n ) = cos((2 πj ) /n ) + i sin((2 πj ) /n ) = γ j . Let A ( n ) = { γ 0 ( n ) , . . . , γ n − 1 ( n ) } . | SQ ( A ( n )) | has n/ 2 entries. 5 SQ ( A ( n )) = A ( n/ 2) 6 n to be a power of 2 , then A ( n ) is the required collapsible set. 7 Sariel (UIUC) New CS473 23 Fall 2015 23 / 38

  61. Back to collapsible sets Can do all basic calculations on complex numbers in O (1) time. 1 Idea: Work over the complex numbers. 2 Use roots of unity! 3 γ : n th root of unity. There are n such roots, and let γ j ( n ) 4 denote the j th root. γ j ( n ) = cos((2 πj ) /n ) + i sin((2 πj ) /n ) = γ j . Let A ( n ) = { γ 0 ( n ) , . . . , γ n − 1 ( n ) } . | SQ ( A ( n )) | has n/ 2 entries. 5 SQ ( A ( n )) = A ( n/ 2) 6 n to be a power of 2 , then A ( n ) is the required collapsible set. 7 Sariel (UIUC) New CS473 23 Fall 2015 23 / 38

  62. The first result... Theorem Given polynomial p ( x ) of degree n , where n is a power of two, then we can compute p ( X ) in O ( n log n ) time, where X = A ( n ) is the set of n different powers of the n th root of unity over the complex numbers. Sariel (UIUC) New CS473 24 Fall 2015 24 / 38

  63. Problem... We can go, but can we come back? Can multiply two polynomials quickly 1 by transforming them to the point-value pairs representation... 2 over the n th roots of unity. 3 Q: How to transform this representation back to the regular 4 representation. A: Do some confusing math... 5 Sariel (UIUC) New CS473 25 Fall 2015 25 / 38

  64. Problem... We can go, but can we come back? Can multiply two polynomials quickly 1 by transforming them to the point-value pairs representation... 2 over the n th roots of unity. 3 Q: How to transform this representation back to the regular 4 representation. A: Do some confusing math... 5 Sariel (UIUC) New CS473 25 Fall 2015 25 / 38

  65. Problem... We can go, but can we come back? Can multiply two polynomials quickly 1 by transforming them to the point-value pairs representation... 2 over the n th roots of unity. 3 Q: How to transform this representation back to the regular 4 representation. A: Do some confusing math... 5 Sariel (UIUC) New CS473 25 Fall 2015 25 / 38

  66. Problem... We can go, but can we come back? Can multiply two polynomials quickly 1 by transforming them to the point-value pairs representation... 2 over the n th roots of unity. 3 Q: How to transform this representation back to the regular 4 representation. A: Do some confusing math... 5 Sariel (UIUC) New CS473 25 Fall 2015 25 / 38

  67. Problem... We can go, but can we come back? Can multiply two polynomials quickly 1 by transforming them to the point-value pairs representation... 2 over the n th roots of unity. 3 Q: How to transform this representation back to the regular 4 representation. A: Do some confusing math... 5 Sariel (UIUC) New CS473 25 Fall 2015 25 / 38

  68. 23.3: Recovering the polynomial Sariel (UIUC) New CS473 26 Fall 2015 26 / 38

  69. Recovering the polynomial Think about FFT as a matrix multiplication operator. p ( x ) = � n − 1 i =0 a i x i . Evaluating p ( · ) on A ( n ) :   γ n − 1 γ 2 γ 3 1 γ 0 · · ·   0 0 0 a 0   y 0  γ n − 1  γ 2 γ 3 1 γ 1 · · · a 1     1 1 1 y 1       γ n − 1 γ 2 γ 3 1 γ 2 · · · a 2       2 2 2 y 2       = , a 3    γ n − 1    γ 2 γ 3 . 1 γ 3 · · ·  .      3 3 3 . .    .    . . . . . .  . . . . .    . . . . · · · . y n − 1   a n − 1 γ n − 1 γ 2 γ 3 · · · 1 γ n − 1 n − 1 n − 1 n − 1 � �� � the matrix V where γ j = γ j ( n ) = ( γ 1 ( n )) j is the j th power of the n th root of unity, and y j = p ( γ j ) . Sariel (UIUC) New CS473 27 Fall 2015 27 / 38

  70. The Vandermonde matrix Because every matrix needs a name V is the Vandermonde matrix. V − 1 : inverse matrix of V Vandermonde matrix. And let multiply the above formula from the left. We get:     a 0 a 0     y 0 y 0 a 1 a 1     y 1 y 1         a 2 a 2         y 2 y 2       = V − 1   ⇒ = V = a 3 a 3         . .  .       .  . . . .       . .   . .     y n − 1 y n − 1 a n − 1 a n − 1 Sariel (UIUC) New CS473 28 Fall 2015 28 / 38

  71. The inverse Vandermonde matrix ..for the rescue Recover the polynomial p ( x ) from the point-value pairs 1 � � ( γ 0 , p ( γ 0 )) , ( γ 1 , p ( γ 1 )) , . . . , ( γ n − 1 , p ( γ n − 1 )) by doing a single matrix multiplication of V − 1 by the vector 2 [ y 0 , y 1 , . . . , y n − 1 ] . Multiplying a vector with n entries with n × n matrix takes 3 O ( n 2 ) time. No benefit so far... 4 Sariel (UIUC) New CS473 29 Fall 2015 29 / 38

  72. The inverse Vandermonde matrix ..for the rescue Recover the polynomial p ( x ) from the point-value pairs 1 � � ( γ 0 , p ( γ 0 )) , ( γ 1 , p ( γ 1 )) , . . . , ( γ n − 1 , p ( γ n − 1 )) by doing a single matrix multiplication of V − 1 by the vector 2 [ y 0 , y 1 , . . . , y n − 1 ] . Multiplying a vector with n entries with n × n matrix takes 3 O ( n 2 ) time. No benefit so far... 4 Sariel (UIUC) New CS473 29 Fall 2015 29 / 38

  73. The inverse Vandermonde matrix ..for the rescue Recover the polynomial p ( x ) from the point-value pairs 1 � � ( γ 0 , p ( γ 0 )) , ( γ 1 , p ( γ 1 )) , . . . , ( γ n − 1 , p ( γ n − 1 )) by doing a single matrix multiplication of V − 1 by the vector 2 [ y 0 , y 1 , . . . , y n − 1 ] . Multiplying a vector with n entries with n × n matrix takes 3 O ( n 2 ) time. No benefit so far... 4 Sariel (UIUC) New CS473 29 Fall 2015 29 / 38

  74. The inverse Vandermonde matrix ..for the rescue Recover the polynomial p ( x ) from the point-value pairs 1 � � ( γ 0 , p ( γ 0 )) , ( γ 1 , p ( γ 1 )) , . . . , ( γ n − 1 , p ( γ n − 1 )) by doing a single matrix multiplication of V − 1 by the vector 2 [ y 0 , y 1 , . . . , y n − 1 ] . Multiplying a vector with n entries with n × n matrix takes 3 O ( n 2 ) time. No benefit so far... 4 Sariel (UIUC) New CS473 29 Fall 2015 29 / 38

  75. What is the inverse of the Vandermonde matrix Vandermonde matrix is famous, beautiful and well known – a celebrity matrix Claim   β n − 1 β 2 β 3 · · · 1 β 0 0 0 0 β n − 1 β 2 β 3 1 β 1 · · ·   1 1 1   β n − 1 β 2 β 3 1 β 2 · · · V − 1 = 1   2 2 2   , β n − 1 β 2 β 3  1 β 3 · · ·  n 3  3 3  . . . . .   . . . . . · · · . . . . .   β n − 1 β 2 β 3 1 β n − 1 · · · n − 1 n − 1 n − 1 where β j = ( γ j ( n )) − 1 . Sariel (UIUC) New CS473 30 Fall 2015 30 / 38

  76. Proof Consider the ( u, v ) entry in the matrix C = V − 1 V . We have n − 1 ( β u ) j ( γ j ) v � C u,v = . n j =0 As γ j = ( γ 1 ) j .Thus, n − 1 n − 1 n − 1 ( β u γ v ) j ( β u ) j (( γ 1 ) j ) v ( β u ) j (( γ 1 ) v ) j � � � C u,v = = = . n n n j =0 j =0 j =0 Clearly, if u = v then n − 1 n − 1 C u,u = 1 ( β u γ u ) j = 1 (1) j = n � � n = 1 . n n j =0 j =0 Sariel (UIUC) New CS473 31 Fall 2015 31 / 38

  77. Proof continued... If u � = v then, 1 = ( γ 1 ) v − u = γ v − u . β u γ v = ( γ u ) − 1 γ v = ( γ 1 ) − u γ v And n − 1 γ n v − u − 1 1 − 1 C u,v = 1 ( γ v − u ) j = 1 γ v − u − 1 = 1 � n · n · γ v − u − 1 = 0 , n j =0 Proved that the matrix C have ones on the diagonal and zero everywhere else. Sariel (UIUC) New CS473 32 Fall 2015 32 / 38

  78. Recap... n point-value pairs { ( γ 0 , y 0 ) , . . . , ( γ n − 1 , y n − 1 ) } : of 1 polynomial p ( x ) = � n − 1 i =0 a i x i over n th roots of unity. Recover coefficients of polynomial by multiplying 2 [ y 0 , y 1 , . . . , y n ] by V − 1 :     β n − 1 β 2 β 3 1 β 0 · · · y 0   0 0 0 a 0 β n − 1 β 2 β 3 1 β 1 · · · y 1     1 1 1 a 1       β n − 1 β 2 β 3 1 β 2 · · · y 2   = 1     2 a 2 2 2       β n − 1 β 2 β 3 y 3    1 β 3 · · ·    . n 3  .   3 3    . . . . . . .    . . . . .   .  . . . . · · · . .     a n − 1 β n − 1 β 2 β 3 y n − 1 1 β n − 1 · · · n − 1 n − 1 n − 1 � �� � V − 1 n − 1 � ( y i /n ) x i : W ( x ) = a i = W ( β i ) . 3 i =0 Sariel (UIUC) New CS473 33 Fall 2015 33 / 38

  79. Recap... n point-value pairs { ( γ 0 , y 0 ) , . . . , ( γ n − 1 , y n − 1 ) } : of 1 polynomial p ( x ) = � n − 1 i =0 a i x i over n th roots of unity. Recover coefficients of polynomial by multiplying 2 [ y 0 , y 1 , . . . , y n ] by V − 1 :     β n − 1 β 2 β 3 1 β 0 · · · y 0   0 0 0 a 0 β n − 1 β 2 β 3 1 β 1 · · · y 1     1 1 1 a 1       β n − 1 β 2 β 3 1 β 2 · · · y 2   = 1     2 a 2 2 2       β n − 1 β 2 β 3 y 3    1 β 3 · · ·    . n 3  .   3 3    . . . . . . .    . . . . .   .  . . . . · · · . .     a n − 1 β n − 1 β 2 β 3 y n − 1 1 β n − 1 · · · n − 1 n − 1 n − 1 � �� � V − 1 n − 1 � ( y i /n ) x i : W ( x ) = a i = W ( β i ) . 3 i =0 Sariel (UIUC) New CS473 33 Fall 2015 33 / 38

  80. Recap... n point-value pairs { ( γ 0 , y 0 ) , . . . , ( γ n − 1 , y n − 1 ) } : of 1 polynomial p ( x ) = � n − 1 i =0 a i x i over n th roots of unity. Recover coefficients of polynomial by multiplying 2 [ y 0 , y 1 , . . . , y n ] by V − 1 :     β n − 1 β 2 β 3 1 β 0 · · · y 0   0 0 0 a 0 β n − 1 β 2 β 3 1 β 1 · · · y 1     1 1 1 a 1       β n − 1 β 2 β 3 1 β 2 · · · y 2   = 1     2 a 2 2 2       β n − 1 β 2 β 3 y 3    1 β 3 · · ·    . n 3  .   3 3    . . . . . . .    . . . . .   .  . . . . · · · . .     a n − 1 β n − 1 β 2 β 3 y n − 1 1 β n − 1 · · · n − 1 n − 1 n − 1 � �� � V − 1 n − 1 � ( y i /n ) x i : W ( x ) = a i = W ( β i ) . 3 i =0 Sariel (UIUC) New CS473 33 Fall 2015 33 / 38

  81. Recovering continued... recover coefficients of p ( · ) ... 1 ... compute W ( · ) on n values: β 0 , . . . , β n − 1 . 2 { β 0 , . . . , β n − 1 } = { γ 0 , . . . , γ n − 1 } . 3 ) n = ( γ n i ) − 1 = 1 − 1 = 1 . i = ( γ − 1 Indeed β n 4 i Apply the FFTAlg algorithm on W ( x ) to compute 5 a 0 , . . . , a n − 1 . Sariel (UIUC) New CS473 34 Fall 2015 34 / 38

Recommend


More recommend