CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n)...

29
CSE 20 Final Review CSE 20: Final Review

Transcript of CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n)...

Page 1: CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n) is True." Let us induct on n. Base Case: Prove that the P(r) and P(r + 1) is true.

CSE 20Final Review

CSE 20: Final Review

Page 2: CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n) is True." Let us induct on n. Base Case: Prove that the P(r) and P(r + 1) is true.

Final Review

Representation of integers in base bLogicProof systems:

Direct ProofProof by contradictionContraposetive

Sets TheoryFunctionsInduction

NO CALCULATOR, NO CHEAT SHEET

Anything that you can assume in the proofs will be clearlygiven.

CSE 20: Final Review

Page 3: CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n) is True." Let us induct on n. Base Case: Prove that the P(r) and P(r + 1) is true.

Final Review

Representation of integers in base bLogicProof systems:

Direct ProofProof by contradictionContraposetive

Sets TheoryFunctionsInduction

NO CALCULATOR, NO CHEAT SHEET

Anything that you can assume in the proofs will be clearlygiven.

CSE 20: Final Review

Page 4: CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n) is True." Let us induct on n. Base Case: Prove that the P(r) and P(r + 1) is true.

Propositional Logic

Every statement is either TRUE or FALSE

There are logical connectives ∨, ∧, ¬, =⇒ and ⇐⇒ .

Two logical statements can be equivalent if the twostatements answer exactly in the same way on everyinput.

To check whether two logical statements are equivalentone can do one of the following:

Checking the Truthtable of each statementReducing one to the other using reductions

CSE 20: Final Review

Page 5: CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n) is True." Let us induct on n. Base Case: Prove that the P(r) and P(r + 1) is true.

Propositional Logic

Check the correctness of a statement: whether asentence/paragraph/proposition is logically correct.

Make deductions

Check if two propositions are equivalent.

CSE 20: Final Review

Page 6: CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n) is True." Let us induct on n. Base Case: Prove that the P(r) and P(r + 1) is true.

Propositional Logic

Check the correctness of a statement: whether asentence/paragraph/proposition is logically correct.

Make deductions

Check if two propositions are equivalent.

CSE 20: Final Review

Page 7: CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n) is True." Let us induct on n. Base Case: Prove that the P(r) and P(r + 1) is true.

Propositional Logic

Check the correctness of a statement: whether asentence/paragraph/proposition is logically correct.

Make deductions

Check if two propositions are equivalent.

CSE 20: Final Review

Page 8: CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n) is True." Let us induct on n. Base Case: Prove that the P(r) and P(r + 1) is true.

Equivalence of statements/propositions

If the truthtables of two statement/propositions areidentical then the two statement/propositions areequivalent

One can also use various rules for propositional logic.

CSE 20: Final Review

Page 9: CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n) is True." Let us induct on n. Base Case: Prove that the P(r) and P(r + 1) is true.

Rules of Propositional Logic

1 Commutative law:

(p ∨ q) = (q ∨ p) and (p ∧ q) = (q ∧ p)

2 Associative law:

(p ∨ (q ∨ r)) = ((p ∨ q) ∨ r) and(p ∧ (q ∧ r)) = ((p ∧ q) ∧ r)

3 Distributive law:

(p ∨ (q ∧ r)) = (p ∨ q) ∧ (p ∨ r) and(p ∧ (q ∨ r)) = (p ∧ q) ∨ (p ∧ r)

4 De Morgan’s Law:

¬(p ∨ q) = (¬p ∧ ¬q) and ¬(p ∧ q) = (¬p ∨ ¬q)

CSE 20: Final Review

Page 10: CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n) is True." Let us induct on n. Base Case: Prove that the P(r) and P(r + 1) is true.

Sets

SetsFor example:

Set of names of all students

Set of letters in the english alphabetSet of digits. {0, 1, . . . , 9} or {0, 1}

Size of a set is the number of elements in the set.Size of set A is denoted by |A|.

CSE 20: Final Review

Page 11: CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n) is True." Let us induct on n. Base Case: Prove that the P(r) and P(r + 1) is true.

Sets

SetsFor example:

Set of names of all studentsSet of letters in the english alphabet

Set of digits. {0, 1, . . . , 9} or {0, 1}

Size of a set is the number of elements in the set.Size of set A is denoted by |A|.

CSE 20: Final Review

Page 12: CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n) is True." Let us induct on n. Base Case: Prove that the P(r) and P(r + 1) is true.

Sets

SetsFor example:

Set of names of all studentsSet of letters in the english alphabetSet of digits. {0, 1, . . . , 9} or {0, 1}

Size of a set is the number of elements in the set.Size of set A is denoted by |A|.

CSE 20: Final Review

Page 13: CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n) is True." Let us induct on n. Base Case: Prove that the P(r) and P(r + 1) is true.

Operations on Sets

Union, ∪.A ∪B is the set of all elements that are in A OR B.

Intesection, ∩A ∩B is the set of all elements that are in A AND B.

