What is Set Theory
Set Theory is a foundational framework of mathematics
Why should I care?
Set Theory has the ability to represent complex topics in simple notation. For instance,
𝒫(ℝ²) contains every black and white image in existence
Something as short as 𝒫(ℝ²) encompasses a still image of everything.
You can also use set theory to represent everyday topics. A set can be used in programming when thinking about objects in an array. Set Theory can be useful when considering how tables interact in a database. A set can even be used to construct an argument in simple notation using something called Propositional Logic.
What are Sets?
Abstractly, you can think of a set as a box with unique things in it. Pretend you have a box that only holds unique shapes and the box has a square, a triangle, and a circle in it. No matter how you organize the shapes in the box, it will always contain a square, a triangle, and a circle.
The statement “I have a box with a square, a triangle, and a circle in it” and the statement “I have a box with a triangle, a circle, and a square in it” are essentially the same thing. No matter how you organize the items in the box they remain the same.
Formally, a set is any group of distinct objects. Take a square, a circle, and a triangle. A set of these shapes can be written as follows:
Shapes = {square, circle, triangle}
The order of a set does not matter, so the following sets are equal to S:
Shapes == {square, triangle, cirle} # true
Shapes == {triangle, square, cicle} # true
Shapes == {triangle, square, square, square, cicle} # true
You may ask yourself why the following is true:Shapes == {triangle, square, square, square, cicle}
?
The two look different but a set is a group of distinct objects. So three “squares” are equivalent to one square.
Assuming we have the same set of shapes from the above section: Shapes = {square, circle, triangle}.
It is important to note that the following are not equal to Shapes:
Shapes != {square, triangle, circle, rectangle}
Shapes != {square, {circle}, triangle}
You may ask yourself why {square, {circle}, triangle} != S
?
The two look similar but circle != {circle}
. The set containing a circle and the object circle are related but they are not equal.
If we take the same box analogy we used earlier then this would be like saying I have a box with a circle in it and a circle. Clearly, a box with a circle in it is not the same thing as a circle by itself. How do we define the difference between these two scenarios?
What is Set membership?
The individual shapes in our box are an example of set membership. The square is a “member” of our box just like the circle and the triangle are “members” of our box.
Formally, an element (“member”) of a set is an object that is contained in the set. Thus a circle is an element of the set containing a circle, we commonly write this in set notation like:
circle ∈ {circle}
The following are all true given the same set of Shapes from above:
Shapes = {square, circle, triangle}---circle ∈ ShapesShapes ∈ {{circle, triangle, square}}
Shapes != {{circle, triangle, square}}
You may ask yourself how can the set Shapes be a member of another set? Well, imagine that you have a box containing a square, a circle, and a triangle… and then you put that box in another box. There you have it, a set within a set.
The Empty Set
The following statements are also true:
circle != {circle}There is nothing contatined in {}
What then is the set that contains no objects?
Well, this is similar to an empty box. Remove the square, the triangle, and the circle from the box and all we are left with is the box. In the following examples, you will see that the box is equal to the set containing nothing. And, an empty box is not the same thing as an empty box with an empty box in it.
Formally, the idea of the empty box is called the empty set, ∅.
∅ = {}
∅ ∈ {{}}
∅ != {{}}
To sum up what we’ve covered so far.
- A set is a group of distinct elements.
2. We write x ∈ {1,2,3}
to mean 1 is an element of the set 1, 2, 3.
3. We write {1,2,3} ∈ N
to say the set {1,2,3} is an element of the set N.
4. The set containing no objects is known as the empty set and is written as ∅.
So What?
All of this may seem interesting to you but you’re still asking yourself how does this help me in my daily life? How do I apply these concepts to programming or arguing? How does an empty box in a box relate to some symbols and images? How does 𝒫(ℝ²) contain every black and white image in existence?
Set Theory is a simple framework that builds quickly. It will take a few more articles to build the intuition of the Set Theory concepts necessary to explain these ideas!
In my next article, I will describe Subset and Set Operations to bring us one step closer to the answer that you’re looking for.
Do you have any questions about the basics? Is there anything here that you feel I misrepresented or left out? Feel free to comment or send me a message!
Learn about Subsets and Set Operations in my next article that you can find here.