hw04-sol-2

pdf

School

University of California, Berkeley *

*We aren’t endorsed by this school

Course

70

Subject

Computer Science

Date

Oct 30, 2023

Type

pdf

Pages

8

Report

Uploaded by DeanKangaroo5110

CS 70 Discrete Mathematics and Probability Theory Fall 2023 Rao, Tal HW 04 1 Modular Practice Note 6 Solve the following modular arithmetic equations for x and y . (a) 9 x + 5 7 ( mod 13 ) . (b) Show that 3 x + 12 4 ( mod 21 ) does not have a solution. (c) The system of simultaneous equations 5 x + 4 y 0 ( mod 7 ) and 2 x + y 4 ( mod 7 ) . (d) 13 2023 x ( mod 12 ) . (e) 7 62 x ( mod 11 ) . Solution: (a) Subtract 5 from both sides to get: 9 x 2 ( mod 13 ) . Now since gcd ( 9 , 13 ) = 1, 9 has a (unique) inverse mod 13, and since 9 × 3 = 27 1 ( mod 13 ) the inverse is 3. So multiply both sides by 9 1 3 ( mod 13 ) to get: x 6 ( mod 13 ) . (b) Notice that any number y 4 ( mod 21 ) can be written as y = 4 + 21 k (for some integer k ). Evaluating y mod 3, we get y 1 ( mod 3 ) . Since the right side of the equation is 1 ( mod 3 ) , the left side must be as well. However, 3 x + 12 will never be 1 ( mod 3 ) for any value of x . Thus, there is no possible solution. (c) First, subtract the first equation from four times the second equation to get: 4 ( 2 x + y ) ( 5 x + 4 y ) 4 ( 4 ) 0 ( mod 7 ) 8 x + 4 y 5 x 4 y 16 ( mod 7 ) 3 x 2 ( mod 7 ) Multiplying by 3 1 5 ( mod 7 ) , we have x 10 3 ( mod 7 ) . Plugging this into the second equation, we have 2 ( 3 )+ y 4 ( mod 7 ) , so the system has the solution x 3 ( mod 7 ) , y 5 ( mod 7 ) . CS 70, Fall 2023, HW 04 1
(d) We use the fact that 13 1 ( mod 12 ) . Thus, we can rewrite the equation as x 13 2023 1 2023 1 ( mod 12 ) . (e) One way to solve exponentiation problems is to test values until one identifies a pattern. 7 1 7 ( mod 11 ) 7 2 49 5 ( mod 11 ) 7 3 = 7 · 7 2 7 · 5 2 ( mod 11 ) 7 4 = 7 · 7 3 7 · 2 3 ( mod 11 ) 7 5 = 7 · 7 4 7 · 3 10 ≡ − 1 ( mod 11 ) We theoretically could continue this until we the sequence starts repeating. However, notice that if 7 5 ≡ − 1 = 7 10 = ( 7 5 ) 2 ( 1 ) 2 1 ( mod 11 ) . Similarly, 7 60 = ( 7 10 ) 6 1 6 1 ( mod 11 ) . As a final step, we have 7 62 = 7 2 · 7 60 7 2 · 1 = 49 5 ( mod 11 ) . 2 Nontrivial Modular Solutions Note 6 (a) What are all the possible perfect cubes modulo 7? In other words, compute the set { x 3 mod 7 | x Z } . (b) Show that any solution to x 3 + 2 y 3 0 ( mod 7 ) must satisfy x y 0 ( mod 7 ) . (c) Using part (b), prove that x 3 + 2 y 3 = 7 x 2 y has no non-trivial solutions ( x , y ) in the integers. In other words, there are no integers x and y , that satisfy this equation, except the trivial solution x = y = 0. [ Hint: Consider some nontrivial solution ( x , y ) with the smallest value for | x | (why are we allowed to consider this?). Then arrive at a contradiction by finding another solution ( x , y ) with | x | < | x | .] Solution: (a) Checking by hand, the only perfect cubes modulo 7 are 0, 1, and 6 ≡ − 1: 0 3 0 ( mod 7 ) 4 3 1 ( mod 7 ) 1 3 1 ( mod 7 ) 5 3 ≡ − 1 ( mod 7 ) 2 3 1 ( mod 7 ) 6 3 ≡ − 1 ( mod 7 ) 3 3 ≡ − 1 ( mod 7 ) (b) Considering the equation x 3 + 2 y 3 0 ( mod 7 ) and considering all cases for x 3 and y 3 , the only way that x 3 + 2 y 3 0 ( mod 7 ) is if x 3 y 3 0 ( mod 7 ) . Thus x y 0 ( mod 7 ) . CS 70, Fall 2023, HW 04 2
(c) We first show that if ( x , y ) is a solution to x 3 + 2 y 3 = 7 x 2 y , then x = 0 implies that y = 0. In other words, if x = 0, then the solution must be trivial. To see why this is the case, suppose that x = 0. Then y 3 = 0, and so y = 0. Thus, any nontrivial solution must have x ̸ = 0, or equivalently, | x | > 0. If ( x , y ) is a solution to the original equation, then this is also a solution to x 3 + 2 y 3 0 ( mod 7 ) . From part (b), we know that x , y are all divisible by 7, which in turn means that x 3 , y 3 are divisible by 7 3 . Thus, we can divide the entire original equation by 7 3 , to see that x 7 3 + 2 y 7 3 = 7 x 7 2 y 7 . Indeed, ( x / 7 , y / 7 ) is another solution where all the values are integers, and | x / 7 | < | x | (as | x | > 0). We’ve reached a contradiction to our initial assumption, which was that ( x , y ) was the solution with the least value of | x | . (This is a valid assumption since the | x | are positive integers, and a non-empty set of positive integers has a minimum.) Thus, there does not exist a nontrivial solution to x 3 + 2 y 3 = 7 x 2 y . 3 Squares Note 6 Note 7 Let p be a prime greater than 2. We will prove that there exists an integer a such that a 2 ≡ − 1 ( mod p ) if and only if p 1 ( mod 4 ) . (a) Show that if p 3 ( mod 4 ) , there is no integer a such that a 2 ≡ − 1 ( mod p ) . (Hint: Use Fermat’s Little Theorem.) (b) Wilson’s Theorem states the following is true if and only if p is prime: ( p 1 ) ! ≡ − 1 ( mod p ) . Prove both directions (it holds if and only if p is prime). Hint for the if direction: Consider rearranging the terms in ( p 1 ) ! = 1 · 2 ····· ( p 1 ) to pair up terms with their inverses, when possible. What terms are left unpaired? Hint for the only if direction: If p is composite, then it has some prime factor q . What can we say about ( p 1 ) ! ( mod q ) ? (c) Show that if p 1 ( mod 4 ) , there is an integer a such that a 2 ≡ − 1 ( mod p ) . (Hint: Consider a = p 1 2 !, then use Wilson’s Theorem.) Solution: CS 70, Fall 2023, HW 04 3
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
(a) Suppose for the sake of a contradiction that there exists a solution a . First, note that a 0 ( mod p ) is not a solution. Now, suppose a ̸≡ 0 ( mod p ) . Raise both sides to the p 1 2 power. Since p 3 ( mod 4 ) , p 1 2 is an odd integer. Thus, we have that 1 a p 1 ( a 2 ) p 1 2 ( 1 ) p 1 2 ≡ − 1 ( mod p ) , since 1 to an odd integer is 1. Thus, we have that p | 1 ( 1 ) = 2, which is not possible, since p 3 ( mod 4 ) . Thus, there is no solution to a 2 ≡ − 1 ( mod p ) , as desired. (b) Direction 1 : If p is prime, then the statement holds. For the integers 1 , ··· , p 1, every number has an inverse. However, it is not possible to pair a number off with its inverse when it is its own inverse. This happens when x 2 1 ( mod p ) , or when p | x 2 1 = ( x 1 )( x + 1 ) . Thus, p | x 1 or p | x + 1, so x 1 ( mod p ) or x ≡ − 1 ( mod p ) . Thus, the only integers from 1 to p 1 inclusive whose inverse is the same as itself are 1 and p 1. We reconsider the product ( p 1 ) ! = 1 · 2 ··· p 1. The product consists of 1, p 1, and pairs of numbers with their inverse, of which there are p 1 2 2 = p 3 2 . The product of the pairs is 1 (since the product of a number with its inverse is 1), so the product ( p 1 ) ! 1 · ( p 1 ) · 1 ≡ − 1 ( mod p ) , as desired. Direction 2 : The expression holds only if p is prime (contrapositive: if p isn’t prime, then it doesn’t hold). We will prove by contradiction that if some number p is composite, then ( p 1 ) ! ̸≡ − 1 ( mod p ) . Suppose for contradiction that ( p 1 ) ! ≡ − 1 ( mod p ) . Note that this means we can write ( p 1 ) ! as p · k 1 for some integer k . Since p isn’t prime, it has some prime factor q where 2 q n 2, and we can write p = q · r . Plug this into the expression for ( p 1 ) ! above, yielding us ( p 1 ) ! = ( q · r ) k 1 = q ( rk ) 1 = ( p 1 ) ! ≡ − 1 ( mod q ) . However, we know q is a term in ( p 1 ) !, so ( p 1 ) ! 0 ( mod q ) . Since 0 ̸≡ − 1 ( mod q ) , we have reached our contradiction. (c) Since p is odd, p 1 2 is an integer, so p 1 2 ! exists. Our goal here is to try to connect p 1 2 ! 2 to ( p 1 ) !, in order to utilize Wilson’s theorem; if we can show that p 1 2 ! 2 ( p 1 ) ! ( mod p ) , then Wilson’s theorem will directly give us the desired result. Notice that we can express p 1 2 ! 2 1 · 2 ··· p 3 2 · p 1 2 · p 1 2 · p 3 2 ··· 2 · 1 ( mod p ) CS 70, Fall 2023, HW 04 4
Now, if we can turn the second half of the expansion into the terms p + 1 2 , p + 3 2 , . . . , ( p 1 ) , then the entire expansion will equal ( p 1 ) !; to do this, we can negate each term in the second half of the expansion. Further, since p 1 ( mod 4 ) , we know that p 1 2 is even, so we’ve introduced an even number of factors of 1, and these negations will all cancel out. Using this and simplifying, we have 1 · 2 ··· p 3 2 · p 1 2 · p 1 2 · p 3 2 ··· ( 2 ) · ( 1 ) ( mod p ) 1 · 2 ··· p 3 2 · p 1 2 · p p 1 2 · p p 3 2 ··· ( p 1 ) ( mod p ) 1 · 2 ··· p 3 2 · p 1 2 · p + 1 2 · p + 3 2 ··· ( p 1 ) ( mod p ) ( p 1 ) ! ( mod p ) ≡ − 1 ( mod p ) where in the last line we applied Wilson’s Theorem. As such, we can conclude that p 1 2 ! 2 ≡ − 1 ( mod p ) , as desired. 4 Celebrate and Remember Textiles Note 6 Mathematics and computing both owe an immense debt to textiles, where many key ideas origi- nated. Instructions for knitting patterns will tell you to begin by “casting on” the needle some multiple of m plus r , where m is the number of stitches to create one repetition of the pattern and r is the number of stitches needed for the two edges of the piece. For example, in the simple rib stitch pattern below, the repeating pattern is of length m = 4, and you need r = 2 stitches for the edges. + × × + Pattern of length 4 Edge stitch Edge stitch Thus, to make the final piece wider, you can add as many multiples of the pattern of length 4 as you like; for example, if you want to repeat the pattern 3 times, you need to cast on a total of 3 m + r = 3 ( 4 )+ 2 = 14 stitches (shown below). CS 70, Fall 2023, HW 04 5
+ × × × × × × + Patterns of length 4 Edge stitch Edge stitch You’ve decided to knit a 70-themed baby blanket as a gift for your cousin and want to incorporate rows from three different stitch patterns with the following requirements: • Alternating Link: Multiple of 7, plus 4 • Double Broken Rib: Multiple of 4, plus 2 • Swag: Multiple of 5, plus 2 You want to be able to switch between knitting these different patterns without changing the num- ber of stitches on the needle, so you must use a number of stitches that simultaneously meets the requirements of all three patterns. Find the smallest number of stitches you need to cast on in order to incorporate all three patterns in your baby blanket. Solution: Let x be the number of stitches we need to cast on. Using the Chinese Remainder Theorem, we can write the following system of congruences: x 4 ( mod 7 ) x 2 ( mod 4 ) x 2 ( mod 5 ) . We have M = 7 · 4 · 5 = 140, r 1 = 4, m 1 = 7, b 1 = M / m 1 = 4 · 5 = 20, r 2 = 3, m 2 = 4, b 2 = M / m 2 = 7 · 5 = 35, and r 3 = 2, m 3 = 5, b 3 = M / m 3 = 7 · 4 = 28. We need to solve for the multiplicative inverse of b i modulo m i for i ∈ { 1 , 2 , 3 } : b 1 a 1 1 ( mod m 1 ) 20 a 1 1 ( mod 7 ) 6 a 1 1 ( mod 7 ) a 1 = 6 , b 2 a 2 1 ( mod m 2 ) 35 a 2 1 ( mod 4 ) 3 a 2 1 ( mod 4 ) a 2 = 3 , CS 70, Fall 2023, HW 04 6
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
and b 3 a 3 1 ( mod m 3 ) 28 a 3 1 ( mod 5 ) 3 a 3 1 ( mod 5 ) a 3 = 2 . Therefore, x 6 · 20 · 4 + 2 · 35 · 3 + 2 · 28 · 2 ( mod 140 ) 102 ( mod 140 ) , so the smallest x that satisfies all three congruences is 102. Therefore we should cast on 102 stitches in order to be able to knit all three patterns into the blanket. 5 Euler’s Totient Theorem Note 6 Note 7 Euler’s Totient Theorem states that, if n and a are coprime, a φ ( n ) 1 ( mod n ) where φ ( n ) (known as Euler’s Totient Function) is the number of positive integers less than or equal to n which are coprime to n (including 1). (a) Let the numbers less than n which are coprime to n be m 1 , m 2 ,..., m φ ( n ) . Argue that the set { am 1 , am 2 ,..., am φ ( n ) } is a permutation of the set { m 1 , m 2 ,..., m φ ( n ) } . In other words, prove that f : { m 1 , m 2 ,..., m φ ( n ) } → { m 1 , m 2 ,..., m φ ( n ) } is a bijection, where f ( x ) : = ax ( mod n ) . (b) Prove Euler’s Theorem. (Hint: Recall the FLT proof.) Solution: (a) This problem mirrors the proof of Fermat’s Little Theorem, except now we work with the set { m 1 , m 2 , ··· , m φ ( n ) } . Since m i and a are both coprime to n , so is a · m i . Suppose a · m i shared a common factor with n , and WLOG, assume that it is a prime p . Then, either p | a or p | m i . In either case, p is a common factor between n and one of a or m i , contradiction. CS 70, Fall 2023, HW 04 7
We now prove that f is injective. Suppose we have f ( x ) = f ( y ) , so ax ay ( mod n ) . Since a has a multiplicative inverse ( mod n ) , we see x y ( mod n ) , thus showing that f is injective. We continue to show that f is surjective. Take any y that is relatively prime to n . Then, we see that f ( a 1 y ) y ( mod n ) , so therefore, there is an x such that f ( x ) = y . Furthermore, a 1 y ( mod n ) is relatively prime to n , since we are multiplying two numbers that are relatively prime to n . (b) Since both sets have the same elements, just in different orders, multiplying them together gives m 1 · m 2 · ... · m φ ( n ) am 1 · am 2 · ... · am φ ( n ) ( mod n ) and factoring out the a terms, m 1 · m 2 · ... · m φ ( n ) a φ ( n ) ( m 1 · m 2 · ... · m φ ( n ) ) ( mod n ) . Thus we have a φ ( n ) 1 ( mod n ) . 6 Sparsity of Primes Note 6 A prime power is a number that can be written as p i for some prime p and some positive integer i . So, 9 = 3 2 is a prime power, and so is 8 = 2 3 . 42 = 2 · 3 · 7 is not a prime power. Prove that for any positive integer k , there exists k consecutive positive integers such that none of them are prime powers. Hint: This is a Chinese Remainder Theorem problem. We want to find n such that ( n + 1 ) , ( n + 2 ) , . . . , and ( n + k ) are all not powers of primes. We can enforce this by saying that n + 1 through n + k each must have two distinct prime divisors. Solution: We want to find n such that n + 1 , n + 2 , n + 3 ,..., n + k are all not powers of primes. We can enforce this by saying that n + 1 through n + k each must have two distinct prime divisors. So, select 2 k primes, p 1 , p 2 ,..., p 2 k , and enforce the constraints n + 1 0 ( mod p 1 p 2 ) n + 2 0 ( mod p 3 p 4 ) . . . n + i 0 ( mod p 2 i 1 p 2 i ) . . . n + k 0 ( mod p 2 k 1 p 2 k ) . By Chinese Remainder Theorem, we can calculate the value of n , so this n must exist, and thus, n + 1 through n + k are not prime powers. What’s even more interesting here is that we could select any 2 k primes we want! CS 70, Fall 2023, HW 04 8