Complement, Ac or AAc is the set of elements NOT in A.

Cartesan Product. For example: A3 = A× A× A.

CSE 20: Final Review

Page 14: CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n) is True." Let us induct on n. Base Case: Prove that the P(r) and P(r + 1) is true.

Rules of Set Theory

Let p, q and r be sets.

1 Commutative law:

(p ∪ q) = (q ∪ p) and (p ∩ q) = (q ∩ p)

2 Associative law:

(p ∪ (q ∪ r)) = ((p ∪ q) ∪ r) and(p ∩ (q ∩ r)) = ((p ∩ q) ∩ r)

3 Distributive law:

(p ∪ (q ∩ r)) = (p ∪ q) ∩ (p ∪ r) and(p ∩ (q ∪ r)) = (p ∩ q) ∪ (p ∩ r)

4 De Morgan’s Law:

(p ∪ q)c = (pc ∩ qc) and (p ∩ q)c = (pc ∪ qc)

CSE 20: Final Review

Page 15: CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n) is True." Let us induct on n. Base Case: Prove that the P(r) and P(r + 1) is true.

Set Theory and Propositional Logic

Set Theory and Propositional Logic is two mathematicallanguage which follow very similar rules.

CSE 20: Final Review

Page 16: CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n) is True." Let us induct on n. Base Case: Prove that the P(r) and P(r + 1) is true.

Predicate Logic

There are two important symbols: ∀ and ∃.Some statements can be defined using a variable.

For example: Px = “4x2 + 3 is divisible by 5”

We can have statements like: ∀x ∈ Z, 4x2 + 3 isdivisible by 5.

Or ∃x ∈ Z, 4x2 + 3 is divisible by 5.

CSE 20: Final Review

Page 17: CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n) is True." Let us induct on n. Base Case: Prove that the P(r) and P(r + 1) is true.

Rules of negation

¬(∀x, Px) = (∃x, ¬Px).

¬(∃x, Px) = (∀x, ¬Px).

CSE 20: Final Review

Page 18: CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n) is True." Let us induct on n. Base Case: Prove that the P(r) and P(r + 1) is true.

Proof Techniques

To prove statement B from A:

Direct Proof:A =⇒ B

Proof by contradiction:

(¬B ∧ A) gives a contradiction

Proof by Contraposetive: A =⇒ B is same as proving¬B =⇒ ¬A.

Induction

CSE 20: Final Review

Page 19: CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n) is True." Let us induct on n. Base Case: Prove that the P(r) and P(r + 1) is true.

Proof Techniques

To prove statement B from A:

Direct Proof:A =⇒ B

Proof by contradiction:

(¬B ∧ A) gives a contradiction

Proof by Contraposetive: A =⇒ B is same as proving¬B =⇒ ¬A.

Induction

CSE 20: Final Review

Page 20: CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n) is True." Let us induct on n. Base Case: Prove that the P(r) and P(r + 1) is true.

Proofs done in class

Square of an odd integer is of form 4k + 1.

Primes, greater than 3, is of form 6k + 1 or 6k + 5.

A prime p is either 2 or 3 or p2 is of form 6k + 1.√2 and

√3 and

√2 +√

3 are not rational.

∀n 1 + 2 + · · ·+ n = n(n + 1)/2

Prove that for all n ≥ 5, n2 ≥ 4n + 5

If an = an−1 + 2 and a1 = 2 prove that an = 2n

If an = an−1 + an−2 and a1 = a2 = 1 then

an =1√5

((1 +√

5

2

)n

(1−√

5

2

)n)

CSE 20: Final Review

Page 21: CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n) is True." Let us induct on n. Base Case: Prove that the P(r) and P(r + 1) is true.

Proofs done in class

Square of an odd integer is of form 4k + 1.

Primes, greater than 3, is of form 6k + 1 or 6k + 5.

A prime p is either 2 or 3 or p2 is of form 6k + 1.√2 and

√3 and

√2 +√

3 are not rational.

∀n 1 + 2 + · · ·+ n = n(n + 1)/2

Prove that for all n ≥ 5, n2 ≥ 4n + 5

If an = an−1 + 2 and a1 = 2 prove that an = 2n

If an = an−1 + an−2 and a1 = a2 = 1 then

an =1√5

((1 +√

5

2

)n

(1−√

5

2

)n)

CSE 20: Final Review

Page 22: CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n) is True." Let us induct on n. Base Case: Prove that the P(r) and P(r + 1) is true.

Proofs done in class

Square of an odd integer is of form 4k + 1.

Primes, greater than 3, is of form 6k + 1 or 6k + 5.

A prime p is either 2 or 3 or p2 is of form 6k + 1.

√2 and

√3 and

√2 +√

3 are not rational.

∀n 1 + 2 + · · ·+ n = n(n + 1)/2

Prove that for all n ≥ 5, n2 ≥ 4n + 5

If an = an−1 + 2 and a1 = 2 prove that an = 2n

If an = an−1 + an−2 and a1 = a2 = 1 then

an =1√5

