12 applied modern algebra - slac national … · 12 applied modern algebra in this chapter we...

23
12 Applied Modern Algebra In this chapter we describe just a few of the techniques of applied algebra, including ¿nding integer solutions to equations, solving modular equations, and linear program- ming. Solving Equations Many techniques in applied modern algebra are designed to solve equations, from inte- ger equations to polynomial equations to matrix equations. In this section, we describe a few of the methods that can be applied to such problems. Integer Solutions The operation Integer on the Solve submenu ¿nds integer solutions to equations and systems of equations. L Solve + Integer 6{ .7| @ 43, Solution is : i{ @7Q 43>| @ 6Q . 43j Thus, one solution is given by { @ 43 and | @ 43, and every solution is of the form { @7Q 43 and | @ 6Q .43> where Q is any integer. As a check, note that, if { @7Q 43 and | @ 6Q . 43> then 6{ .7| @ 6+7Q 43, . 7+6Q . 43, @ 63 . 73 @ 43. In a similar manner, a system of equations can be solved for integer solutions. L Solve + Integer 6{ .5| @8 6{ } @4 , Solution is : i{ @8 5Q >| @ 8.6Q >} @ 9Q . 47j Indeed, if {, |, and } are given by the stated equations, then, for any integer Q , we have 6{ .5| @ 6+8 5Q ,.5+8.6Q ,@8 and 6{ } @ 6+8 5Q , +9Q . 47, @ 4. Recursive Solutions Recursion ¿nds solutions to a recursion or a system of recursions. For example, to

Upload: phungkien

Post on 25-Aug-2018

235 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 12 Applied Modern Algebra - SLAC National … · 12 Applied Modern Algebra In this chapter we describe just a few of the techniques of applied algebra, including ¿nding integer solutions

12 Applied Modern Algebra

In this chapter we describe just a few of the techniques of applied algebra, including¿nding integer solutions to equations, solving modular equations, and linear program-ming.

Solving Equations

Many techniques in applied modern algebra are designed to solve equations, from inte-ger equations to polynomial equations to matrix equations. In this section, we describea few of the methods that can be applied to such problems.

Integer Solutions

The operationInteger on theSolve submenu¿nds integer solutions to equations andsystems of equations.

L Solve + Integer

6{. 7| @ 43, Solution is :i{ @ 7Q4 � 43> | @ �6Q4 . 43j

Thus, one solution is given by{ @ �43 and| @ 43, and every solution is of theform{ @ 7Q4�43 and| @ �6Q4.43> whereQ4 is any integer. As a check, note that,if { @ 7Q4�43 and| @ �6Q4.43> then6{.7| @ 6+7Q4�43,.7+�6Q4.43, @�63 . 73 @ 43.

In a similar manner, a system of equations can be solved for integer solutions.

L Solve + Integer

6{. 5| @ 86{� } @ 4

, Solution is :i{ @ 8� 5Q4> | @ �8 . 6Q4> } @ �9Q4 . 47j

Indeed, if{, |, and} are given by the stated equations, then, for any integerQ4,we have6{ . 5| @ 6+8 � 5Q4, . 5 +�8 . 6Q4, @ 8 and6{ � } @ 6 +8� 5Q4, �+�9Q4 . 47, @ 4.

Recursive Solutions

Recursion ¿nds solutions to a recursion or a system of recursions. For example, to

Page 2: 12 Applied Modern Algebra - SLAC National … · 12 Applied Modern Algebra In this chapter we describe just a few of the techniques of applied algebra, including ¿nding integer solutions

390 Chapter 12 Applied Modern Algebra

solve the recursion |+q . 5, . 6|+q . 4, . 5|+q, @ 3, choose Recursion from theSolve submenu.

L Solve + Recursion

| +q. 5, . 6| +q. 4, . 5| +q, @ 3,

Solution is : i| +q, @ +5| +3, . | +4,, +�4,q . +�| +3,� | +4,, +�5,qj

You can also specify the initial conditions by listing a system of equations in a col-umn matrix.

L Solve + Recursion

| +q. 5, . 6| +q. 4, . 5| +q, @ 3| +3, @ �5| +4, @ 4

, Solution is :i| +q, @ �6 +�4,q . +�5,qj

This closed-form solution now makes it easy to¿nd speci¿c terms. For example, ifyou de¿ne|+q, @ �6+�4,q . +�5,q, then|+q, can be directly evaluated.

L Evaluate

| +53, @ 437;8:6

Systems of recursive equations also can be solved.

L Solve + Recursion

|+q. 4, . }+q, @ q. 5q.4

}+q. 4,� |+q, @ q. 6� 5q

|+4, @ 4}+4, @ 5

, Solution is :i| +q, @ �4 . 5q> } +q, @ q. 4j

In particular,}+43, @ 44 and|+43, @ 4356.

Integers Modulo m

Two integersd ande arefrqjuxhqw prgxor p if and only ifd�e is a multiple ofp, inwhich case we writed � e +prgp,. Thus,48 � 66 +prg<,, because48� 66 @ �4;is a multiple of<. Given integersd andp, theprg ixqfwlrq is given bydprgp @ eif and only if d � e +prgp, and3 � e � p � 4� hence,dprgp is the smallestqrqqhjdwlyh uhvlgxh of d modulop.

The underlying computer algebra system does not understand the congruence nota-tion d � e +prgp,, but it does understand the function notationdprgp. This sectionshows how to translate problems in algebra and number theory into language that willbe handled correctly.

Page 3: 12 Applied Modern Algebra - SLAC National … · 12 Applied Modern Algebra In this chapter we describe just a few of the techniques of applied algebra, including ¿nding integer solutions

Integers Modulo m 391

Note that prg is a function of two variables, with the function written betweenthe two variables. This usage is similar to the common usage of ., which is also afunction of two variables with the function values expressed as d . e, rather than theusual functional notation .+d> e,.

Traditionally the congruence notation d � e +prgp, is written with the prgpenclosed inside parentheses since the prgp clari¿es the expression d � e. In this con-text, the expressione +prgp, never appears without the precedingd �. On the otherhand, theprg function is usually written in the formdprgp without parentheses.

L To evaluate the mod function

1. Leave the insertion point in the expressiondprg e=

2. ChooseEvaluate.

L Evaluate

56prg47 @ <

If d is positive, you can also¿nd the smallest nonnegative residue ofd modulop byapplyingExpand to the quotientdp .

L Expand

56

47@ 4

<

47

Since4 <47 @ 4. <

47 , multiplication of 5647 @ 4. <47 by 47 shows that56prg47 @ <.

In terms of the?? functione{f, the mod function is given bydprgp @ d��dp

�p

.

L Evaluate

56� �5647

�47 @ <

Multiplication Tables Modulo m

You can make tables that display the products modulop of pairs of integers from theseti3> 4> 5> = = = >p� 4j.

L To get a multiplication table modulo p with p @ 9

1. De¿ne the functionj+l> m, @ +l� 4,+m � 4,.

Page 4: 12 Applied Modern Algebra - SLAC National … · 12 Applied Modern Algebra In this chapter we describe just a few of the techniques of applied algebra, including ¿nding integer solutions

392 Chapter 12 Applied Modern Algebra

2. From the Matrices submenu, choose Fill Matrix.

3. Select De¿ned by Function.

4. Enter j in the Enter Function Name box.

5. Select 6 rows and 6 columns.

6. Choose OK.

7. Type prg9 at the right of the matrix. (Type in mathematics mode� prg will auto-matically turn gray.)

8. ChooseEvaluate.

L Evaluate

59999997

3 3 3 3 3 33 4 5 6 7 83 5 7 9 ; 433 6 9 < 45 483 7 ; 45 49 533 8 43 48 53 58

6::::::8prg9 @

59999997

3 3 3 3 3 33 4 5 6 7 83 5 7 3 5 73 6 3 6 3 63 7 5 3 7 53 8 7 6 5 4

6::::::8

You can also¿nd this matrix as the product of a column matrix with a row matrix.

L Evaluate

59999997

345678

6::::::8�3 4 5 6 7 8

�@

59999997

3 3 3 3 3 33 4 5 6 7 83 5 7 9 ; 433 6 9 < 45 483 7 ; 45 49 533 8 43 48 53 58

6::::::8

59999997

3 3 3 3 3 33 4 5 6 7 83 5 7 9 ; 433 6 9 < 45 483 7 ; 45 49 533 8 43 48 53 58

6::::::8prg9 @

59999997

3 3 3 3 3 33 4 5 6 7 83 5 7 3 5 73 6 3 6 3 63 7 5 3 7 53 8 7 6 5 4

6::::::8

Make a copy of this last matrix. From theEdit menu chooseAdd Row(s)..., add anew row at the top, chooseAdd Column(s)..., add a new column at the left, and¿ll inthe blanks to get the following multiplication table modulo 6:

Page 5: 12 Applied Modern Algebra - SLAC National … · 12 Applied Modern Algebra In this chapter we describe just a few of the techniques of applied algebra, including ¿nding integer solutions

Integers Modulo m 393

� 0 1 2 3 4 50 0 0 0 0 0 01 0 1 2 3 4 52 0 2 4 0 2 43 0 3 0 3 0 34 0 4 2 0 4 25 0 5 4 3 2 1

From the table, we see that 5 � 7prg9 @ 5 and 6 � 6prg9 @ 6. (The extra horizontaland vertical lines were added for clarity, but are not essential. To use these typesettingfeatures, you must ¿rst copy the matrix entries into a table, then revise the table.)

A more ef¿cient way to generate the same multiplication table is to de¿ne j+l> m, @+l � 4,+m � 4,prg9, then to add a row and a column to the original matrix. A cleverway to make this table is to de¿ne j+l> m, @ ml� 5m mm � 5m, choose Fill Matrix from theMatrices submenu, choose De¿ned by Function from the dialog box, specify j for thefunction, and set the matrix size to 7 rows and 7 columns. You can generate an additiontable by de¿ning j+l> m, @ l. m � 5prg9.

Example 97 If s is a prime, then the integers modulo s form a ¿eld, called a Jdorlv�hog and denoted JIs. For the prime s @ :, you can generate the multiplication tableby de¿ning j+l> m, @ +l � 4,+m � 4,prg: and choosing Fill Matrix from the Matrixsubmenu, then selecting De¿ned by function from the dialog box. You can generatethe addition table in a similar manner using the function i+l> m, @ l. m � 5prg:.

� 0 1 2 3 4 5 60 0 0 0 0 0 0 01 0 1 2 3 4 5 62 0 2 4 6 1 3 53 0 3 6 2 5 1 44 0 4 1 5 2 6 35 0 5 3 1 6 4 26 0 6 5 4 3 2 1

. 0 1 2 3 4 5 60 0 1 2 3 4 5 61 1 2 3 4 5 6 02 2 3 4 5 6 0 13 3 4 5 6 0 1 24 4 5 6 0 1 2 35 5 6 0 1 2 3 46 6 0 1 2 3 4 5

Inverses Modulo m

If deprgp @ 4, then e is called an lqyhuvh of dprgxor p> and we write d�4prgpfor the least positive residue of e.

L Evaluate

8�4prg: @ 6

This calculation satis¿es the de¿nition of inverse, because 8 � 6prg: @ 4. Othernotation for the inverse modulo p includes 4@dprgp and 4

d prgp=

L Evaluate

56�4prg58: @ 4<3 48 prg9 @ 8

Page 6: 12 Applied Modern Algebra - SLAC National … · 12 Applied Modern Algebra In this chapter we describe just a few of the techniques of applied algebra, including ¿nding integer solutions

394 Chapter 12 Applied Modern Algebra

The notation d@eprgp is interpreted as d+e�4prgp,prgp� that is, ¿nd theinverse of e modulo p, multiply the result by d> and then reduce the product modulo p.

L Evaluate

6@56prg58: @ 89 58 prg9 @ 7

Note that d�4prgp exists if and only if d is uhodwlyho| sulph to p� that is, it existsif and only if jfg+d>p, @ 4. Thus, modulo 9, only 4 and 8 have inverses. Modulo anyprime, every nonzero residue has an inverse. In terms of the multiplication table modulop, the integer d has an inverse modulo p if and only if 4 appears in row dprgp (and4 appears in column dprgp).

Solving Congruences Modulo m

To solve a congruence of the form d{ � e +prgp,, multiply both sides by d�4prgpto get { @ e@dprgp.

The congruence 4:{ � 56 +prg45:, has a solution { @ <4, as the following stepsillustrate.

L Evaluate

56@4:prg45: @ <4

Check this result by substitution back into the original congruence.

L Evaluate

4: � <4 prg45: @ 56

Note that, since <4 is a solution to the congruence 4:{ � 56 +prg45:,, additionalsolutions are given by <4 . 45:q, where q is any integer. In fact, { � <4 +prg45:, isjust another way of writing { @ <4 . 45:q for some integer q.

Pairs of Linear Congruences

Since linear congruences of the form d{ � e +prgp, can be reduced to simple con-gruences of the form{ � f +prgp,, we consider systems of congruences in this latterform.

Example 98 Consider the system of two congruences{ � 78 +prg56:,

{ � 4< +prg74<,

Checking,jfg+56:> 74<, @ 4, so56: and74< are relatively prime. The¿rst congruencecan be rewritten in the form{ @ 78 . 56:n for some integern. Substituting this value

Page 7: 12 Applied Modern Algebra - SLAC National … · 12 Applied Modern Algebra In this chapter we describe just a few of the techniques of applied algebra, including ¿nding integer solutions

Integers Modulo m 395

into the second congruence, we see that78 . 56:n @ 4< . 74<u

for some integer u. This last equation can be rewritten in the form 56:n @ 4< �78prg74<, which has the solution

n @ +4<� 78,@56:prg74< @ 93

Hence,{ @ 78 . 56: � 93 @ 47598

Checking, 47598prg56: @ 78 and 47598prg74< @ 4<.

Example 99 The complete set of solutions is given by{ @ 47598 . 56: � 74<v � 47598 +prg<<636,

Thus, the original pair of congruences has been reduced to a single congruence,{ � 47598 +prg<<636,

In general, if p and q are relatively prime, then a solution to the pair{ � d +prgp,

{ � e +prgq,

is given by{ @ d.p ^+e� d,@pprgq`

A complete set of solutions is given by{ @ d.p ^+e� d,@pprgq` . upq

where u is an arbitrary integer.

Systems of Linear Congruences

You can reduce systems of any number of congruences to a single congruence by solvingsystems of congruences two at a time. The Fklqhvh uhpdlqghu wkhruhp states that,if the moduli are relatively prime in pairs, then there is a unique solution modulo theproduct of all the moduli.

Example 100 Consider the system of three linear congruences{ � 78 +prg56:,

{ � 4< +prg74<,

{ � 8: +prg856,

Checking, jfg+56: � 74<> 856, @ 4� hence this system has a solution. The ¿rst twocongruences can be replaced by the single congruence { � 47598 +prg<<636,� hencethe three congruences can be replaced by the pair

{ � 47598 +prg<<636,

{ � 8: +prg856,

As before, 47598 . <<636n @ 8: . 856u for some integers n and u. Thus, n @+8:� 47598, @<<636prg856 @ 467� hence { @ 47598 . <<636 � 467 @ 46653;9:.This system of three congruences can thus be reduced to the single congruence

{ � 46653;9: +prg 84<6879<,

Page 8: 12 Applied Modern Algebra - SLAC National … · 12 Applied Modern Algebra In this chapter we describe just a few of the techniques of applied algebra, including ¿nding integer solutions

396 Chapter 12 Applied Modern Algebra

Extended Precision Arithmetic

Computer algebra systems support exact sums and products of integers that are hundredsof digits long. One way to do such extended precision arithmetic is to generate a set ofmutually relatively prime bases, and to do modular arithmetic modulo all of these bases.For example, consider the vector

+<<:> <<<> 4333> 4334> 4336> 433:> 433<,

of bases. Factorization shows that the entries are pairwise relatively prime.

L Factor

5999999997

<<:<<<433343344336433:433<

6::::::::8@

5999999997

<<:666:5686

:� 44� 464:� 8<4<� 86433<

6::::::::8

Consider the two numbers 56;<3;973<7 and 4;;65;<789. You can represent thesenumbers by reducing the numbers modulo each of the bases. Thus,

56;<3;973<7 #$

5999999997

56;<3;973<7prg <<: @ 68356;<3;973<7prg <<< @ ;:556;<3;973<7prg4333 @ <756;<3;973<7prg4334 @ <:56;<3;973<7prg4336 @ ;:<56;<3;973<7prg433: @ 89756;<3;973<7prg433< @ 54;

6::::::::8

4;;65;<789 #$

5999999997

4;;65;<789prg <<: @ 6574;;65;<789prg <<< @ 9634;;65;<789prg4333 @ 7894;;65;<789prg4334 @ 7;4;;65;<789prg4336 @ 7;;4;;65;<789prg433: @ :34;;65;<789prg433< @ 6:

6::::::::8

Thus, the product 56;<3;973<7 � 4;;65;<789 is represented by the vector5999999997

683 � 657prg <<: @ :6<;:5 � 963prg <<< @ <3<<7 � 789prg4333 @ ;97<: � 7;prg4334 @ 985

;:< � 7;;prg4336 @ 9:4897 � :3prg433: @ 53:54; � 6:prg433< @ 4336

6::::::::8

The product 56;<3;973<7 � 4;;65;<789 is now a solution to the system

Page 9: 12 Applied Modern Algebra - SLAC National … · 12 Applied Modern Algebra In this chapter we describe just a few of the techniques of applied algebra, including ¿nding integer solutions

Integers Modulo m 397

{ � :6< +prg<<:,

{ � <3< +prg<<<,

{ � ;97 +prg4333,

{ � 985 +prg4334,

{ � 9:4 +prg4336,

{ � 53: +prg433:,

{ � 4336 +prg433<,

Powers Modulo m

L To calculate large powers modulo p

� Evaluate dqprgp.

De¿ne d @ 5:;<8<96:;59:5:8, q @ 6;7;8<36;<37:67<, and p @ 5;6;7<389686:78<.

L Evaluate

dqprgp @ 59553 4;474 3<;5;

Ihupdw*v Olwwoh Wkhruhp states that, if s is prime and 3 ? d ? s, thends�4prg s @ 4

The integer 1009 is prime, and the following is no surprise.

L Evaluate

5433;prg433< @ 4

Generating Large Primes

There is not a built-in function to generate large primes, but the underlying computa-tional system does have such a function. The following is an example of how to de¿nefunctions that correspond to existing functions in the underlying computational system.(See page 116 for another example of accessing such a function.) In this example,s+{,is de¿ned as theScienti¿c WorkPlace (Notebook) Name for the Maple function,nextprime(x), which generates the next larger prime.

L To de¿ne s+{, as the next-prime function

1. From the De¿ne submenu, choose De¿ne Maple Name.

Page 10: 12 Applied Modern Algebra - SLAC National … · 12 Applied Modern Algebra In this chapter we describe just a few of the techniques of applied algebra, including ¿nding integer solutions

398 Chapter 12 Applied Modern Algebra

2. Enter nextprime(x) as the Maple Name.

3. Enter s+{, as the Scienti¿c WorkPlace (Notebook) Name.

4. Click OK. (Leave other options blank.)

Test the function using Evaluate.

L Evaluate

s+7, @ 8 s+833, @ 836 s+;5<;, @ ;644

s +5:6;7<:5;<85:8;<56, @ 5:6 ;7<:5 ;<85: 8;<6<

Example 101 The Rivest-Shamir-Adleman (RSA) cipher system is based directly onEuler’s theorem and requires a pair of large primes. First, generate a pair of largeprimes—say,

t @ s+53<67;678:6, @ 53<67;6797:and

u @ s +58<6;76:7:67:, @ 58<6;76:7:78:(In practice, larger primes are used� say,t � 43433 andu � 43433.) Then

q @ tu

@ 53<67;6797: � 58<6;76:7:78:@ 876 349;< <8649 :454: 759:<

and the number of positive integers� q and relatively prime toq is given by*+q, @ +t � 4,+u � 4,

@ 53<67;67979 � 58<6;76:7:789@ 876 349;< <8388 56764 938:9

Let { @ 5<6;7:6:;7<8:9:5;6:8 be plaintext (suitably generated by a short section ofEnglish text). Long messages must be broken up into small enough chunks that each

Page 11: 12 Applied Modern Algebra - SLAC National … · 12 Applied Modern Algebra In this chapter we describe just a few of the techniques of applied algebra, including ¿nding integer solutions

Other Systems Modulo m 399

plaintext integer { is smaller than the modulus q. Choose H to be a moderately largepositive integer that is relatively prime to *+q,, say H @ 433<. The ciphertext is givenby

| @ {H prgq @ 539696734;;7:958;464:5<Let

G @ 433<�4prg*+q, @ 758489<6;498;:39:7;<78Then friendly colleagues can recover the plaintext by calculating

} @ |Gprgq @ 5<6;7:6:;7<8:9:5;6:8

Other Systems Modulo m

The mod function also works with matrices and with polynomials.

Matrices Modulo m

To reduce a matrix D modulo p, enter the expression Dprgp and evaluate it.

L Evaluate�

8 ;< 7

�prg6 @

�5 53 4

3C 6 : 8

8 7 ;5 3 8

4D

�4

prg44 @

3C < < 6

5 8 46 6 43

4D

3C 6 : 8

8 7 ;5 3 8

4D

3C < < 6

5 8 46 6 43

4Dprg44 @

3C 4 3 3

3 4 33 3 4

4D

Example 102 The Hamming (7,4) code operates on 4-bit message words (half a byte,and hence aqleeoh) and generates 7-bit code words.

De¿ne K @

5997

4 4 4 3 3 3 34 3 3 4 4 3 33 4 3 4 3 4 34 4 3 4 3 3 4

6::8

Given a message wordp, the corresponding code word is given bypKprg5 @ f.Thus,

�4 3 4 4

�5997

4 4 4 3 3 3 34 3 3 4 4 3 33 4 3 4 3 4 34 4 3 4 3 3 4

6::8prg5 @

�3 4 4 3 3 4 4

Page 12: 12 Applied Modern Algebra - SLAC National … · 12 Applied Modern Algebra In this chapter we describe just a few of the techniques of applied algebra, including ¿nding integer solutions

400 Chapter 12 Applied Modern Algebra

The message word appears in bits 3, 5, 6, and 7. The remaining 3 bits can be thoughtof as generalized parity bits. The code word is then transmitted. At the receiving end,another matrix multiplication is done to check for errors.

De¿ne S @

5999999997

3 3 43 4 33 4 44 3 34 3 44 4 34 4 4

6::::::::8

Example 103 The matrix product fS prg5 @�3 3 3

�indicates that no errors

were detected and the message wordp is taken to be bits 3, 5, 6, and 7 of the code word.However, if the code word is corrupted and f @

�3 3 4 3 3 4 4

�is received,

then fS prg5 @�3 4 3

�, which is the binary equivalent of 2, and hence an error

occurred in the second bit. Thus, the correct code word is�3 4 4 3 3 4 4

�.

The message word from columns 3, 5, 6, and 7 is then�4 3 4 4

�.

Example 104 A wzr0e|0wzr eorfn flskhu is given by�|4|5

�@

�d44 d45d54 d55

� �{4{5

�prg59

where the {ls represent plaintext, the |ls represent ciphertext, and the matrix entries are

integers. For example,�

8 ;5 :

� �744

�prg59 @

�7:

�means that the plaintext pair

^H>O` (two adjacent letters in the secret message “Elroy was here”) gets mapped to theciphertext pair̂H>K`, using the correspondenceD ' 3> E ' 4> F ' 5> = = = > ] ' 58=

Given the ciphertext, you can recover the plaintext by computing the inverse of thetwo-by-two matrix modulo 26. For example,�

8 ;5 :

��4

prg59 @

�58 497 6

and hence �58 497 6

� �7:

�prg59 @

�744

recovers the original plaintext. You can handle longer messages by replacing the column

vector�

HO

�by the matrix

�H U \ D K UO R Z V H H

�and calculating one matrix

product�58 497 6

� �7 4: 57 3 : 4:44 47 55 4; 7 7

�prg59 @

�49 58 49 5 8 5456 9 9 5 47 5

�=

Polynomials Modulo m

Theprg function can also be combined with polynomials:

Page 13: 12 Applied Modern Algebra - SLAC National … · 12 Applied Modern Algebra In this chapter we describe just a few of the techniques of applied algebra, including ¿nding integer solutions

Polynomials Modulo Polynomials 401

L Evaluate

{8 . <{7 � {6 . :{� 5prg8 @ {8 . 7{7 . 7{6 . 5{. 6

Thus Evaluate reduces each of the coef¿cients modulo 8.Given a prime s, the set of polynomials with coef¿cients reduced modulo s is a ring,

denoted by JIs^{`.

L To calculate a product of polynomials d+{, and e+{, in JIs^{`

1. Expand the product d+{,e+{,=

2. Reduce the product modulo s=

To calculate the product of 7{8.8{.6 and 9{7.{6.6 in JI:^{`, do the followingsteps.

L Expand

�7{8 . 8{. 6

� �9{7 . {6 . 6

�@ 57{< . 7{; . 75{8 . 56{7 . 6{6 . 48{. <

L Evaluate

57{<.7{;.75{8.56{7.6{6.48{.<prg: @ 6{<.7{;.5{7.6{6.{.5

The sum of 7{8 . 8{. 6 and 9{7 . {6 . 6 in JI:^{` is slightly simpler.

L Evaluate�7{8 . 8{. 6

�.�9{7 . {6 . 6

�prg: @ 7{8 . 9{7 . {6 . 8{. 9

Polynomials Modulo Polynomials

Two polynomials i+{, and j+{, are frqjuxhqw prgxor d sro|qrpldo t+{, if and onlyif i+{,� j+{, is a multiple of t+{,, in which case we write

i+{, � j+{, +prg t+{,,

We writej+{,prg t+{, @ k+{,

if k+{, is a polynomial of minimal degree that is congruent to j+{, modulo t+{,.

L Evaluate

{7 . {. 4prg�{5 . 7{. 8

�@ �56{� 87

To verify this calculation, note the following.

Page 14: 12 Applied Modern Algebra - SLAC National … · 12 Applied Modern Algebra In this chapter we describe just a few of the techniques of applied algebra, including ¿nding integer solutions

402 Chapter 12 Applied Modern Algebra

L Polynomials + Divide

{7 . {. 4

{5 . 7{. 8@ {5 � 7{. 44 .

�56{� 87

{5 . 7{. 8

This result implies that indeed {7 . {. 4prg�{5 . 7{. 8

�@ �56{� 87.

Greatest Common Divisor of Polynomials

The juhdwhvw frpprq glylvru ri wzr sro|qrpldov s+{, and t+{, is a polynomial g+{,of highest degree that divides both s+{, and t+{,.

De¿ne s+{, @ 4;{: � <{8 . 69{7 . 7{6 � 49{5 . 4<{. 45 and t+{, @ 48{8 �<{7 . 44{6 . 4:{5 � 43{. ;, then use Evaluate to calculate jfg +s+{,> t+{,, =

L Evaluate

jfg +s+{,> t+{,, @ 6{6 . {. 7

Use the following to verify that 6{6 . {. 7 is indeed a common divisor.

L Polynomials + Divide

4;{: � <{8 . 69{7 � 8{6 � 49{5 . 49{

6{6 . {. 7@ 9{7 � 8{5 . 7{

48{8 � <{7 . 44{6 . 4:{5 � 43{. ;

6{6 . {. 7@ 8{5 � 6{. 5

Thus,s+{, @

�9{7 � 8{5 . 7{. 6

� �6{6 . {. 7

�and

t+{, @�8{5 � 6{. 5

� �6{6 . {. 7

Multiplicity of Roots of Polynomials

A root d of a polynomial i+{, has pxowlsolflw| n if i+{, @ +{�d,nj+{,, where j+d, 9@3. If n A 4, then i 3+{, @ n+{ � d,n�4j+{, . +{ � d,nj3+{, @ +{ � d,n�4+nj+{, .+{ � d,j3+{,,, and hence jfg+i+{,> i 3+{,, @ +{ � d,n�4k+{, 9@ 4. This observationprovides a test for multiple roots: If jfg +i+{,> i 3+{,, is a constant, then i+{, has nomultiple roots� otherwise, i+{, has at least one multiple root.

The graphs ofi+{, @ 886:{8 � 67;37{7 . 9355<{6 � 5<59:{5 . 4<;;;{. 879<5

andj+{, @ 886:{8 � 67:<:{7 . 9353:{6 � 5<593{5 . 4<;:6{. 879:3

appear indistinguishable. Both appear to have a root near 3.1.

Page 15: 12 Applied Modern Algebra - SLAC National … · 12 Applied Modern Algebra In this chapter we describe just a few of the techniques of applied algebra, including ¿nding integer solutions

Polynomials Modulo Polynomials 403

0

20000

40000

60000

80000

100000

-2 -1 1 2 3 4x

i+{,

0

20000

40000

60000

80000

100000

-2 -1 1 2 3 4x

j+{,

However,

L Evaluate

jfg+i+{,> i 3+{,, @ :<4{� 57;9

whereas

L Evaluate

jfg+j+{,> j3+{,, @ :

Thus, { @ 57;9@:<4 @ 55@: is a root of i+{, of multiplicity at least 5, whereasj+{, has no multiple roots. Solving i+{, @ 3 and j+{, @ 3, the real solutions are asfollows.

L Solve + Exact

i+{, @ 3, Solution is :�{ @ 55

:

�>�{ @ 55

:

�>;?

={ @ � 6

t�45 . 4

4;

s<6�.

4

6 6

t�45 . 4

4;

s<6�<@>

j+{, @ 3, Solution is :�{ @ 55

:

�>�{ @ 688

446

�>;?

={ @ � 6

t�45 . 4

4;

s<6�.

4

6 6

t�45 . 4

4;

s<6�<@> >

L Solve + Numeric

i+{, @ 3, Solution is : i{ @ �=9;566j > i{ @ 6=475<j > i{ @ 6=475<jj+{, @ 3, Solution is : i{ @ �=9;566j > i{ @ 6=4749j > i{ @ 6=475<j

Page 16: 12 Applied Modern Algebra - SLAC National … · 12 Applied Modern Algebra In this chapter we describe just a few of the techniques of applied algebra, including ¿nding integer solutions

404 Chapter 12 Applied Modern Algebra

Thus, j has two distinct roots that are extremely close, whereas i has a root ofmultiplicity two.

The Galois Field GFR?

Assume that t+{, is an luuhgxfleoh polynomial of degree q over JIs� that is, assumethat t+{, is of degree q and, whenever t+{, @ d+{,e+{, for some d+{, and e+{, inJIs^{`, then either ghj+d+{,, @ 3 or ghj+e+{,, @ 3. Given two polynomials i+{, andj+{, in JIs^{`, de¿ne the product to be the polynomial +i+{,j+{,prg t+{,,prg sand the sum to be the polynomial +i+{, . j+{,,prg s. With these de¿nitions, the setof polynomials in JIs^{` of degree less than q forms a ¿eld called the Jdorlv �hogJIsq .

The set of polynomials in JI5^{` of degree less than 5 forms the ¿eld JI55 @ JI7.The multiplication and addition tables for JI5 are given by

� 0 10 0 01 0 1

. 0 10 0 11 1 0

The polynomial t+{, @ {5 . { . 4 is an (in fact, the only) irreducible polynomial ofdegree 5 over JI5. The elements of JI7 are 3, 4, {, and 4 . {.

To ¿nd the product { �{ in JI7> reduce the product modulo {5.{.4> then reducethe result modulo 5=

L Evaluate

+{5prg t+{,,prg5 @ {. 4

Thus, {5 @ {.4 in JI7. You can generate the entire multiplication table ef¿cientlyusing matrix and modular arithmetic.

L Evaluate

5997

34{

{. 4

6::8�

3 4 { {. 4�@

5997

3 3 3 33 4 { {. 43 { {5 { +{. 4,

3 {. 4 { +{. 4, +{. 4,5

6::8

Page 17: 12 Applied Modern Algebra - SLAC National … · 12 Applied Modern Algebra In this chapter we describe just a few of the techniques of applied algebra, including ¿nding integer solutions

Polynomials Modulo Polynomials 405

5997

3 3 3 33 4 { {. 43 { {5 { +{. 4,

3 {. 4 { +{. 4, +{. 4,5

6::8prg{5 . {. 4

@

5997

3 3 3 33 4 { {. 43 { �{� 4 �43 {. 4 �4 {

6::8

5997

3 3 3 33 4 { {. 43 { �{� 4 �43 {. 4 �4 {

6::8prg5 @

5997

3 3 3 33 4 { {. 43 { {. 4 43 {. 4 4 {

6::8

Sums require only reduction of polynomial sums modulo 5. The multiplication andaddition tables are given by

� 0 1 { {. 40 0 0 0 01 0 1 { {. 4{ 0 { {. 4 1

{. 4 0 {. 4 1 {

. 0 1 { {. 40 0 1 { {. 41 1 0 {. 4 {{ { {. 4 0 1

{. 4 {. 4 { 1 0

Given a polynomial i+{, @ d{. e with d and e in JI5, consider the binary representa-tion +de,5. The binary representations for the multiplication and addition tables forJI7

are given by

� 00 01 10 1100 00 00 00 0001 00 01 10 1110 00 10 11 0111 00 11 01 10

. 00 11 10 1100 00 01 10 1101 01 00 11 1010 10 11 00 0111 11 10 01 00

Converting from binary to decimal, we have3 @ +33,5, 4 @ +34,5, 5 @ +43,5, and6 @+44,5. Using this shorthand notation for polynomials, the multiplication and additiontables become

� 0 1 2 30 0 0 0 01 0 1 2 32 0 2 3 13 0 3 1 2

. 0 1 2 30 0 1 2 31 1 0 3 22 2 3 0 13 3 2 1 0

Page 18: 12 Applied Modern Algebra - SLAC National … · 12 Applied Modern Algebra In this chapter we describe just a few of the techniques of applied algebra, including ¿nding integer solutions

406 Chapter 12 Applied Modern Algebra

Example 105 This setting provides the basis for the Bose-Chaudhuri-Hocquenghem(BCH) Codes. Given the message word+du> du�4> ===> d5> d4> d3,5 as a number in base 2,associate the polynomiald+{, @ du{u.du�4{u�4. � � �.d5{5.d4{.d3 in JI5^{`.A codeword is then generated by the formulad+{,t+{,prg5, wheret+{, is a speciallyselected polynomial.

Consider the Galois¿eld JI57 @ JI49. Let � be a primitive element inJI49,so that the nonzero elements ofJI49 are all powers of�. In particular, this propertyholds if we take� to be a root of the irreducible polynomial{7 . { . 4. Let pl+{,be the minimal polynomial of�l. If t+{, @ ofp^p4+{,>p5+{,> ===>p5w+{,`, then thecorresponding BCH code corrects at leastw errors.

Since�7 . � . 4 @ 3, it follows that35 @��7 . �. 4

�5@

��7

�5. �5 . 4 @�

�5�7

. �5 . 4� hence,p4+{, @ p5+{,. By the same reasoning,p5+{, @ p7+{, @p;+{,. Likewise,p6+{, @ +{��6,+{��9,+{��45,+{��<, @ {7.{6.{5.{.4�hence, a double error-correcting code is generated by

t+{, @ ofp^p4+{,>p5+{,>p6+{,>p7+{,`prg5 @ {; . {: . {9 . {7 . 4

Linear Programming

A olqhdu surjudpplqj sureohp consists of minimizing (or maximizing) a linear func-tion subject to certain conditions or constraints expressible as linear inequalities.

The Simplex Algorithm

The basic purpose of the simplex algorithm is to solve linear programming problems. Inthe following example, the functioni+{> |, @ { . | is to be maximized subject to thetwo inequalities shown. The functioni+{> |, is theremhfwlyh ixqfwlrq, and the set oflinear constraints is called theolqhdu v|vwhp.

L To enter a linear programming problem with two constraints

� Create a6� 4 matrix.

� Type the function to be maximized in the¿rst row.

� Type the linear constraints in the subsequent rows.

� Leave the insertion point in the matrix.

� From theSimplex submenu, chooseMaximize.

L Simplex + Maximize

57 {. |

7{. 6| � 96{. 7| � 7

68, Maximum is at:

�{ @ 45

: > | @ �5:

Page 19: 12 Applied Modern Algebra - SLAC National … · 12 Applied Modern Algebra In this chapter we describe just a few of the techniques of applied algebra, including ¿nding integer solutions

Linear Programming 407

Of course, these are the same coordinates that minimize �{ � |. In the followinglinear programming problem, click the matrix, and from the Simplex submenu chooseMinimize.

L Simplex + Minimize

�{� |7{. 6| � 96{. 7| � 7

, Minimum is at:�| @ �5

: > { @ 45:

Feasible Systems

Two things may prevent the existence of a solution. There may be no values of { and |satisfying the constraints. Even if there are such values, there may be none maximizingthe objective function. If there are values satisfying the constraints, the system is calledihdvleoh.

The following example illustrates a set of inequality constraints with no function tobe maximized or minimized. You can ask whether the constraints are feasible—thatis, whether they de¿ne a nonempty set. Just click the matrix, and from theSimplexsubmenu chooseFeasible.

L Simplex + Feasible?

7{. 6| � 96{. 7| � 7

{ � 3| � 3

, Is feasible? true

7{. 6| � 97{. 6| � :

, Is feasible? false

Saying that the system7{. 6| � 97{. 6| � :

is not feasible implies, in particular, that there

are no values minimizing the objective function in the problem{. |

7{. 6| � 97{. 6| � :

.

Standard Form

A system of linear inequalities is invwdqgdug irup when all the inequalities are of theform�. To convert a system of linear inequalities to a system in standard form, chooseStandardize from theSimplex submenu.

Page 20: 12 Applied Modern Algebra - SLAC National … · 12 Applied Modern Algebra In this chapter we describe just a few of the techniques of applied algebra, including ¿nding integer solutions

408 Chapter 12 Applied Modern Algebra

L Simplex + Standardize

7{. 6| � 96{. 7| � 7

{ � 3| � 3

, System in standard form is:

7{. 6| � 96{. 7| � 7�{ � 3�| � 3

With a linear function added, you can maximize the resulting linear programmingproblem.

L Simplex + Maximize

{. 6|6{� | � 77{. 6| � 9

�| � 3�{ � 3

, Maximum is at: i{ @ 3> | @ 5j

The Dual of a Linear Program

The other item on the Simplex menu is Dual. It computes the dual of a linear program.

L Simplex + Dual

{. |7{. 6| � 96{. 7| � 7

{ � 3�| � 3

, Dual system is:9v4 . 7v5

4 � 6v4 . 7v5 � v74 � 7v4 . 6v5 � v6

Applying the simplex algorithm to these two linear programs yields the followingresults.

L Simplex + Maximize

{. |7{. 6| � 96{. 7| � 7

{ � 3�| � 3

, Maximum is at:�| @ 3> { @ 7

6

Page 21: 12 Applied Modern Algebra - SLAC National … · 12 Applied Modern Algebra In this chapter we describe just a few of the techniques of applied algebra, including ¿nding integer solutions

Exercises 409

L Simplex + Minimize

9v4 . 7v54 � 7v4 . 6v5 � v74 � 6v4 . 7v5 � v6v4 � 3v5 � 3v6 � 3v7 � 3

, Minimum is at:�v7 @ 3> v4 @ 3> v5 @

46 > v6 @

46

Exercises

1. Give a multiplication table for the integers modulo 44. From the table, ¿nd theinverses of 5 and 6. Verify your answers by evaluating 5�4prg44 and 6�4prg44.

2. Solve the congruence 8{ . 7 � ; +prg46,. Verify your answer by evaluating8{. 6prg46.

3. A jar of jelly beans sits on a table. If the jelly beans are evenly divided among ¿vechildren, there are three jelly beans left over� and if the jelly beans are evenly dividedamong seven adults, there are ¿ve jelly beans left over. How many jelly beans are inthe jar? Are other solutions possible? If so, what are they?

4. What is the smallest 433-digit prime?

5. If s is the smallest433-digit prime, what is5s�4prg s? What is5+s�4,@5prg s?What about5+s�4,@7prg s?

6. The matrixP @

57 4 4 4

4 5 74 7 <

68 is used as a block cipher modulo 26 to scramble

letters in a message, three letters at a time. AssumeD ' 3, E ' 4, F ' 5, and soforth. Descramble the ciphertextINEKUWPWX .

7. Find an irreducible polynomial of degree6. Use this polynomial to describe how tocalculate sums and products in the¿eldJI5:.

8. A barge company transports bales of hay and barrels of beer up the Mississippi River.The company charges $2.30 for each bale of hay and $3.00 for each barrel of beer.The bales of hay average 75 pounds and take up 5 cubic feet of space� the barrelsof beer weigh 100 pounds and take up 4 cubic feet of space. A barge is limited toa payload of 150,000 pounds and 8,000 cubic feet. How much beer and how muchhay should a barge transport to maximize the shipping charges?

Page 22: 12 Applied Modern Algebra - SLAC National … · 12 Applied Modern Algebra In this chapter we describe just a few of the techniques of applied algebra, including ¿nding integer solutions

410 Chapter 12 Applied Modern Algebra

Solutions

1. De¿ne the function i+l> m, @ lm. From the Matrix submenu, choose Fill Matrix with10 rows and 10 columns, and use the function i to generate a matrix. Then, reducethe matrix prg44 to get the following:

4 5 6 7 8 9 : ; < 435 7 9 ; 43 4 6 8 : <6 9 < 4 7 : 43 5 8 ;7 ; 4 8 < 5 9 43 6 :8 43 7 < 6 ; 5 : 4 99 4 : 5 ; 6 < 7 43 8: 6 43 9 5 < 8 4 ; 7; 8 5 43 : 7 4 < 9 6< : 8 6 4 43 ; 9 7 543 < ; : 9 8 7 6 5 4

Select the matrix, from the Edit menu choose Insert Column(s), and add 1 columnat position 1. You have now added a column on the left. Repeat this procedure usingInsert Row(s), adding a row at position 1. Fill in the empty boxes with � and theintegers 1 through 10 to generate the ¿nal multiplication table,

� 4 5 6 7 8 9 : ; < 434 4 5 6 7 8 9 : ; < 435 5 7 9 ; 43 4 6 8 : <6 6 9 < 4 7 : 43 5 8 ;7 7 ; 4 8 < 5 9 43 6 :8 8 43 7 < 6 ; 5 : 4 99 9 4 : 5 ; 6 < 7 43 8: : 6 43 9 5 < 8 4 ; 7; ; 8 5 43 : 7 4 < 9 6< < : 8 6 4 43 ; 9 7 543 43 < ; : 9 8 7 6 5 4

From the table, 5 � 9 @ 4 implies 5�4 @ 9, and 6 � 7 @ 4 implies 6�4 @ 7. As acheck, 5�4prg44 @ 9 and 6�4prg44 @ 7.

2. The solution is given by { @ +;�7,@8prg46 @ 9. As a check, 9 �8.7prg46 @;.

3. The problem requires the solution to the system{ � 6 +prg8,

{ � 8 +prg:,

of congruences. The system is equivalent to the equation { @ 6 . 8d @ 8 . :e, or6 . 8d � 8 +prg:,, which has a solution d @ +8� 6,@8prg: @ 9, which means{ @ 6 . 8d @ 66 jelly beans. Other possible solutions are { @ 66 . 68q, where qis any positive integer.

Page 23: 12 Applied Modern Algebra - SLAC National … · 12 Applied Modern Algebra In this chapter we describe just a few of the techniques of applied algebra, including ¿nding integer solutions

Solutions 411

4. De¿ne the function qh{ws as indicated in this chapter. Then qh{ws+43<<, producesa number with lots of zeroes that ends in 289. The prime s can be written as s @43<< . 5;<.

5. Note that 5s�4prg s @ 4 and 5+s�4,@5prg s @ 4, whereas 5+s�4,@7prg s pro-duces another number with lots of zeroes that ends in5;;. More precisely,5+s�4,@7 ��4prg s. This congruence illustrates the fact that, ifs is a prime, then{5 �4 +prg s, has only two solutions,{ � 4 +prg s, and{ � �4 +prg s,.

6. We have

57 4 4 4

4 5 74 7 <

68�4

prg59 @

57 57 8 57

8 4; 657 6 58

68. The ciphertextF K B H R

T M T U has a numerical equivalent of^8> 43> 4> :> 4:> 4<> 45> 4<> 53`. Picking threeat a time, we get5

7 57 8 578 4; 657 6 58

6857 8 : 45

43 4: 4<4 4< 53

68prg59 @

57 45 : 8

3 ; 534< 4; 46

68

The vector̂45> 3> 4<> :> ;> 4;> 8> 53> 46` corresponds to the plaintextM A T H I S FU N, or MATH IS FUN.

7. De¿ning j+{, @ {6 . { . 4, we see thatj+4,prg6 @ 3, and hencej+{, isnot irreducible (since it has a root inJI6). However, if i+{, @ {6 . 5{ . 4,theni+3,prg6 @ 4, i+4,prg6 @ 4, andi+5,prg6 @ 4, and hencei+{, isirreducible. (Ifi+{, were reducible, it would have a linear factor, and hence a root.)An element ofJI5: can be thought of as a polynomial of degree less than 3 withcoef¿cients inJI6. Given the¿eld elements5{5.{.5 and5{.4, the product is��5{5 . {. 5

�+5{. 4,prg {6 . 5{. 4

�prg6 @ {5 .4, and the sum is given

by�5{5 . {. 5

�. +5{. 4,prg6 @ 5{5.

8. The objective function is5=6k . 6e. The constraints are7k . 8e � ;333, :8k .433e � 483333, e � 3, andk � 3. Apply Maximize from theSimplex submenu tothe system

5=6k. 6e8k. 7e � ;333

:8k. 433e � 483333e � 3k � 3

to get the result: Maximum is7883 atk @ 4333> e @ :83.