Set Theory

From STEM Wiki Textbook

Sets are among the fundamental ideas in math. We cannot define them in terms of other things because of this. They are sometimes called a "primitive notion." Like points and lines in geometry we simply assume they exist and say so in the axioms used as the foundation of math. They just are. In hopes of making this important concept more clear, we will think of a Set as a "bag" which objects can be put in. This informal definition is useful conceptually, but inadequate as a rigorous definition. Feel free to explore Wikipedia's Introduction to Sets concurrently. If you want the more rigorous Axiomatic Set Theory then ZFC Set Theory is the most common introduction. ZFC resolves many problems with Naive Set Theory, including Russell's Paradox.

Fundamentals

We must have a large set to place the sets we are interested in. This set is often called Universe of Discourse or just the Universe. The symbol is typically used to denote the universe. For to be a Well Defined Set (and all sets we are interested in are well defined) it is required that all the objects in the universe be either in or out of the set , but not both. We write to mean " is an object in the set ". This can also be stated by saying " is an element of ", " is in ", and many other ways.

We often write sets with a finite number of elements explicitly. For instance is a set with the elements , , , , and . Note Set Equivalence works just as one would expect. Two sets are equivalent if and only if they have exactly the same elements. It is often useful to depict a set with a Venn Diagram like the one below.

VennEx.png

With the universe .

As an example of how to use notation, we note that , and . We use the symbol to say an element is not in a set. For instance in the above example. We also note this is a logical statement and is equivalent to . As we progress we will find a variety of such connections between logic and set theory.

