1 / 12

Systems of Linear Equations

Systems of Linear Equations. Solve the system 4x + 7y = 9, 5x + 2y = 3 in Z 13 Use familiar techniques, realizing that division by k mean multiplying by k -1 mod 13

wray
Download Presentation

Systems of Linear Equations

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Systems of Linear Equations • Solve the system 4x + 7y = 9, 5x + 2y = 3 in Z13 • Use familiar techniques, realizing that division by k mean multiplying by k-1 mod 13 • 4-1 mod 13 = 10 and 5-1 mod 13 = 8, so multiply first equation by 10 and the second by 8 and reduce modulo 13 to get 40x + 70y = 90 mod 13  x + 5y = 12 40x + 16y = 24 mod 13  x + 3y = 11 • Now subtract second equation from the first to get 2y = 1 mod 13 • Since 2-1 = 7 mod 13, we get y = 7 and then x + 21 = 11 mod 13,x = -10 = 3 mod 13 • Thus we have solved the system of equations to get x = 3, y = 7

  2. Matrix Version of Simultaneous Linear Equations • If we extract the coefficients and right-hand constants, we obtain a matrix version of the equations called an augmented matrix • From our previous example: • We can use elementary row operations (adding a multiple of one row to another) to reduce the first two columns to the 2 by 2 identity matrix • From this it follows that x = 3 and y = 7 • Note that all arithmetic here is done mod 13

  3. Solving in the Rationals • The function from the rationals to Zn given by f(a/b) = ab-1 preserves addition and multiplication. It is only defined if b has an inverse in Zn • Thus, we may solve a system of linear equations in the rationals and then apply the function f. • Example: the system 4x+5y = 9, 5x+2y=3 has rational solution x = -3/17, y = 33/17. • Therefore in Z13, where all nonzero elements have inverses, x 13 -3/17 13 -3/4 13 10/4 13 104-113 1010 = 100 13 9 y 13 33/17 13 7/4 13 74-113 710 = 70 13 5

  4. Solving ax = b in Zn • We have already seen that we can solve ax n b if a is relatively prime to n : just multiply both sides by a-1 • What if a is not relatively prime to n? Say d = gcd(a,n) > 1. • Answer: • If d does not divide b, then there is no solution • Assume d | b. Consider the congruence (a/d)x n/d b/dSince a/d, n/d and b/d are integers and a/d  (n/d), there is a unique solution x0 to this equation. • The solutions to the original congruence ax n b are x0, x0 + 2(n/d), . . . , x0 + (d-1)(n/d) (mod n) • Example: solve 12x = 21 (mod 39) gcd(12,39) = 3 which divides 21, so new congruence is 4x 13 7The solution to the new congruence is x0 = 5, so the solutions of 12x 39 21 are 5, 18, 31 in Z39

  5. Congruences with Different Moduli • It is often necessary to solve two or more congruences with different moduli • Example: x  3 (mod 5), x  5 (mod 7) • This means that x = 3 + 5r and x = 5 + 7s for some integers r,s • Thus x is an element of { …, -12, -7, -2, 3, 8, 13, 18, 23, 28, 33, …}  { …, -16, -9, -2, 5, 12, 19, 26, 33, …} = { …, -37, -2, 33, 68, … } • Notice that the elements in the intersection differ by multiples of 35 = 57, the product of our two moduli • This an example of a general phenomenon

  6. Chinese Remainder Theorem • Lemma If n  m, n | c and m | c, then mn | c • TheoremSuppose gcd(m,n) = 1. For any integers a,b there is exactly one solution mod mn of the congruences x m a, x n b. • Proof • By the generalized euclidean algorithm, there are integers s,t such that gcd(m,n) = 1 = ms + nt. • Thus ms n 1 and nt m 1. • Let x = bms + ant (mod mn). • Then x m ant m a, since nt m 1. • Similarly, x n bms n b, so x is a solution to the two congruences. • Suppose x1 were another solution. Then x m x1 and x n x1. • Thus x-x1 is a multiple of both m and n, hence a multiple of mn (Lemma) • This shows that any two solutions are congruent mod mn

  7. Chinese Remainder Theorem • The proof of the Chinese Remainder Theorem provides an algorithm for finding a solution. • Equivalently, one could proceed as follows: compute the inverse of m mod n, call it z. Then set x = a + mz(b-a). • Chinese Remainder Theorem (General Form) Let m1, …, mr be a pairwise relatively prime set of positive integers and let a1, … , ar be arbitrary integers. Then the systemx m1 a1, x m2 a2, . . . , x mr ar has a unique solution mod m1m2   mr • The proof is a simple induction on r, using the theorem on the previous slide. • CorollaryLet m1, …, mr be a pairwise relatively prime set of positive integers and let a be an arbitrary integer. If x m1 a, x m2 a, . . . and x mr a, then x m1m2…mr a.

  8. Modular Exponentiation • We will have occasion to want to compute xa (mod n) for integers x, a, and n • Example: compute 21234 (mod 789) • Computing 21234 and then reducing mod 789 is not practical, since we would have a number with too many digits before reduction. • Similarly, computing 22 then reducing, then multiplying by 2 and reducing, etc would be much too slow. • There is a better approach: repeatedly square and reduce

  9. Modular Exponentiation • There is a better approach to computing powers mod n than repeated multiplications followed by reducing mod n: • Repeatedly square and reduce • Example: compute 21234 (mod 789) • Compute 22 = 4, then 24 = 42 = 16, 28 = 162 = 256 • 216 = 2562 789 49, 232 789 492 789 34, 264 789 342 789 367 • 2128 789 3672 789 559, 2256 789 5592 789 37, • 2512 789 372 789 580, 21024 789 5802 789 286. • Now 21234 = 21024 + 128 + 64 + 16 + 2 = 21024 2128 264 216 22 789 286(559367)(494) 789 481 • Note that we never had to compute a number bigger than 7882

  10. Modular Exponentiation • The previous method for computing xa (mod n) requires at most log2n multiplications and never generates an intermediate value greater than n2 • The algorithm for computing exponents mod n is shown on the next slide

  11. Modular Exponentiation • For computation of exponents via a computer program, the Modular Exponentiation Algorithm can be used: • pow(x,e,n) { // returns xe mod n prod = 1 while (e > 1) { if ( e mod 2 == 1) prod = prod*x x = x2 mod n e = e/2 } return prod*x mod n

  12. Homework • Page 130: 2, 6 • Page 135-136: : 2, 4, 8 • Compute 4126 mod 127; you may use either the squaring method or by using the Modular Exponentiation algorithm

More Related