((1 +√

5

2

)n

(1−√

5

2

)n)

CSE 20: Final Review

Page 23: CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n) is True." Let us induct on n. Base Case: Prove that the P(r) and P(r + 1) is true.

Proofs done in class

Square of an odd integer is of form 4k + 1.

Primes, greater than 3, is of form 6k + 1 or 6k + 5.

A prime p is either 2 or 3 or p2 is of form 6k + 1.√2 and

√3 and

√2 +√

3 are not rational.

∀n 1 + 2 + · · ·+ n = n(n + 1)/2

Prove that for all n ≥ 5, n2 ≥ 4n + 5

If an = an−1 + 2 and a1 = 2 prove that an = 2n

If an = an−1 + an−2 and a1 = a2 = 1 then

an =1√5

((1 +√

5

2

)n

(1−√

5

2

)n)

CSE 20: Final Review

Page 24: CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n) is True." Let us induct on n. Base Case: Prove that the P(r) and P(r + 1) is true.

Proofs done in class

Square of an odd integer is of form 4k + 1.

Primes, greater than 3, is of form 6k + 1 or 6k + 5.

A prime p is either 2 or 3 or p2 is of form 6k + 1.√2 and

√3 and

√2 +√

3 are not rational.

∀n 1 + 2 + · · ·+ n = n(n + 1)/2

Prove that for all n ≥ 5, n2 ≥ 4n + 5

If an = an−1 + 2 and a1 = 2 prove that an = 2n

If an = an−1 + an−2 and a1 = a2 = 1 then

an =1√5

((1 +√

5

2

)n

(1−√

5

2

)n)

CSE 20: Final Review

Page 25: CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n) is True." Let us induct on n. Base Case: Prove that the P(r) and P(r + 1) is true.

Proofs done in class

Square of an odd integer is of form 4k + 1.

Primes, greater than 3, is of form 6k + 1 or 6k + 5.

A prime p is either 2 or 3 or p2 is of form 6k + 1.√2 and

√3 and

√2 +√

3 are not rational.

∀n 1 + 2 + · · ·+ n = n(n + 1)/2

Prove that for all n ≥ 5, n2 ≥ 4n + 5

If an = an−1 + 2 and a1 = 2 prove that an = 2n

If an = an−1 + an−2 and a1 = a2 = 1 then

an =1√5

((1 +√

5

2

)n

(1−√

5

2

)n)

CSE 20: Final Review

Page 26: CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n) is True." Let us induct on n. Base Case: Prove that the P(r) and P(r + 1) is true.

Proofs done in class

Square of an odd integer is of form 4k + 1.

Primes, greater than 3, is of form 6k + 1 or 6k + 5.

A prime p is either 2 or 3 or p2 is of form 6k + 1.√2 and

√3 and

√2 +√

3 are not rational.

∀n 1 + 2 + · · ·+ n = n(n + 1)/2

Prove that for all n ≥ 5, n2 ≥ 4n + 5

If an = an−1 + 2 and a1 = 2 prove that an = 2n

If an = an−1 + an−2 and a1 = a2 = 1 then

an =1√5

((1 +√

5

2

)n

(1−√

5

2

)n)

CSE 20: Final Review

Page 27: CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n) is True." Let us induct on n. Base Case: Prove that the P(r) and P(r + 1) is true.

Proofs done in class

Square of an odd integer is of form 4k + 1.

Primes, greater than 3, is of form 6k + 1 or 6k + 5.

A prime p is either 2 or 3 or p2 is of form 6k + 1.√2 and

√3 and

√2 +√

3 are not rational.

∀n 1 + 2 + · · ·+ n = n(n + 1)/2

Prove that for all n ≥ 5, n2 ≥ 4n + 5

If an = an−1 + 2 and a1 = 2 prove that an = 2n

If an = an−1 + an−2 and a1 = a2 = 1 then

an =1√5

((1 +√

5

2

)n

(1−√

5

2

)n)

CSE 20: Final Review

Page 28: CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n) is True." Let us induct on n. Base Case: Prove that the P(r) and P(r + 1) is true.

Induction: Version 1

If we have to prove “∀n ≥ r P (n) is True.”

Let us induct on n.

Base Case: Prove that the P (r) is true.

Induction Hypothesis: Let for some k ≥ r P (k) is true.

Inductive Step: We want to show, assuming IH,P (k + 1) is true.

By induction we have proved that ∀n ≥ r P (n) is true.

CSE 20: Final Review

Page 29: CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n) is True." Let us induct on n. Base Case: Prove that the P(r) and P(r + 1) is true.

Induction: Version 2

If we have to prove “∀n ≥ r P (n) is True.”

Let us induct on n.

Base Case: Prove that the P (r) and P (r + 1) is true.

Induction Hypothesis: Let for some k ≥ r P (k) andP (k + 1) is true.

Inductive Step: We want to show, assuming IH,P (k + 2) is true.

By induction we have proved that ∀n ≥ r P (n) is true.

CSE 20: Final Review