Sets are not allowed to have repeated elements, is not allowed. Sets themselves can also be elements of other sets, is allowed. Note A and can themselves contain elements which are also elements of because the set or are distinct objects. We also note that a set cannot contain itself as an element (this would lead to Russell's Paradox).

The Empty Set (sometimes Null Set or Void Set) is the set and is usually denoted . The empty set has no elements in it.

While arbitrarily selected set elements are fine, it is often more useful to have a rule for deciding whether to include elements in a set. For instance, we might have a set of red objects, a set of even numbers, a set containing all birds, a set of perfect squares, etc.

Basic Set Operations

Please read Wikipedia's Set Operations concurrently to compare and contrast. Please pay special attention to the Venn Diagrams, more of which can be found here. The diagram for the symmetric difference is of particular interest to computer programmers, as it is the set equivalent to the logical XOR.

Compliment

Operations can be defined on sets too. The easiest operation is the compliment. The compliment of is denoted . The Compliment of is every element which is in , but not in . The region of the Venn Diagram where elements of may appear is coloured yellow below.

This set can also be defined using rules as follows. . This means the elements of are the elements of subject to the condition that they are not also elements of .

The remaining operations of interest all require two sets to be defined within the universe.

SetComp.png

Intersection

The Intersection of two sets and is denoted . These are all the elements of U which are both in and in . The equivalent logic statement is . The brackets are not strictly required here, but are used to emphasize the edges of each logical statement. We represent the intersection of and with the Venn Diagram below.

SetInter.png

Union

The Union of two sets and is denoted . These are all the elements of U which are in or in . The equivalent logic statement is . The following Venn Diagram represents the union of and .

SetUnion.png

Set Relations

Subsets and Super Sets

We can also define subsets. A Subset is a set wholly contained within another set. Every element of a subset is an element of the set it is contained in. We write to mean is a subset of . The equivalent logical statement is . is also called the Superset. The subset symbol is written much like the less than equal to symbol (). This is to indicate that it is allowed that the sets are equal. A Proper Subset would be written and would not allow and to be equal, ie at least one element exists in which is not in . A Venn Diagram representing (in fact as well) follows.

SubSet.png

Set Equality

As mentioned earlier, two sets are equivalent if and only if they have exactly the same elements. This is written . Note in the case the Venn Diagram would be one yellow circle inside a white rectangle and the circle would be labelled both and .

If you can show that and then the elements of and are the same (more explicitly there are no elements of one that are not in the other) and thus .

Disjoint Sets

Two sets and are said to be Disjoint Sets if they share no elements, ie if .

DisjointSet.png

Further Set Operations

Set Difference

The Set Difference (also written ) is defined to be the set which contains all the elements of which are not in . In terms of logic we state . This is sometimes called the Relative Compliment of in . Note . This gives us an expression for the complement of a set (defined earlier). The Venn Diagram for is below.

SetDiff.png

Cartesian Product

The Cartesian Product of two sets and is the set of all ordered pairs which can be created by combining the elements of and with the elements of in the first position and the elements of in the second position. It is denoted . An illustrative example is instructive.

Consider and , then .

This notation should look a lot like how we write the coordinates of points in the x-y plane. More on that later. You may notice that the order of operations for set theory are implied by the order of operations of logic and are exactly as one would expect. We won't be testing that in this course though.

Set Properties

Cardinality

The Cardinality of a set is the number of elements in the set. It is denoted (sometimes ). For example, the cardinality of is 4 . It is a way of thinking about the "size" of a set. The first exercise on the Principle of Inclusion Exclusion illustrates this further.

Defining Sets

While it is perfectly fine to define sets arbitrarily (ie. just say what elements are in the set), it is often useful to define them with some rule. Most useful sets have some defining characteristic like the set of colours, the set of emotions, the set of animals, etc. We use sets this way to classify elements. The sets we will usually be interested in are numbers, and more complex things constructed from numbers. To define a set using a rule (say the set of odd Natural Numbers) you could write or equivalently . Both these statements say the set is the set of elements such that is an odd number. To remove English sentences entirely you could write . This statement says the set is the set of elements that are Natural Numbers, such that when they are divided by 2, they do not yield a Natural Number. There are plenty of variations on this. As long as you can translate the symbols to English, you'll be able to make sense of them. Check out this Wikipedia link if you want more detail.

Some Familiar Infinite Sets

When doing math there are certain favourite sets which come up often. You have already met several of them.

  • is the symbol used for the set of Natural Numbers .
  • is the symbol we will use for the set of Whole Numbers . In actual fact Mathematicians just redefine the Natural Numbers to include zero when it suits them, but this makes for ambiguous notation so I introduce for clarity.
  • is the symbol used for the set of Integers .
  • is the symbol used for the set of Rational Numbers, the set of all fractions with any integer as the numerator, and any natural number as the denominator. All fractions are stated in lowest terms and repeated elements are discarded. The rationals can also be described as every decimal number than terminates or ends in some repeating pattern.
  • is the symbol used for the set of Irrational Numbers. The symbol is commonly used elsewhere in math though, so it is more common to use (or ) for the irrationals. The irrationals are all the decimals which do not have a repeating pattern ever and do not terminate. They come in two varieties. Algebraic Irrationals are the roots of polynomials with rational coefficients. The square root of a rational which is not a perfect square is an example. Transcendental Irrationals are the rest of the irrationals (numbers like and the Euler number )
  • is the symbol used for the set of Real Numbers. The reals are the rationals and the irrationals combined. contains all the numbers that usually show up in high school.


Note, that all these set have infinite cardinality (number of members). Investigating the different sizes of infinity (Aleph Number) represented here is left to the student's interest and discretion.

There are other useful sets like: the Imaginary Numbers, Complex Numbers, sets of vectors, sets of Matrices, etc. We will discuss more in time.

Quantifiers

It can be useful to know if all, some, or none of the elements of a set have a certain property. Lets look at how one might write this. To begin lets define a set according to a certain rule. We will define the set of even natural numbers and call it . The the elements of the set (lets call an arbitrary element ) are all divisible by . In symbols we could write . It is also a true statement to say . Some of the elements are divisible by two, because all of them are. It would not be true to say no elements are divisible by two though. That is to say, is a false statement.

As another example take the set and denote the set of prime numbers by . Some of these numbers are prime (). It would be false to state that all of the elements of are prime () or to state that none of them are prime ().

Applications

Set theory provides the base objects from which many of the other statements in math are constructed. Set theory and logic, together, lay much of the ground work for the rest of math.

In particular Sets are useful when talking about probabilities, when we do arithmetic and algebra with their elements and when used as what we map between when discussing functions. We will use sets explicitly and implicitly very often.

Exercises

Principle of Inclusion Exclusion

InclExcl.png

Consider , , , and . Do you see a relationship to get from the other three values? Try repeating for and ? Does your relationship hold? Now consider in terms of , , , , , and . Use the Venn Diagram for inspiration. Hint get rid of double counting. This relationship is called the Inclusion-Exclusion Principle. If you'd like to check your relationship, have a look online. Wikipedia has a nice article with everything you need at the top of the page.

Set Algebra

We can do Algebra on sets, just like in logic. Compare the following identities to the rules of replacement from logic. Do you see a connection? What do the two new compliment laws at the bottom correspond to? The intersection and union symbols are chosen suggestively. For the rules which result in a single symbol of the right hand side, consider how this simplification comes about, and how it might feed into another simplification later to further simplify the whole expression. Please draw the Venn Diagrams for the expressions with more than one symbol on the right side. Reminder the s, s, and s here are sets. In the logic section they were statements. The same symbols are used to mean two different things. This was done to emphasize the similarity between the two kinds of algebra. We will see many of the same rules show up again when we talk about algebra on numbers, vectors, and matrices.


Have a peek at Wikipedia's Algebra of Sets if you would like more detail.

Infinite Set Venn Diagram

Please draw a Venn Diagram illustrating how and are subsets of and eachother. You may wish to choose to partition the rationals and irrationals inside the reals for clarity (as all reals are either rational or irrational). It may also be nice to set the universe as the reals. That is to say you may want to start with something like this.

InfSetPart.png

As a note, the diagram is for understanding the hierarchy of subsets only. The relative sizes of the images do not connote the relative sizes of the sets. For instance the irrationals are considered a larger infinity than the rationals.

Extensions

Try Set Algebra

If you would like to try using the set identities, here are a few problems. If you ever get stuck, check the Venn Diagram of the left hand side and right hand side to see if they still match. If they don't you have an error. Alternatively you can directly replace with , with , with , with , with F, U with T, and with , then compare truth tables. They should match. Using the order of operations from logic you can infer the order of operation in set theory (using the replacements just indicated). Wolfram Alpha will again be useful for checking your answers.

Defining Numbers with Sets

Interested students may want to read about the Cardninal and Ordinal properties of the Naturals and von Neumann Ordinals. Wikipedia has a nice resource Defining Natural Numbers

Suggested Resources

Set Calculator with Example