Browse Popular Homework Q&A

Q: Consider connectionless protocols as an alternative to connection-based ones and analyze their…
Q: In a statistics class there are 18 juniors and 10 seniors; 6 of the seniors are females, and 12 of…
Q: Calculate the percent ionization of arsenous acid (H3AsO3) in solutions of each of the following…
Q: If you are driving home from school and have to slam on the brakes to avoid hitting a car that…
Q: objects have the same momentum, what else must be the same? Select all that apply. mass kinetic…
Q: What is the Federal Reserve and what is its role in Monetary Policy?
Q: In the context of the software business, what is the origin of the term "good enough"?
Q: Below is an IPO program which allows the user to find out how many Euros she will get for a given…
Q: Four solutions of an acid dissolved in water are sketched below, as if under a microscope so…
Q: I'm still a bit confused, how do we get (x-2) and (-7/3)?
Q: 1. Calculate the pH of the following solutions: a. A solution prepared by mixing 30.0 mL of 2.0M…
Q: ​For a two-tailed hypothesis test evaluating the significance of a correlation, the null hypothesis…
Q: Explain one difference between Enumerator and ListIterator in case of iterating across the elements?
Q: Which one is the key thing in backtracking? Insertion Recursion Submission   In what manner is…
Q: How many moles of nitrogen gas would be produced if 8.21 moles of copper(II) oxide were reacted with…
Q: (b) Upper-tailed test, n = 13, t = 3.2 P-value 0.05 x (c) Lower-tailed test, df = 10, t= -2.3…
Q: As a projectile moves in its path, is there any point along the path where the velocity and…
Q: Let A and B be sets. Prove that A union B = A intersection B if and only if A = B.
Q: For this reason, we need you to define "network security" for us. Use a well accepted method of data…
Q: Fill in the blank. Events that are Events that are cannot occur at the same time. unusual cannot…
Q: 4
Q: Find the net torque on the wheel in the figure below about the axle through O perpendicular to the…