Processing math: 100%

 

Hi there. This is part two of my three part series to An Introduction to Set Theory and Logic.

Part One of this introduction talked about definitions, notation with some examples. The number system was also covered.

Here in Part Two, Venn diagrams will help with understanding relations between sets.

Part Three will go into more detail about set operations and counting with sets.

 


Note

Aside from the featured image a few other images, the images of Venn diagrams were hand drawn by me. Yes I drew parallelograms instead of rectangles but the idea is there. The images are from my camera phone.

 


Table Of Contents

 

 

Applications of Set Theory

Set Theory is one of the foundational topics of (pure) mathematics. Knowing set theory will also help for computer science students when dealing with booleans such as (True or False) and (!False) which is True. Set Theory also helps with SQL database queries when dealing with table joins.

 

Venn Diagrams

Consider an elementary student in gym class of 25 students with large hula hoops laid on the floor. The teacher would lay the hula hoops on the floor in a manner like this:

 

two-sets

 

The teacher would say something along the lines of If you like chocolate ice cream, step inside the hula hoop A, If you like vanilla ice cream, step inside the hula hoop B, If you like both chocolate and vanilla ice cream, step inside both hula hoops., If you do not like vanilla or chocolate ice cream , do not step inside any of the two hula hoops.''

This simple example illustrates the usefulness of Venn diagrams to visualize two sets. Venn diagrams for three sets is possible and anything past three sets is difficult to visualize as it is more abstract and confusing. Here is what three sets would look like.

two-sets

 

The Universe of Discourse (U)

Notice that we have a rectangle and space that is outside the sets A and B but is still in the rectangle. The set U is defined as the universal of discourse as is represented by a rectangular region. Subsets of U are represented by circles or the sets within it.

As an example, suppose that we have a class size of 30 students. We can define the universe of discourse U as the 30 students. Within the 30 students, we have male and female students. One set can represent the male students out of the 30 in the class. The second set can represent the female students in the class.

Another example would be food group of vegetables as U. Celeries, broccoli, carrots, mushrooms, lettuce, okras belong to the vegetable family. One possible set would be mushrooms and the type of mushrooms would be elements in that set. Another possible set would be lettuce and the types of lettuce would be elements in that set.

 

Unions

Given the sets A and B, the union of sets A and B is denoted by AB. The union AB is a set which contains elements in A or in B. Defined mathematically, it is defined as AB={x:xA or xB}. The math notation reads as A union B" andelement x such that x is in set A or x is in set B".

The word or here does not mean one or the other like in English. In the math and logic sense, the word or means one of three options in AB.

 

  1. The element x can be in A.
  2. The element x can be in B.
  3. The element x can be in A and in B.

 

For two sets the dashed region represents the elements inside the union AB looks like this:

 

AunionB

 

For three sets, the Venn diagram looks like this.

 

AunionBunionC

 

Here are some examples with unions.

Example One

Suppose we are given set A={beans,carrots,pomelo,mushrooms} and set B={leeks,carrots,celery,beans}. The union of the two sets AB would be

 

AB={beans,carrots,pomelo,mushrooms,leeks,carrots,celery,beans}={beans,carrots,pomelo,mushrooms,leeks,celery}

 

Recall that elements in a set are unique. There are no multiples in a set. The double counts of beans and celery are reduced to a single count for each.

 

Example Two

 

Suppose we are given sets A={1,5,7,11}, B={0,2,8,7,5} and C={1,2,8,2}. The union of the three sets ABC would be

 

ABC={1,5,7,11}{0,2,8,7,5}{1,2,8,2}={1,5,7,11,0,2,8,7,5,1,2,8,2}={1,5,7,11,0,2,8,2}

 

Intersections

 

