02 Sets and Logic
02 Sets and Logic
Definition
Universal Set
everything you can choose from
Set
Well defined collection of objects from
the universal set
Usually denoted with capital letter (A)
Element
an object within a set
Denoted with lower case letter (x)
Well Defined
Well Defined
The set of positive integers < 25
Well defined
Set Notation
xA
read x is an element of A
(x is considered to be a MEMBER of A)
xA
read x is not an element of A
Describe a Set
List all element
X={3, 6, 8, 12, 17}
Describe a Set
P={x:x is a prime number}
read the set of all x where x is a prime
number
Properties of Sets
Order is not important
Order does help reader see a pattern
or
Cardinality
Cardinality is the number of elements in a set
Written with bars on either side | |
A={1,2,3}
|A| = 3
Singleton
Subsets
If a second set contains many or all of the
elements of a first set, and contains no
elements that are not in the first set, that
second set is called a subset.
X={1,2,3,5}
Y={2,3}
Y is a subset of X
Written:
YX
Proper Subsets
Subset
Proper Subset
AB
AB
Proper Subsets
A proper subset has at least one element
missing from it's superset.
A = {1,2,3,4}
{1,2} is a proper subset
{1,2,4} is a proper subset
{1,2,3,4} is not a proper subset
Proper Subsets
Subset
A={1,2,3,5}
B={1,2,3,5}
AB
BA
A = B (Can be equal)
A subset includes the
possibility that all
elements are the
same. Proper subsets
do not.
Proper Subset
X={1,2,3,5}
Y={2,3}
Y X (and Y X)
If Y is a proper subset of X
that means that X contains
elements that Y does not.
X Y (Can never be equal)
The book uses this symbol
for both types of subsets
A Proper subset is also a
subset
Membership vs Subset
A = { 1, 2, 3 }
1 is a element of A, but 1 is not a subset of
A
{1} is a subset of A, but {1} is not an
element of A
{} is a subset of A but is not an element of
A
Power Set
Power Set
Set Members
1 2 3
0 0 0
{}
0 0 1
{3}
0 1 0
{2}
No Element
0 1 1 {2,3}
1 0 0
{1}
1 0 1 {1,3}
1 1 0 {1,2}
1 1 1 {1,2,3} All Elements
A = {1, 2, 3}
P (A)= { {}, {1},{2},{3},{1,2}, {1,3},
{2,3}, {1,2,3}}
Venn Diagrams
U
U = Universal Set = N
A = {1,2,4}
B = {2, 8, 16}
Venn Diagrams
U
A
U = Universal Set = N
A = {1,2,4}
B = {2, 4}
BA
Venn Diagrams
U
A
U = Universal Set = N
A = {1,2,4}
B = {1,2,4}
BA
Venn Diagrams
U
A
U
B
U = Universal Set = N
A = {1,2,4}
B = {1,2,4}
BA
AB
Venn Diagrams
U
A
U = Universal Set = N
A = {1,2,4,9}
B = {2,4,6}
C = {1, 2, 5, 9)
Venn Diagrams
U
U = Universal Set = N
A = {1,2,4,9}
B = {2,4,6}
C = {1, 2, 5, 9}
D= { 1, 6, 7, 10}
Where does 6 go?
2 4 6 8
1 9 12 13 14
A
10
B
15
C
3 7 11
Intersection Union
Complement
A B Intersection common to both
A B {x:xA, x B}
A Complement Not in A
A = {x:xU, xA}
Intersection Union
Complement
A B Intersection common to both
A B Union In either or both
A Complement Not in A
U={1,2,3,,10} A={1,3,7,8,9} B={2,3,6,7,10}
C={1,5,6,8}
A B
A C
B
A C
A B
={
={
={
={
={
}
}
}
}
}
Properties
S1.
S2.
S3.
S4.
S5.
S6.
S7.
S8.
S9.
(A B) C = A (B C) (Associative Unions)
(A B) C = A (B C) (Associative Intersections)
A B = B A (Commutative Unions)
A B = B A (Commutative Intersections)
(A) = A
A (B C) = (A B)(A C) (Distributive)
A (B C) = (A B) (A C) (Distributive)
(A B) = A B (De Morgan)
(A B) = A B (De Morgan)
More Properties
A
A
A
A
A
A
A
A
=A
=
U=A
A=A
A=A
U=U
B iff A B = B
B iff A B = B
= U
U =
A A =
A A = U
U A
2
1
3
6
5
8
Verify S1. (A B) C = A (B
C)
7
C
Regions for (A B) C
A regions 2, 3, 5, 6
B regions 2, 4, 5, 7
(A B) regions 2, 3,
4, 5, 6, 7
C regions 5, 6, 7, 8
(A B) C regions
2, 3, 4, 5, 6, 7, 8
Regions for A (B C)
B regions 2, 4, 5, 7
C regions 5, 6, 7, 8
(B C) regions
2,4,5,7,8
A regions 2, 3, 5, 6
A (B C) regions
2, 3, 4, 5, 6, 7, 8
Verify S2
S2. (A B) C = A (B C)
Difference
A B is the set of element that are in
A, but are not in B
A B = {x: x A, x B}
A = {1,2,5,8}
B = {3,5,8,9}
A-B = {1, 2}
Symmetric Difference
A B (or A B)
All elements in A plus all Elements in
B minus the elements in both.
A B = (A B) (A B )
A B = (A B) (A B )
A B = {x: x A or x B, x (A
B )}
Principle of
inclusion/exclusion
Two sets
|A B| = |A| + |B| - |A B|
Three sets
|A B C| =
|A| + |B| + |C| - |A B| - |A C| - |B C| + |A B
C|
Word Problems
A survey of 78 students is conducted.
Of that number, 54 students own
either a cat or a dog (or both). 46
students own a dog and 26 students
own a cat. How many students own
both a dog and a cat? How many dog
owners do not own a cat? How many
cat owners do not own a dog? How
many students own only one kind of
pet?
Word Problem
|D| = 46
|C| = 26
|C D| = 54
|C D| = |C| + |D| - |C D|
54 = 26 + 46 - |C D|
|C D| = 26 + 46 - 54 = 18 Own Cat
and Dog
Chapter 2 - Logic
Logic
Read Sections 2.5 through 2.7 of your textbook
Logic deals with the concepts of true and false
Statement declarative sentence that is true
or false and may correspond to a mathematical
statement
Variables used to represent statements
Logical Operators - modify and/or connect
statements and variables
Truth Table A visual means of showing all
possible combinations for a statement.
p q
Conjunction Example
I have a piece of chalk in my hand AND I
have an eraser in my hand.
If both phrases are true the whole statement is
true.
If either phrase is false the whole statement is
false.
p
q
p
q
What if both phrases are false?
T
T
T
p = I have a piece of
T
F
F
chalk in my hand
F
T
F
q = I have an eraser
F
F
F
in my hand
p
q
T
T
T
represented by
T
F
T
read as or
F
T
T
F
F
p q read as p or q F
means either p or q (or both) is true
truth table
Disjunction Example
I have a piece of chalk in my hand OR I have
an eraser in my hand.
If either phrase is true the whole statement is
true.
Both phrases must be false for the whole
statement to be considered false. p q p q
T
T
T
What if both phrases are true?
T
F
T
p = I have a piece of
F
T
T
chalk in my hand
F
F
F
q = I have an eraser
in my hand
Negation Example
The sun is not cold. (True or False?)
p = The sun is cold. (False)
~p = The sun is not cold. (True)
Water is not wet. (True or False?)
p = Water is wet. (True)
~p = Water is not wet. (False)
p q
is sufficient for q
is necessary for p
if p
only if q
not q then not p
pq
Implication Example
If I was a professor then I could give lots of
quizzes.
If I was a professor then I would be able to
p q
p
fly.
q
If I was magic then I could eat cake.
T T
T
T F
F
If I was magic then I could disappear.
F
Operators
If p is true q must be true for the
implication to be true.
If p is false can't really tell what the
outcome would be. If you start with a
false assumption, you can prove anything.
p
p
q
Biconditional Examples
Biconditional
I sleep if and only if I am tired
means
if I am asleep then I am tired
AND if I am tired the I am asleep.
also
If I am NOT sleeping, then I am NOT
tired.
If I am NOT tired, then I am NOT
sleeping.
p
q
Implication and
Biconditional
If it is raining, then I am indoors.
I may still be indoors even if it is not
raining
Order of Operation
Operations are executed in the
following order
Negation
Conjunction
Disjunction
Implication
Biconditional
Compound Statements
Connecting variables together with
operators create compound
statements
pq
pq
(p q ) r
pq
(p q ) (r)
pq
(p q ) (r)
pq
(p q ) (r)
pq
(p q ) (r)
Tautology
Always true
Construct truth table
If all true results in right hand column, tautology
(pq)(pq)
p p
p p
pp
(p q) (p q)
Contradiction
Always false
Construct truth table
If all false results in right hand column,
contradiction
p (p q)
p p
p p
( p p)
Contrapositive Converse
Inverse
statement: if p then q
contrapositive: if not q then not p
converse: if q then p
inverse: if not p then not q
Contrapositive Converse
Inverse
If Appalachian won, then the students
are happy (Sentence)
If the students are happy, then
Appalachian won (converse)
If the students are not happy, then
Appalachian did not win
(contrapositive)
If Appalachian did not win, then the
students are not happy (inverse)
Contrapositive Converse
Inverse
Assume the top sentence is true, do the
rest have to be true?
If Appalachian won, then the students are
happy (Sentence)
If the students are happy, then
Appalachian won (converse)
If the students are not happy, then
Appalachian did not win (contrapositive)
If Appalachian did not win, then the
students are not happy (inverse)
Contrapositive Converse
Inverse
Assume the top sentence is true, do
the rest have to be true?
If Appalachian won, then the students
are happy (Sentence)
If the students are not happy, then
Appalachian did not win (contrapositive)
Yes. A win would have moved the
students into the happy state, if they are
not in that state they did not win.
Contrapositive Converse
Inverse
Assume the top sentence is true, do the
rest have to be true?
If Appalachian won, then the students are
happy (Sentence)
If the students are happy, then
Appalachian won (converse)
No. The students could have been moved to
a happy state because of some other reason.
Just because the students are happy DOES
NOT mean that Appalachian won.
Contrapositive Converse
Inverse
Assume the top sentence is true, do
the rest have to be true?
If Appalachian won, then the students
are happy (Sentence)
If Appalachian did not win, then the
students are not happy (inverse)
No. The top sentence said a win makes
the students happy. It DID NOT say a loss
makes them unhappy.