Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett."— Presentation transcript:

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

2 Final review 2

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 9s 3

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

5 Boolean logic 5

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

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 7

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

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 9

10 Data representation 10

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

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 12

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

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

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

16 Proofs 16

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

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

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) 19

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

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 21

22 Number theory + algorithms 22

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 find – basis for RSA encryption 23

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

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

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

27 Review questions 27

28 Question 1 28

29 Question 2 29

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 30

31 Question 4 31

32 Question 5 32

33 Question 6 33

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! 34


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

Similar presentations


Ads by Google