DS-Lecture 07
DS-Lecture 07
DS-Lecture 07
(CS-104)
Lecture 07
Previous Lectures Summary
• Rational Number
• Irrational numbers
• Absolute values
• Triangular inequality
• Modular Arithmetic
• Floor and Ceiling
Today’s Lectures Summary
• Floor and Ceiling
• Properties of Floor and Ceiling
Functions
• Methods of Proof
• Direct Proofs
Today's Lecture
Sets
Operations on sets
Memberships
Notations
Venn diagrams
Examples
Compute x and x for each of the following values of x:
a. 25/4
b. 0.999
c. −2.01
Solution:
a. 25/4 = 6.25 and 6 < 6.25 < 7; hence 25/ 4 6 and 25/4 7
n 2k
2 2 k k
3) Reconstruct Conclusion
This is the reverse of step 1. At the end of step 2 we
should have a simple form that could be derived by
applying the definition of the conclusion.
e.g., m+n=2(r+s)
Theorem
Disproving by Counterexample
Disproving by Counterexample
1
1. Let x 2 and y . Both are irrational.
2
1
2. Their product xy 2 1 is rational.
2
Method of Proof by Contra Positive
1. Express the statement to be proved in the form
∀x in D, if P(x) then Q(x).
2. Rewrite this statement in the contra positive form
∀x in D, if Q(x) is false then P(x) is false.
3. Prove the contra positive by a direct proof.
a. Suppose x is a (particular but arbitrarily chosen)
element of D such that Q(x) is false.
b. Show that P(x) is false.
Example
Proposition: For all integers n, if n2 is even then n is
even.
Contra positive: For all integers n, if n is not even then n2
is not even.
Proof: Suppose n is any odd integer. [We must show that
n2 is odd.] By definition of odd, n = 2k + 1 for some
integer k. By substitution and algebra,
n2 = (2k+1)22 = 4 k2 + 4k + 1 = 2(2 k2 + 2k) + 1.
But 2k2 + 2k is an integer because products and sums of
integers are integers. So n2 = 2·(an integer) + 1, and
thus, by definition of odd, n2 is odd.
Relation ship between Contra positive and
Contradiction Proofs
In a proof by contraposition, the statement
∀x in D, if P(x) then Q(x)
is proved by giving a direct proof of the equivalent
statement
∀x in D, if ∼Q(x) then ∼P(x).
To do this, you suppose you are given an arbitrary element
x of D such that ∼Q(x). You then show that ∼P(x). This is
illustrated in Figure
Cont….
To rewrite the proof as a proof by contradiction, you
suppose there is an x in D such that P(x) and ∼Q(x). You
then follow the steps of the proof by contraposition to
deduce the statement ∼P(x). But ∼P(x) is a contradiction to
the supposition that P(x) and ∼Q(x). (Because to contradict
a conjunction of two statements, it is only necessary to
contradict one of them.) This process is illustrated in Figure
Two Classical Theorems
T h e o r e m 1 : I r r a t i o n a li t y o f 2 .
Proof:
Suppose not, suppose 2 is a rational number. Then there are integers m and n with no
m m2
common factors such that 2 , Squaring both side of the equation gives 2= 2
n n
or equivalently, m2 2n2 m2 is even. it fallows that m 2k, for some integer k.
so m2 (2k)2 4k 2 2n2 , dividing both sides of the right most equation by 2 gives
n2 2k 2. Consequently, n2 is even, and so n is even. Hence both m and n have a common
factor of 2. But this contradicts the supposition that m and n have no common
factors.
Cont…
T h e o re m 2 : P ro v e b y c o n tra d ic tio n s 1 + 3 2 i s i r r a t i o n a l.
Methods of Proof and Number Theory
Mod Functions
Compute following
1. 113 mod 24
2. -29 mod 7
4
1. 113 mod 24:
24 113 113 div 24
96
17
2. -29 mod 7: 5
7 29 -29 div 7
35
6
Mod and div
Definitions
Divisibility and Floor
Theorem
Cont…
Computing div and mod
Use the floor notation to compute 3850 div 17
Sol:
Mod Congruence's
Let a, b be integers and n be a positive integer. We say
that a is congruent to b modulo n (i.e. a b(mod n) )
iff n | (b-a), implies that there exist some integer k such
that b-a = n·k.
B = {2, 3, 4, 5, 6, 7} |B| = 6
A = {1, 2, 3, …} |A| = 0
Examples
A = {1,2,3,4}, B = {1,2,3,4,5,7}, and C = {7,9,3}, and
the universal set U = {1,2,3,4,5,6,7,8,9}.
Cont…
Super Set: if we can write B ⊇ A, read as B is a
superset of A, B includes A, or B contains A.
Proper Subset: If A is a subset of, but not equal to, B,
then A is called a proper subset of B, written A ⊂ B (A
is a proper subset of B) or B ⊃ A (B is a proper
superset of A).
Examples
The set of all men is a proper subset of the set of all
people.
{1, 3} ⊂ {1, 2, 3, 4}.
{1, 2, 3, 4} ⊆ {1, 2, 3, 4}.
Cont…
An obvious but useful identity, which can often be used to
show that two seemingly different sets are equal:
A = B if and only if A ⊆ B and B ⊆ A.
Universal Set
Examples
Set Definition Elements
A = {x | x Z+ and x 8} {1, 2 ,3, 4, 5, 6 ,7, 8}
B = {x | x Z+, x is even and 10} {2, 4, 6, 8, 10}
AB
BA
Cont…
Set Definition Elements
A = {x | x Z+ and x 9} {1, 2 ,3, 4, 5, 6 ,7, 8,9}
B = {x | x Z+ ; x is even and 8} {2, 4, 6, 8,}
AB
BA
AB
Cont…
Set Definition Elements
A = {x | x Z+ x is even and x 10} { 2 , 4, 6, 8, 9}
B = {x | x Z+ ; x is odd and 10} {1, 3, 5, 7, 9}
AB
BA
Set operations and Venn diagram
Set operations and Venn diagram
A∩B
A ∩ B = { x | x A and x B }
Set operations and Venn diagram
A ∪ B = { x | x A or x B }
Set operations and Venn diagram
B \ A = { x | x ∉ A and x B }
Set operations and Venn diagram
Ac = U-A = { x | x ∉ A and x U }
Sets and Universal Set
A = {1,2,3,4}, B = {1,3,5,7}, and C = {7,9,3}, and the
universal set U = {1,2,3,4,5,6,7,8,9}. Locate all this
information appropriately in a Venn diagram.
Sets and Universal Set
A = {1,2,3,4}, B = {1,3,5,7}, and C = {7,9,3}, and the
universal set U={1,2,3,4,5,6,7,8,9}. Locate all this
information appropriately in a Venn diagram.
Sketching Regions representing Sets
Sketch the region corresponding to the set
(A ∪ Bc) ∩ C
Sketching Regions representing Sets
Sketch the region corresponding to the set (A ∪ Bc) ∩ C
Sketching Regions representing Sets
Sketch the region corresponding to the set (A ∪ Bc) ∩ C
(A ∪ Bc) ∩ C