CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n)...
Transcript of CSE 20 - Final Review · CSE 20: Final Review. Induction: Version 2 If we have to prove \8n r P(n)...
CSE 20Final Review
CSE 20: Final Review
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
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
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
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
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
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
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
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
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
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
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
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
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
Set Theory and Propositional Logic
Set Theory and Propositional Logic is two mathematicallanguage which follow very similar rules.
CSE 20: Final Review
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
Rules of negation
¬(∀x, Px) = (∃x, ¬Px).
¬(∃x, Px) = (∀x, ¬Px).
CSE 20: Final Review
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
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
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
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
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
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
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
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
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
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
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
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