The Euclidean Algorithm
Total Page:16
File Type:pdf, Size:1020Kb
1. The Euclidean algorithm. The euclidean algorithm is used to find GCD(a; b), the greatest common divisor of two positive integers a; b 2 N, and can be used to find m; n 2 Z so that: GCD(a; b) = ma + nb: In particular, if p is a prime, GCD(a; p) = 1, so writing 1 = ma + np we −1 find that in the field Zp (of residues mod(p)) we have: (¯a) =m ¯ . ¯ Example. Find the multiplicative inverse of 11 in Z37. The euclidean algorithm gives: 37 = 3 × 11 + 4; 11 = 2 × 4 + 3; 4 = 3 + 1: Thus: 1 = 4 − 3 = 37 − 3 × 11 − [11 − 2 × (37 − 3 × 11)] = 3 × 37 − 10 × 11; ¯ −1 ¯ ¯ or m = −10; n = 3. Thus (11) = −10 = 27 in Z37. ¯ −1 Problem 1. Find (4) in the field Z31. 2. Long division. Suppose x 2 [0; 1) has an eventually periodic decimal representation: x = 0:m1m2 : : : mN d1d2 : : : dT : Then: N+T N 10 x − m1 : : : mN d1 : : : dT = 10 x − m1 : : : mN = 0:d1 : : : dT : Hence: N T 10 (10 − 1)x = m1 : : : mN d1 : : : dT − m1 : : : mN := m 2 N; or: m d : : : d x = (x = 1 T if the expansion is periodic): 10N (10T − 1) 10T − 1 In other words: any real number (in [0; 1)) with an eventually periodic decimal expansion is rational, and can be written in the form m=q, where q is a difference of powers of 10. (Or, considering base 2 expansions, with q a difference of powers of two.) 1 And yet any rational number has an eventually periodic decimal expan- sion! This can be established by considering long division. Consider x = p=q with p; q 2 N, p < q. We have (interpreting the long division algorithm): 10p = d1q + r1; 10r1 = d2q + r2; 10r2 = d3q + r3;::: p and this gives the decimal expansion: q = 0:d1d2d3 :::. The sequence of remainders takes values in the finite set f0; 1; : : : ; q − 1g, so eventually a remainder has to be repeated, and after that the whole sequence of digits in the decimal expansion repeats. Thus the expansion is eventually periodic, with period T ≤ q − 1 (if a remainder is zero, this means the expansion is finite, so either eventually 0's or eventually 9's, depending on which one you choose.) 2 Example. (seen in class) 7 = 0:285714. This is gotten from long division: 20 = 2×7+6; 60 = 8×7+4; 40 = 5×7+5; 50 = 7×7+1; 10 = 1×7+3; 30 = 4×7+2: This implies: 2 285714 = ; hence 7 divides 106 − 1 = 999; 999: 7 106 − 1 2 2 We can get the binary expansion easily if we observe that 7 = 23−1 : it is periodic with period 3. Since 2 written in base 2 is 10, we have: 2 ( ) = 0:010: 7 base 2 Problem 2. (i) Use the eventually periodic expansion of 5=7 to write it in the form m=q, where q is a difference of powers of 10. (ii) Write down the binary expansion of 5=7. p Problemp 3. Find the multiplicative inverse of x = −3 + 5 7 in the field Q( 7). Problem 4. Consider two arbitrary polynomials of degree 2 and integer coefficients: 2 2 p(x) = a0 + a1x + a2x ; q(x) = b0 + b1x + b2x ; aj; bj 2 Z: Show that if their product p(x)q(x) (of degree 4) is the zero polynomial (that is, has all its coefficients 0), then at least one of p(x); q(x) is the zero polynomial. (Hint: Show that a0b0 = 0 and a2b2 = 0. This gives four cases to consider). 2 This problem shows that the fact that the ring Z[x] is an integral domain (i.e., has no zero divisors) has a non-trivial proof. Recall that a commutative ring R is an integral domain if: (8x; x¯ 2 R)xx¯ = 0 ! (x = 0 _ x¯ = 0): A commutative ring is a field if every non-zero element has a multiplicative inverse: (8x 2 R)x 6= 0 ! (9x0 2 R)xx0 = 1: Problem 5. Show that any field is an integral domain. 3.