congruence and sets

18
Congruence and Sets Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois Dali - “The Persistence of Memory” 1

Upload: jeff

Post on 15-Feb-2016

38 views

Category:

Documents


0 download

DESCRIPTION

Congruence and Sets. Dali - “The Persistence of Memory”. Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois. Review of Last Class. Counting, natural numbers, and integers Representation of numbers: unary, Roman, decimal, binary - PowerPoint PPT Presentation

TRANSCRIPT

Congruence and Sets

Discrete Structures (CS 173)Madhusudan Parthasarathy, University of Illinois

Dali - “The Persistence of Memory”

1

Review of Last Class• Counting, natural numbers, and integers• Representation of numbers: unary, Roman, decimal, binary• Divisibility: a| b iff b =ma for some integer m• Prime numbers and composite numbers• GCD and LCM

is the largest integer that divides both and is the smallest integer that both and divide

• Euclidean algorithm for computing gcd• p and q are relatively prime if they have no common prime

factors. i.e., gcd(p.q) = 1

2

Goals of this lecture

• Introduce the concept of congruence mod k

• Be able to perform modulus arithmetic

• Rationals

• Reals

3

Applications of congruence

• bitwise operations• error checking• computing 2D coordinates in images• encryption• telling time• etc.

4

Congruence mod k

• Two integers are congruent mod k if they differ by an integer multiple of k

• Definition: If is any positive integer, two integers and are congruent mod k iff divides

5

Examples of congruent mod k

6overhead

7

8

9

Modulus addition proof

10

Claim: For any integers with , if and then Definition:

overhead

11

Modulus multiplication proof

12

Claim: For any integers with , if and then Definition:

overhead

Equivalence classes with modulus

The equivalence class of integer (written ) is the set of all integers congruent to

In (mod 7),

In (mod 5),

In ,

13

Modulus arithmetic

14overhead

RSA Key Generation• Creating the public and private keys for encryption/decryption

– Choose two prime numbers and

– Choose an integer such that and is relatively prime with – Solve for (e.g., with extended Euclidean algorithm)

• Using the keys– Public key: – Private key: – Encryption

• Turn message into an integer • Coded message

– Decryption• Original message

15

Rationals

16

Reals

17

Thank you• Next week: sets and relations

21