We have somewhat introduced the concept of intersection in the previous section. The intersection of set A and set B (read ``A intersect B") is defined as AB={x:xA and xB}.

The word and in the math context does match with the English version of and.

With the two sets, the intersection AB is represented by the shaded area (middle) in the visual below.

 

A cap B

 

One can notice that the intersection AB is a subset of set A (i.e. ABA) and AB is a subset of set B (ABB).

A Venn diagram of three sets with ABC (middle shaded part) looks like this.

 

A cap B cap C

 


Empty Intersection Case

 

There are cases where there is no element that belongs to both sets A and B. In these cases, we say that the intersection AB is empty or disjoint. The intersection of such disjointed sets is denoted by AB=.

The visual below shows the shaded A region and the shaded B region but the middle intersection being unshaded representing an empty intersection.

 

no int

 

An empty intersection of three sets would have the middle intersection part being empty ABC.

 

no int

 


Here are a few examples with intersections.

Example One

 

Suppose we are given the set A={apples,guava,jackfruit,pineapple} and the set B={grapes,mango,pineapple,orange}. The intersection of the two sets would be AB={pineapple}.

 

Example Two

 

The intersection of the set P={1,9,3} and Q={2,10,3,18,8,1,5} is {1,3}.

 

Example Three

 

The positive integers or natural numbers N={1,2,3,} and the negative integers Z={1,2,3,} are disjoint sets. (The intersection between the two sets is empty.) There is nothing in common between the two sets.

 

Example Four

 

Suppose we have a set A with the U as the universe of discourse. The set U can be split or partitioned into AAc such that the intersection AAc=.

 

Complements

 

In English, the word complement relates to an item that goes well with another item. In the math context a complement refers to an opposite. Given a set A, the complement of the set A is the set of all elements that are not in A denoted by Ac or A or ˉA.

In math notation, we write Ac={x:xAc}={x:xA}

For a better understanding of complements, we have visuals below.

In this visual, we have Ac. Notice how the intersection AB is not shaded. It is because (AB)A, so the intersection is not included in the complement of set A.

 

A  B

 

In the next visual, we have Bc. Again, since the intersection is a subset of set B it is not shaded.

 

B  A

 

In this visual, we have (AB)c. Neither set A, set B nor the intersection is shaded here.

 

Not A union B

 

Complements With Three Sets

 

Dealing with complements with more than 2 sets is tricky. The visuals get complicated too. An example of a three set case is where we have (ABC)c. The shaded regions outside of sets A, B and C represents the elements in the complement of (ABC).

 

not 3 set union

 

Example One

 

The complement of the set of even numbers is the set of odd numbers.

 

Example Two

 

The complement of the set of prime numbers is the set of non-prime numbers.

 

Example Three

 

Given that the universe of discourse U is the set of all integers Z={0,±1,±2,±3,}. The complement of the negative integers Z={1,2,3,} is the set of positive integers and zero.

 

Subtracting Sets and Relative Complements

 

Relative Complements can be thought of subtracting sets. Subtraction with sets is not exactly like 72=5 but there are a few similarities with subtracting numbers and subtracting sets.

Given that we have two sets A and B, the set AB or AB is ABc. This relative complement means that we have the intersection of set A and the complement of B. In math notation we write

AB=ABc={x:xA and xBc}={x:xA and xB}

The visual below is for reference.

 

A  B

 

The symmetric difference BA or BA is BAc which is shown below.

 

B  A

 

Three Sets Case

 

The case for three sets is tricky. Only a few examples will be covered.

Given the sets A, B and C. The set B(AC)=B(AC)=B(AC)c is only the set B. It would look like this.

 

B  AUC

 

A more involved example would be the set (AC)(AC)B=(AC)(AC)B=(AC)(AC)cBc. This means that from the union of sets A and C remove the intersection of (AC) and remove anything from set B. A visual below will help.

 

AUC  AnC

 

Example One

 

Suppose we have the sets A={9,4,1,0,2,5} and B={2,0,1}. The universe of discourse U is {1,0,1,2,3,4,5,6,7,8,9}. The set AB=ABc would be {9, 4, -1, 5}. A more detailed answer is below.

 

AB={9,4,1,0,2,5}{2,0,1}={9,4,1,0,2,5}{2,0,1}c={9,4,1,0,2,5}{1,3,4,5,6,7,8,9}={9,4,1,5}

 

Example Two

 

Suppose we have the sets A={10,2,2,0,7}, B={1,2,3} and C={5,0}. The set ABC=ABcCc would be {10,2,7}.

 

Symmetric Difference

The symmetric difference of sets is somewhat tricky. It does involve relative complements as discussed in the previous section.

We deal with the two sets case first. Suppose we have sets A, B and the universe of discourse U. The symmetric difference of A and B which is denoted by AB is defined as :

 

AB=(AB)(BA)=(ABc)(BAc)

 

One could also view AB as AB=(AB)(AB).

Here is a visual for two sets where the intersection in the middle is not shaded. (Bad picture quality sorry).

 

A tri B

 

For three sets, it is not as simple as removing the intersections. If we have ABC, it would look like this.

 

A tri B tri C

 

Example One

 

Suppose we have sets R={1,9,8,0} and S={8,2,4}. The symmetric difference of sets R and S is:

 

RS={1,9,8,0}{8,2,4}={1,9,0,2,4}

Example Two

 

Given three sets A={4,5,2,0,1}, B={1,2,5,9} and C={3,7,1,0}. What is ABC?

We first determine the intersections.

AB={5,1}

AC={1,0}

BC={1}

ABC={1}

 

Therefore ABC={4,2,1,2,9,3,7} where the 0 and 5 is taken out.

 

Summary and Visual Aid

That was a lot to handle! To help put everything together, here is a colourful diagram for the case of three sets A, B and C.

 

Three Set Summary

 

To grasp these set theory concepts, try drawing Venn diagrams on paper and see the relations between sets.

Part three will discuss the algebra of sets, the duality of sets, counting with sets, ordered pairs and Cartesian products.

 

References

 

The featured image is from http://gatecse.in/wp-content/uploads/2015/06/Venn_Diagram.jpg.

The material was from a coursepack book from a math course I took back in Winter 2010. The course was called An Introduction To Mathematical Proofs

The three set Venn diagram in the beginning is from http://www.cwladis.com/clip_image011_0017.gif

These websites were helpful for guides in making Venn diagrams and for visuals: