Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Location arithmetic wikipedia , lookup
Mathematics of radio engineering wikipedia , lookup
Elementary algebra wikipedia , lookup
Elementary mathematics wikipedia , lookup
Collatz conjecture wikipedia , lookup
System of polynomial equations wikipedia , lookup
List of prime numbers wikipedia , lookup
Days 3 and 4 Division with remainder • Today we will figure out how to solve these Diophantine equations. The trick will be to realize that just like both sides of the equation must be divisible by the same numbers, they must also have the same remainder when divided by the same number. • So we need a way to talk about the remainders when divided by a given number. • What do the numbers 9, 16, 23, 30, 37 all have in common? Well, when you divide them by 7, you get a remainder of 2. In other words, when it comes to dividing by 7, these numbers are all the same. • We say that the numbers are congruent modulo 7. They all belong to the same remainder class modulo 7. We write, for example, 9 ≡ 16 (mod 7). • That is, a ≡ b (mod d) means a and b have the same remainder when divided by d. • Do lots of random examples and non-examples. Negative numbers work too. • Some nice facts: if a ≡ b (mod d) and e ≡ f (mod d) then, 1. a + e ≡ b + f (mod d) 2. a − e ≡ b − f (mod d) 3. ae ≡ bf (mod d) • These make sense. If 9 and 16 both have remainder 2 when divided by 7, and we add something with remainder 3 to 9, and something else with remainder 3 to 16, the results will both have remainder 5 when divided by 7. • If x ≡ 3 (mod 8) and y ≡ 5 (mod 8), to what is x + y congruent modulo 8? How about x · y? • The idea is, we can replace any number in a congruence modulo d with another element of it’s remainder class (modulo d). • For example, what is the remainder when 326 is divided by 7? Solving Linear Congruences • We want to solve congruence problems like 3x ≡ 5 (mod 7). So in general, congruences of the form ax ≡ b (mod d). What we need are some rules for the “algebra.” • We have already seen that we can add or subtract the same thing to both sides. Also multiply. But can we divide? • Careful, everything must be whole numbers. But what about 6x ≡ 42 (mod 8). Here dividing both sides by 6 does not give any fractions. But it is still not okay: • What if x = 3. Then it is true that 18 ≡ 42 (mod 8). But 3 �≡ 7 (mod 8). However, we could do 3 ≡ 7 (mod 4). d • Here’s the rule. If ax ≡ ay (mod d), then x ≡ y (mod gcd(a,d) ). Note that if a and d are relatively prime, then we can cancel the a without changing d. • Ex: Simplify 24 ≡ 39 (mod 5) and 24 ≡ 39 (mod 15). • Ex: Solve for x: 3x ≡ 15 (mod 20) and 8x ≡ 12 (mod 20). Also, try 2x ≡ 5 (mod 6) (no solutions - why?) • Here’s a rule to determine how many solutions a congruence has: The congruence ax ≡ b (mod d) is solvable iff gcd(a, d)|b. If it is solvable, then the number of solutions is gcd(a, d). • Ex: How many solutions: 3x ≡ 6 (mod 8), 3x ≡ 6 (mod 9), 3x ≡ 1 (mod 6) and 4x ≡ 26 (mod 98). • Now, if there are solutions, we should be able to find them. Canceling helps, but not always: 3x ≡ 1 (mod 5). Can’t divide by 3. But if we add 5 to 1, we get 6. This is legal since we are really adding a remainder of 0 to both sides. Then we get 3x ≡ 6 (mod 5), so x ≡ 2 (mod 5). • Ex: Solve 7x ≡ 6 (mod 37). (154/7 = 22). Also solve: 18x ≡ 42 (mod 40). Solving Linear Diophantine Equations • Solve 56x + 20y = 32. First, check that there are even any solutions: does gcd(56, 20)|32? Yes. So why don’t we divide both sides by that. • We get 14x + 5y = 8. Now we convert to a congruence modulo a or b. Usually, pick the smaller one. so we get • 14x + 5y ≡ 8 (mod 5). Notice that this lets us get rid of the variable y. Now we solve the congruence like before. • 14x ≡ 8 (mod 5) −→ 4x ≡ 3 (mod 5) −→ 4x ≡ 8 (mod 5) −→ x ≡ 2 (mod 5). Now back to an equation. • x = 2 + 5k for all integers k. What is y? Solve 14(2 + 5k) + 5y = 8 −→ y = 4 + 14k. • Ex: Solve 17x − 19y = 1. Find all solutions with 50 ≤ x ≤ 100. • Ex: Solve 171x + 47y = 54. First get 5x ≡ 9 (mod 47). Rewrite this as 5x + 47k = 9. Now solve this Diophantine equation. Then plug back in to find x, and then back into the original to find y. • Ex: How can you make $6.30 using only dimes and quarters? What if you have at least 20 dimes and at least 15 quarters.