Welcome to a lesson
on the cardinality of a union of 2 sets.
Remember the cardinality of a set
is number of elements in a set.
For any finite sets A and B,
the cardinality of A union B is equal
to the cardinality of A plus the cardinality of B
minus the cardinality of A intersect B,
which means, the number of elements in A or B
equals number of elements in A,
plus number of elements in B,
minus the number of elements in A and B.
We have to subtract the number of elements in A and B once
because notice how the elements in this region
are counted once when counting
the number of elements in set A, and then a second time
when counting the number of elements in set B.
And of course, we only want to count these elements once
and therefore we have to subtract the number of elements
in A and B once, so they're only counted once.
And the process of adding in, then taking out
and then adding back in and so on
is called the Principle of Inclusion/Exclusion,
or simply P-I-E, or PIE.
Noticing the Venn diagram sets A and B are not disjoint.
Meaning there are elements that are in set A and set B
but this formula is still true when we have disjoint sets.
However, the cardinality of A intersect B is zero.
For example, here we have sets A and B that are disjoined,
meaning there are no elements that are in A and B.
And if we apply the formula,
we have the cardinality of A union B
equals again the cardinality of A,
plus the cardinality of B,
minus the cardinality of A intersect B.
But notice how the cardinality of A intersect B
or the number of elements in A and B is zero.
And therefore, if we have two disjoint sets
the formula that does simplify to the cardinality of A
plus the cardinality of B. Let's look at an example.
Let's determine how many elements N
in the set of integers from 1 through 30
is N a multiple of two or three.
So to set this up, let's let the set A
be the set containing multiples of two,
set B be the set containing multiples of three.
And therefore the set A intersect B
is the set containing multiples of two and three,
which should be multiples of six
and A union B is the set containing multiples of 2 or 3.
So we're looking for the cardinality of A union B.
Since the set contains integers from 1 through 30
we can determine how many numbers are multiples of two
by taking 30 and dividing by two, which is equal to 15
which indicates the cardinality of set A is 15.
This should make sense because
half of the integers from 1 through 30 are even
which would give us 15.
To determine how many are multiples of three
we can take 30 and divide by three, which is 10.
There are 10 elements in this set
that are multiples of three.
And therefore the cardinality of set B is 10.
And finally, to determine how many multiples of six we have,
we can take 30 and divide by six, which is equal to five.
There are five elements
in the set that are multiples of six.
And now we have all the information we need,
the cardinality of A union B,
which is equal to the number of elements in the set
that are multiples of two or three,
equals the cardinality of A, which is 15,
plus the cardinality of B, which is 10
and minus the cardinality of a A intersect B, which is 5.
The cardinality of A union B is equal to 20.
Which indicates there are 20 multiples of two or three
in the set of integers from 1 through 30.
To make this even more clear,
let's set this up using a Venn diagram.
So I've already set this up below,
where notice how the intersection of A and B
contains the multiples of six from the set of integers
from 1 to 30, which are 6, 12, 18, 24 and 30.
And then set A contains all the multiples of two.
Notice how we already have five multiples of two
in the intersection of A and B.
So the multiples of two,
that are not also multiples of three
are the elements of 2, 4, 8, 10, 14, 16, 20, 22, 26 and 28.
Notice how we do have 15 elements in set A.
And then set B contains all the multiples of three.
Five of them are already in the intersection of A and B.
The multiples of three, that are not also multiples of two
are 3, 9, 15, 21 and 27.
And I did list all the other integers from 1 through 30.
They're not multiples of two or three in the universal set
which are 1, 5, 7, 11, 13,
17, 19, 23, 25 and 29.
So notice how we can verify now
the cardinality of set A is 15,
the number of elements in set A is 15.
We can also verify the cardinality of set B is 10.
The number of elements in set B is 10.
And we can also verify
the cardinality of A intersect B is five,
the number of elements in this set here.
But of course, because we have the Venn diagram
we can just highlight A union B, which is this set here.
And then just count the number of elements,
which we can see is 20, verifying our work as correct.
I hope you found this helpful.