CSE 20 Discrete Mathematics for Computer Science Prof

  • Slides: 34
Download presentation
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett

CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett

2 Final review

2 Final review

3 What did we study? Boolean logic: propositions, predicates, formulas, truth tables, CNFs, DNFs

3 What did we study? Boolean logic: propositions, predicates, formulas, truth tables, CNFs, DNFs Data representation: graphs, sets, functions, relations, equivalence relations Proofs: direct, contrapositive, contradiction, cases, induction, strong induction Number theory: factorization to primes, GCD, basis representation, modular arithmetics Number theory algorithms: div-mod, fast exponentiation, casting out 9 s

4 What did we really study? Language of mathematics Expressing intuitive (or not so

4 What did we really study? Language of mathematics Expressing intuitive (or not so much) ideas in a formal language Giving formal proofs for mathematical theorems

5 Boolean logic

5 Boolean logic

6 Propositional logic What is a proposition? How to translate from English to logic,

6 Propositional logic What is a proposition? How to translate from English to logic, and vice versa Connectives Truth tables CNFs, DNFs Equivalence rules

7 Propositional logic You should know: Translating English from/to logic Negating / De-Morgan laws

7 Propositional logic You should know: Translating English from/to logic Negating / De-Morgan laws Computing truth tables from formulas Computing CNFs / DNFs from truth table Equivalence rules, derivation rules

8 Predicate logic Universal / existential quantifiers Multiple quantifiers Negation / De-Morgan laws The

8 Predicate logic Universal / existential quantifiers Multiple quantifiers Negation / De-Morgan laws The importance of the domain

9 Predicate logic You should know: Translating English from/to logic Negating / De-Morgan laws

9 Predicate logic You should know: Translating English from/to logic Negating / De-Morgan laws Equivalence rules, derivation rules Deciding if a quantified formula is true/false in a specific domain

10 Data representation

10 Data representation

11 Graphs What do graphs represent? Examples. . Terminology: Directed vertices, edges, degree /

11 Graphs What do graphs represent? Examples. . Terminology: Directed vertices, edges, degree / undirected graphs (Eulerian graphs – not for final)

12 Sets Definition, notations, examples Operations: union, intersection, complement, difference, power set, Cartesian product

12 Sets Definition, notations, examples Operations: union, intersection, complement, difference, power set, Cartesian product Expressing sets (eg primes) using set builder notation Venn diagrams, algebraic / symbolic proofs Set sizes, and how these change under the above operations Infinite sets

13 Relations What do they represent? Examples. . Connection Types: How to graphs reflexive,

13 Relations What do they represent? Examples. . Connection Types: How to graphs reflexive, symmetric, transitive to prove / disprove that a relation is reflexive / symmetric / transitive

14 Equivalence relations Definition How to prove/disprove Important example: modular arithmetics (equivalent MOD m)

14 Equivalence relations Definition How to prove/disprove Important example: modular arithmetics (equivalent MOD m)

15 Functions Definition, Injective, examples surjective, bijective Inverse function Proving properties of set sizes

15 Functions Definition, Injective, examples surjective, bijective Inverse function Proving properties of set sizes using functions

16 Proofs

16 Proofs

17 Direct proof To prove p q Assume p, plug in definitions, derive q

17 Direct proof To prove p q Assume p, plug in definitions, derive q

18 Contrapositive proof To prove p q Prove instead ~q ~p Assume ~q, plug

18 Contrapositive proof To prove p q Prove instead ~q ~p Assume ~q, plug in definitions, derive ~p

19 Proof by contradiction To prove p q Assume p, ~q and derive a

19 Proof by contradiction To prove p q Assume p, ~q and derive a contradiction (either to one of the assumptions, or to a basic axiom)

20 Proof by cases To prove p q Partition Prove assumption p into cases

20 Proof by cases To prove p q Partition Prove assumption p into cases each case individually, using any of the previous proof techniques

21 Induction Useful to prove theorems of the form: for all n>=1, some P(n)

21 Induction Useful to prove theorems of the form: for all n>=1, some P(n) holds Base: n=1 (say) Basic induction: assume true for n-1, prove for n Strong induction: assume true for all k=1, …, n 1, prove for n

22 Number theory + algorithms

22 Number theory + algorithms

23 Primes Definition of primes / composites Every integer has a unique factorization as

23 Primes Definition of primes / composites Every integer has a unique factorization as a product of prime numbers If p is prime, p|xy p|x or p|y Hard to factor a number to primes – basis for RSA encryption

24 GCD Greatest Can common divisor of 2 numbers find efficiently using Euclid’s algorithm

24 GCD Greatest Can common divisor of 2 numbers find efficiently using Euclid’s algorithm

25 Modular arithmetics Definitions “x MOD m” Addition, multiplication Inversion when m is prime

25 Modular arithmetics Definitions “x MOD m” Addition, multiplication Inversion when m is prime

26 Number theory algorithms DIV-MOD: Divide a by b, get quotient q and reminder

26 Number theory algorithms DIV-MOD: Divide a by b, get quotient q and reminder r: a=bp+r Fast exponentiation: compute ab using only ~log(b) multiplications Casting by 9 out 9 s: check if a number is divisible

27 Review questions

27 Review questions

28 Question 1

28 Question 1

29 Question 2

29 Question 2

30 Question 3 Let G be an undirected graph with n vertices and no

30 Question 3 Let G be an undirected graph with n vertices and no loops. What is the maximal possible number of edges in G? A. n B. n 2 C. n(n-1)/2 D. n 2/2

31 Question 4

31 Question 4

32 Question 5

32 Question 5

33 Question 6

33 Question 6

34 Some words for conclusion I enjoyed teaching you, I hope that you enjoyed

34 Some words for conclusion I enjoyed teaching you, I hope that you enjoyed the class as well I hope that it opened your mind to the wonderful world of mathematics, and its many applications in computer science; this was just the first step Good luck in the final!