/*! This file is auto-generated */ .wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;text-decoration:none;padding:calc(.667em + 2px) calc(1.333em + 2px);font-size:1.125em}.wp-block-file__button{background:#32373c;color:#fff;text-decoration:none} Q30E This problem illustrates how to ... [FREE SOLUTION] | 91影视

91影视

This problem illustrates how to do the Fourier Transform (FT) in modular arithmetic, for example, modulo .(a) There is a number such that all the powers ,2,...,6 are distinct (modulo ). Find this role="math" localid="1659339882657" , and show that +2+...+6=0. (Interestingly, for any prime modulus there is such a number.)

(b) Using the matrix form of the FT, produce the transform of the sequence (0,1,1,1,5,2) modulo 7; that is, multiply this vector by the matrix M6(), for the value of you found earlier. In the matrix multiplication, all calculations should be performed modulo 7.

(c) Write down the matrix necessary to perform the inverse FT. Show that multiplying by this matrix returns the original sequence. (Again all arithmetic should be performed modulo 7.)

(d) Now show how to multiply the polynomials and using the FT modulo 7.

Short Answer

Expert verified
  1. =3
  2. Transformation of the sequence (0,1,1,1,5,2)is(3,6,4,2,3,3). .
  3. Transformation of the sequence (3,6,4,2,3,3)is(0,1,1,1,5,2). .
  4. Transformation of the sequence (3,6,4,2,3,3)is(-1,1,1,3,1,1)..

Step by step solution

01

Solution of part (a) and (b)  

a.)

Find the value of :

On observing, the value of =3 鈥︹赌

The powers of w are distinct modulo:

Value of 2:

鈥 Substitute =3 in localid="1659340352169" 2and take modulo .

2=32mod7=9mod7=2

Value of 3:

鈥 Substitute =3in3 and take modulo .

3=27mod7=6

Value of 4:

鈥 Substitute =3in4 and take modulo .

localid="1659340501146" 4=34mod7=81mod7=4

Value of 5:

鈥 Substitute =3in5 and take modulo .

5=35mod7=243mod7=5

Value of 6:

鈥 Substitute =3in6 and take modulo .

6=36mod7=729mod7=1

The values of (=3,2=2,3=6,4=4,5=5,6=1) are distinct.

To show +2+3+4+5+6=0 :

鈥 Substitute the values (=3,2=2,3=6,4=4,5=5,6=1)and take modulo in following:

+2+3+4+5+6(2)

Thus,

(+2+3+4+5+6)mod7=(3+2+6+4+5+1)mod7=21mod7=0

Therefore, +2+3+4+5+6=0

02

Solution of part   (b).  

b.)

Coefficient representation of 66matrix of FFT (Fast Fourier Transform)M6() ,is shown below:

M6()=111111123451246810136912151481216201510152025 (3).....

From section (a) the value of powers of are obtained as:

=3,2=2,3=6,4=4,5=5,6=1 (4) 鈥︹赌

The value of is,

8=38=6561mod7=29=39=19683mod7=610=310=59049mod7=412=312=531441mod7=115=315=14348907mod7=616=316=143046721mod7=420=320=3486784401mod7=225=325=84728809443mod7=3 鈥︹赌 (5)

Substitute the powers of w from equation (4) and equation (5) in equation (3).

localid="1659341811588" M6()=111111132645124124161616142142154623. (6)....

The FFT of (0,1,1,1,5,2)is calculated as follows:

FFT of A=M6()A 鈥︹赌 (7)

Substitute the values M6()from Equation (6) and A as (0,1,1,1,5,2) in Equation .

Multiplying the sequence (0,1,1,1,5,2) with equation (6) .

localid="1659341818991" FFTofA=111111132645124124161616142142154623

=101111111512103021614552102141112542106111611562104121114522105141612532

=104125303131...... (8)

Taking modulo for equation .

10mod714mod725mod730mod732mod731mod7=364233

Therefore, the transformation of the sequence (0,1,1,1,5,2)is(3,6,4,2,3,3)

03

Solution of part (c).  

c.)

Inverse FFT of (3,6,4,2,3,3)::

Let P=(3,6,4,2,3,3) 鈥︹赌 (9)

Coefficient representation of M6((-1)) is shown below:

