30
COMP 170 L2 Page 1 Review for Midterm 1 Part I: Counting L01-L03 Part II: Number Theory and Cryptography L04, L05

COMP 170 L2 Page 1 Review for Midterm 1 l Part I: Counting n L01-L03 l Part II: Number Theory and Cryptography n L04, L05

Embed Size (px)

Citation preview

COMP 170 L2Page 1

Review for Midterm 1

Part I: Counting L01-L03

Part II: Number Theory and Cryptography L04, L05

COMP 170 L2

Counting

Why counting?

Page 2

COMP 170 L2

Counting Overview

Principles Sum principle, Product Principle, Bijection Principle

Objects to count Lists, functions, subsets, permutations, partitions

Page 3

COMP 170 L2Page 4

Sum Principle

COMP 170 L2Page 5

Product Principle

Si and Sj are disjoint, |Si| = n

S = S1 U S2 U … U Sm

|S| = m |Si| = mn

COMP 170 L2Page 6

Product Principle

COMP 170 L2Page 7

Bijection Principle

COMP 170 L2

Counting Overview

Principles Sum principle, Product Principle, Bijection Principle

Objects to count Lists, functions, permutations, subsets, partitions

Page 8

COMP 170 L2Page 9

Counting Lists

COMP 170 L2Page 10

Counting Functions

COMP 170 L2

Counting FunctionsPage 11

COMP 170 L2Page 12

Counting Permutations

Number of k-element permutations

Number of permutations of a set of size n

COMP 170 L2Page 13

k-element subsets/k-elemen permutations

COMP 170 L2

Counting SubsetsPage 14Page 14

COMP 170 L2Page 15

Counting Subsets

COMP 170 L2

Avoid Double CountingPage 16

Exco Members: Year 1: 4; Year 2: 5; Year 3: 3

WRONG ANSWER:

First choose 1 from each year

Then pick 3 from remaining 9 members

Answer

COMP 170 L2Page 17

Counting Partitions/Labelings

COMP 170 L2Page 18

Review for Midterm 1

Part I: Counting L01-L03

Part II: Number Theory and Cryptography L04, L05

COMP 170 L2

Part II of Course: ObjectivePage 19

Show how to make e-commerce secure using Number theory. Three logic lectures: L04-L06 L04-05 covered in Midterm 1

COMP 170 L2

L04-L05 Overview

Addition and multiplication mod n Basic properties

Multiplicative inverse GCD

Extended GCD algorithm

Introduction to cryptography

Page 20

COMP 170 L2

Modular ArithmeticPage 21

COMP 170 L2

Euclid’s Division Theorem

Proved:

Page 22

Proof technique

Proof by contradiction

Proof by smallest counter example

COMP 170 L2

Basic PropertiesPage 23

COMP 170 L2

L04-L05 Overview

Addition and multiplication mod n Basic properties

Multiplicative inverse GCD

Extended GCD algorithm

Introduction to cryptography

Page 24

COMP 170 L2

Link to GCDPage 25

COMP 170 L2

GCD AlgorithmPage 26

COMP 170 L2Page 27

The Extended GCD Algorithm

COMP 170 L2

Multiplicative InversePage 28

a has multiplicative inverse in Zn iff gcd(a, n) =1

In that case, inverse of a = x mod n.

COMP 170 L2

L04-L05 Overview

Addition and multiplication mod n Basic properties

Multiplicative inverse GCD

Extended GCD algorithm

Introduction to cryptography

Page 29

COMP 170 L2

Introduction to Cryptography