# An Introduction To Set Theory & Logic (Part Two Of Three)

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

I have a nicer .pdf version of this post with better Venn diagram pictures. It can be found here: intro_set_theory2_pdf.

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:

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.

The Universe of Discourse ()

Notice that we have a rectangle and space that is outside the sets and but is still in the rectangle. The set is defined as the universal of discourse as is represented by a rectangular region. Subsets of 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 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 . 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 and , the union of sets and is denoted by . The union is a set which contains elements in or in . Defined mathematically, it is defined as . 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 .

1) The element can be in .
2) The element can be in .
3) The element can be in and in .

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

For three sets, the Venn diagram looks like this.

Here are some examples with unions.

Example One

Suppose we are given set and set . The union of the two sets would be

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 , and . The union of the three sets would be

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 .

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

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

One can notice that the intersection is a subset of set (i.e. ) and is a subset of set ().

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

Empty Intersection Case

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

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

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

Here are a few examples with intersections.

Example One

Suppose we are given the set and the set . The intersection of the two sets would be .

Example Two

The intersection of the set and is .

Example Three

The positive integers or natural numbers and the negative integers 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 such that the intersection .

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 , the complement of the set is the set of all elements that are not in denoted by or or .

In math notation, we write

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

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

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

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

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 . The shaded regions outside of sets , and represents the elements in the complement of .

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 is the set of all integers . The complement of the negative integers 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 but there are a few similarities with subtracting numbers and subtracting sets.

Given that we have two sets and , the set or is . This relative complement means that we have the intersection of set and the complement of . In math notation we write . The visual below is for reference.

The symmetric difference or is which is shown below.

Three Sets Case

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

Given the sets , and . The set is only the set . It would look like this.

A more involved example would be the set This means that from the union of sets and remove the intersection of and remove anything from set . A visual below will help.

Example One

Suppose we have the sets and . The universe of discourse is . The set would be {9, 4, -1, 5}. A more detailed answer is below.

Example Two

Suppose we have the sets , and . The set would be .

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 , and the universe of discourse . The symmetric difference of and which is denoted by is defined as :

One could also view as .

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

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

Example One

Suppose we have sets and . The symmetric difference of sets and is:

Example Two

Given three sets , and . What is ?

We first determine the intersections.

Therefore 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 , and .

From LaTeX Code.

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:

• ftp://ftp.dante.de/tex-archive/macros/latex/contrib/venndiagram/venndiagram.pdf
• http://tex.stackexchange.com/questions/26096/tikz-labelling-venn-diagram
• http://users.ju.edu/hduong/math220/venn_diagrams.pdf
• http://tex.stackexchange.com/questions/9681/how-to-draw-venn-diagrams-especially-complements-in-latex
• http://users.ju.edu/hduong/math220/venn_diagrams.pdf
• http://www.texample.net/tikz/examples/venn-diagram/