Inverse FFT(P)=16PM6(-1)鈥︹赌 (10)

To represent the matrix form for the inverse FFT with modulo first find the modular inverse. Modular inverse of,

1mod7=12mod7=43mod7=54mod7=25mod7=36mod7=6(11)

To get localid="1659345943519" M6(-1), substitute the inverse of each values. Thus,

localid="1659346430928" M6(-1)=111111111111111514161213111412111412111611161116111214111214111312161415

Substitute equation (9), equation (12) in equation (10).

localid="1659346499692" InverseFTT(P)=1/6111111111111111514161213111412111412111611161116111214111214111312161415364233鈥︹赌

Thus, substitute the arithmetic value for the arithmetic value 11, for the arithmetic value 1,12, for the arithmetic value 5,14, for the arithmetic value 2,15, for the arithmetic value 3 and 16 for the arithmetic value 6 from equation (11) in equation (13) to find the inverse.

InverseFTT(P)=1/6111111111111111514161213111412111412111611161116111214111214111312161415364233

=6131614121313135644622333134624124323136614621363132644122343133624624353=6217655765168=126456330456306408 鈥︹赌 (14)

Taking modulo 7 for equation ( 14 ).

=126mod7456mod7330mod7446mod7306mod7408mod7=011152

Therefore, the transformation of the sequence (3,6,4,2,3,3)is(0,1,1,1,5,2)..

04

Solution of part (d).  

d.)

The standard form for degree-d polynomial is

A(x)=a0+a1x++adxd(15)

The first polynomial is x2+x+1(16)

Compare equation (15) and (16) equation

a0=1a1=1a2=1a3=0a4=0a5=0(17)

Consider the formula of polynomial to matrix transformation.

localid="1659427656504" a0a1a2a3a4a5 鈥︹赌

Substitute the values of a0,a1,a2,a3,a4,a5 in Equation (18)

A=111000鈥︹赌

Find FFT of (1,1,1,0,0,0)::

Substitute the values M6() from Equation (6) and A from Equation (19) in Equation (7) .

localid="1659418277264" FFTofA=111111132645124124161616142142154623111000=11+11+11+10+10+1011+31+21+60+40+5011+21+41+10+20+4011+61+11+60+10+6011+41+21+10+40+2011+51+41+60+20+30=3278710......20

Taking modulo 7 for the FFT of equation (20) .

3mod76mod77mod78mod77mod710mod7=360103

Therefore, the transformation of the sequence (1,1,1,0,0,0)is(3,6,0,1,0,3)

The second polynomial is x3+2x-1鈥︹赌

Compare equations (21) and equation (15)

a0=-1a1=2a2=0a3=1a4=0a5=0(22)

The value of is so take modulo as shown below:

-1mod7=6(23)

Thus,a0=-1 substitute a0 as 6 in equations (22)

a0=6a1=2a2=0a3=1a4=0a5=0

Consider the formula of polynomial to matrix transformation.

B=a0a1a2a3a4a5.....24

Substitute the values of a0,a1,a2,a3,a4,a5 in Equation (24) .

B=620100.....25

Find FFT of (6,2,0,1,0,0):

Substitute the values M6()from Equation (6) and B from Equation (25) in Equation (7) .

FFTofB=111111132645124124161616142142154623620100=161210111010163220614050162240112040166210611060164220114020165210612030=91811241522.....26

Taking modulo 7 for equation (26)

=9mod718mod711mod724mod715mod722mod7=244311

Therefore, the transformation of the sequence (6,2,0,1,0,0)is(2,4,4,3,1,1)

Let the product of FFT of A and B be P. The product is calculated as shown below:

P=AB(27)

Substitute the value of 鈥 A鈥 from Equation (19) and 鈥淏 鈥 from Equation (25) in Equation(27) .

P=360103244311=630303....28 鈥︹赌

Modular inverse of,

6mod7=624mod7=240mod7=03mod7=30mod7=03mod7=3....29

Substitute the Equation in Equation . Thus, the product is shown below:

P=630303....30

Inverse FFT:

To get the final polynomial in coefficient representation takes the inverse FFT for the product.

Substitute equation (30) , equation (12) in equation (10) .

InverseFTT(P)=16111111111111111514161213111412111412111611161116111214111214111312161415630303......31

Thus, substitute the arithmetic value 11 for the arithmetic value 1, 12 for the arithmetic value 4,13 for the arithmetic value 5,14 for the arithmetic value 2,15 for the arithmetic value 3 and 16 for the arithmetic value 6 from equation in(11) equation (13) to find the inverse.

localid="1659426193884" InverseFTT(P)=6111111111111111514161213111412111412111611161116111214111214111312161415630303=616+13+10+13+10+1316+33+20+63+40+5316+23+40+13+20+4316+63+10+63+10+6316+43+20+13+40+2316+53+40+63+20+33=6124827622748=90288162360162288......32

Taking modulo for equation .

=90mod7288mod7162mod7360mod7162mod7288mod7=611311......30

From equation (23) substitute 6 as -1 in equation (33)

InverseFFTof(P)=-111311

Therefore, the transformation of the sequence (3,6,4,2,3,3)is(-1,1,1,3,1,1). .

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with 91影视!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

In our median-finding algorithm (Section 2.4), a basic primitive is the split operation, which takes as input an array S and a value V and then divides S into three sets: the elements less than V , the elements equal to V , and the elements greater than V . Show how to implement this split operation in place, that is, without allocating new memory.

Section 2.2 describes a method for solving recurrence relations which is based on analyzing the recursion tree and deriving a formula for the work done at each level. Another (closely related) method is to expand out the recurrence a few times, until a pattern emerges. For instance, let鈥檚 start with the familiar T(n)=2T(n/2)+o(n). Think of o(n) as being role="math" localid="1658920245976" <cnfor some constant , so: T(n)<2T(n/2)+cn. By repeatedly applying this rule, we can bound T(n) in terms of T(n/2), then T(n/4), then T(n/8), and so on, at each step getting closer to the value of T(.) we do know, namely .

T(1)=0(1).

T(n)2T(n/2)+cn2[2Tn/4+cn/2]+cn=4T(n/4)+2cn4[2Tn/8+cn/4]+2cn=8T(n/8)+3cn8[2Tn/16+cn/8]+3cn=16T(n/16)+4cn

.

.

.

A pattern is emerging... the general term is

T(n)2kT(n/2k)+kcn

Plugging in k=log2n, we get T(n)nT(1)+cnlog2n=0(nlogn).

(a)Do the same thing for the recurrence T(n)=3T(n/2)+0(n). What is the general kth term in this case? And what value of should be plugged in to get the answer?(b) Now try the recurrence T(n)=T(n-1)+0(1), a case which is not covered by the master theorem. Can you solve this too?

You are given an array of nelements, and you notice that some of the elements are duplicates; that is, they appear more than once in the array. Show how to remove all duplicates from the array in time O(nlogn) .

In Section 2.1 we described an algorithm that multiplies two n-bit binary integers x and y in time na, where a=log23. Call this procedure fast multiply (x,y).

(a) We want to convert the decimal integer 10n(a 1 followed by n zeros) into binary. Here is the algorithm (assume n is a power of 2):

function pwr2bin(n)

if n = 1: return10102

else:

z= ???

return fastmultiply(z,z)

Fill in the missing details. Then give a recurrence relation for the running time of the algorithm, and solve the recurrence.

(b) Next, we want to convert any decimal integer x with n digits (where n is a power of 2) into binary. The algorithm is the following:

function dec2bin(x)

if n=1: return binary [ x ]

else:

split x into two decimal numbers xt,xRwith n/2 digits each

return ???

Here binary [.] is a vector that contains the binary representation of all one-digit integers. That is, binary role="math" localid="1659333641173" [0]=02, binary [1]=12, up to binary [9]=10012. Assume that a lookup in binary takes 0(1) time. Fill in the missing details. Once again, give a recurrence for the running time of the algorithm, and solve it.

A kway merge operation. Suppose you have ksorted arrays, each with nelements, and you want to combine them into a single sorted array ofkn elements.

(a)Here鈥檚 one strategy: Using the merge procedure from Section 2.3, merge the first two arrays, then merge in the third, then merge in the fourth, and so on. What is the time complexity of this algorithm, in terms of kand n?

(b) Give a more efficient solution to this problem, using divide-and-conquer.

See all solutions

Recommended explanations on Computer Science Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.