Understanding Modular Arithmetic: Equivalence Relations and Examples

clicker frequency ca n.w
1 / 25
Embed
Share

Explore the concept of modular arithmetic, equivalence relations, and examples related to it. Learn about the definitions, properties, and applications of modular arithmetic in discrete math. Understand how to determine equivalence classes and solve problems using modular arithmetic.

  • Modular Arithmetic
  • Equivalence Relations
  • Discrete Math
  • Mathematics
  • Relations

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Clicker frequency: CA CSE 20 DISCRETE MATH Prof. Shachar Lovett http://cseweb.ucsd.edu/classes/wi15/cse20-a/

  2. Todays topics Modular arithmetic Section 6.2 in Jenkyns, Stephenson

  3. Recall: equivalence relations Saw two equivalent definitions xRy is an equivalence relation if Symmetric: ?,?, ??? ??? Reflexive: ?, ??? Transitive: ?,?,?, ??? ??? ??? Equivalently: there is a partition of the universe to equivalence classes, and xRy iff x,y are in the same class Can be phrased as: ?,?????:? ? such that ??? ????? ? = ?????(?)

  4. Today: modular arithmetic A very important (and very useful) example of an equivalence relation Recall our example of {even,odd} classes: ??? 2| ? ? x,y are both even, or both odd Modular arithmetic generalizes this from 2 to any divisor

  5. Modular arithmetic: definition Fix ? 2 Define a relation: integers x,y are equivalent modulo m, if ? ??? ? = ? ??? ? Equivalently, ?|? ? Defines a partition of Z to m equivalence classes ??= {? ?:? ??? ? = ?} where ? {0,1, ,? 1}

  6. Modular arithmetic: examples ??= {? ?:? ??? ? = ?} What is [0]2? A. All integers B. 0 C. Even numbers D. Odd numbers E. Other

  7. Modular arithmetic: examples ??= {? ?:? ??? ? = ?} What is [1]2? A. All integers B. 1 C. Even numbers D. Odd numbers E. Other

  8. Modular arithmetic: examples ??= {? ?:? ??? ? = ?} What is [0]3? A. All integers B. All integers divisible by 3 C. All integers whose value mod 3 is equal to 1 D. All integers whose value mod 3 is equal to 2 E. Other

  9. Modular arithmetic: examples ??= {? ?:? ??? ? = ?} What is [1]3? A. All integers B. All integers divisible by 3 C. All integers whose value mod 3 is equal to 1 D. All integers whose value mod 3 is equal to 2 E. Other

  10. Modular arithmetic: examples ??= {? ?:? ??? ? = ?} What is [4]3? A. All integers B. All integers divisible by 3 C. All integers whose value mod 3 is equal to 1 D. All integers whose value mod 3 is equal to 2 E. Other

  11. Modular arithmetic: notation Notation: to say that ? ??, we typically write ? ? ??? ? More generally, for any two integers x,y we can write ? ? ??? ? which means that x,y belong to the same equivalence class modulo m, which means ?|? ?.

  12. Modular addition and multiplication Why is modular arithmetic so important? Because we can operate directly on the equivalence classes, adding and multiplying them (for a fixed modulus m) Definition: for any fixed ? 2, ??+ ??= And ?? ??= ? + ? ??? ?? ? ? ??? ?? Theorem: this is well defined What does this even mean???

  13. Modular addition Theorem: ??+ ??= ? + ? ??? ?? Interpretation: if we take any ? ??, and any ? ??, then it is always true that ? + ? ? + ? ??? ?? Equivalently: ? ??? ? + ? ??? ? ??? ? = ? + ? ??? ?

  14. Modular addition: proof Theorem: ??+ ??= ? + ? ??? ?? Proof: we need to show ? ??,? ??, ? + ? ??? ? = ? + ? ??? ? Let ? = ?? + ?,? = ?? + ? and ? + ? = ?? + ?, with ?,?,? {0, ,? 1}. Then: ? + ? = ? + ? ? + ? + ? = ? + ? + ? ? + ? So ? + ? ??, and also a + ? ??. QED.

  15. Modular addition: examples What is 02+ 12? 02 12 21 A. B. C. D. All integers E. Other

  16. Modular addition: examples What is 47+ 57? 17 27 72 74 A. B. C. D. E. Other

  17. Modular addition: examples What is 47+ 12? 57 514 72 114 A. B. C. D. E. Other

  18. Be careful! We can only add ??+ ?? if ? = ?. Otherwise, this is not defined!!! Also: in the special case of ? = 2, addition modulo 2 corresponds to XOR 02+ 02= 02 02+ 12= 12 12+ 02= 12 12+ 12= 02

  19. Modular multiplication Theorem: ?? ??= ? ? ??? ??

  20. Modular multiplication: proof Theorem: ?? ??= ? ? ??? ?? Proof: we need to show ? ??,? ??, ? ? ??? ? = ? ? ??? ? Let ? = ?? + ?,? = ?? + ? and ? ? = ?? + ?, with ?,?,? {0, ,? 1}. Then: ? ? = ?? + ? ?? + ? = ???2+ ??? + ??? + ?? = ???2+ ??? + ??? + ?? + ? = ? ??? + ?? + ?? + ? + ? So ? ? ??, and also a ? ??. QED.

  21. Applications of modular arithmetic For a fixed ? 2, we can add, multiply and take modulo m, and the value (modulo m) will stay invariant This is very useful; many algorithmic applications Example 1: verifying calculations Prove that 12294793 2329373 92739273 Hint: use values modulo 10

  22. Applications of modular arithmetic Example 1: prove that 12294793 2329373 92739273 Solution: compute values modulo 10 12294793 3 ??? 10 2329373 3 ??? 10 92739273 3 ??? 10 But 3 3 9 ??? 10 , so the equation cannot be correct

  23. Applications of modular arithmetic Example 2: number theory Theorem: there are no ?,? ? such that ?2+ ?2= 1234567 Hint: use values modulo 4

  24. Applications of modular arithmetic Theorem: there are no ?,? ? such that ?2+ ?2= 1234567 Hint: use values modulo 4 Solution: for any ? ?, ?2 04 or ?2 14. There are 4 cases to check: 04 04= 04; 14 14= 14; 24 24= 04; 34 34= 14; So, ?2+ ?2 ?????? 4 can either be 04, 14 or 24 But 1234567 3 (??? 4), so they cannot be equal!

  25. Applications of modular arithmetic Cryptography Your online transactions are encrypted, based on modular arithmetic RSA public key crpytosystem: Very large m, product of two large primes m=p*q Message: ? {0,1, ,? 1} Encryption: ?? ??? ? Security is based on the assumption that factorization is hard

Related


More Related Content