Let’s Talk About Sets In Probability
By: Acusio Bivona
Tags: Probability, Data Science

Let’s Talk About Sets In Probability

Discussing the foundation of probability and combinatorics

Probability is a vital area of study to understand in order to be an effective data scientist. It may not be the most fun, but having an understanding of the math underlying all the amazing work your models do will allow you to better explain and better develop all of your models. In this post, I will specifically be talking about sets, and will be covering these topics:

Defining what a set is

Explaining universal sets and subsets

Discussing the following set operations: unions, intersections, relative complements, and absolute complements

But first, what exactly is a set? Well, it’s generally described as a well-defined collection of objects. In mathematics, sets are usually represented by 𝑆. If you have an object X and it belongs to the set, then you would say that X ∈ 𝑆. But, if object X does not belong to the defined set, then you would say that X ∉ 𝑆. For example, if you define 𝑆 as a set of odd numbers, and if X= 1, then X ∈ 𝑆.

Universal Sets

A universal set is all the possible outcomes for any given context. Universal sets are often represented by the Greek sign Omega, Ω. For example, the universal set for the number of cards in a deck, if each individual card is to be represented only by a number, would be Ω = {1, 2, 3, …, 50, 51, 52}, for the 52 cards that are in the deck. One thing to note is that, although it has the word universal, a universal set does include an infinite number of possible outcomes, but only all the outcomes possible within certain conditions. Going back to the cards example, the number of elements for which the number of cards in a standard deck would contain is limited to 52 because that is the maximum number of cards in the deck.

Subsets

Let’s say you have two sets: set R and set S. We can declare that set R is a subset of set S if, and only if, every element in set R exists within set S. This can be represented with the notation R ⊆ S. But diving a little bit deeper, what you really want to look for are proper subsets. Technically, a subset can consist of the entire set, whereas a proper subset is only the specific elements that meet a specific condition. Example:

If set Y = {1,2,3} and set Z = {1,2,3}, Z is still a subset of Y.

But, if set Y = {1,2,3} and set X = {2,3}, then X is a subset and a proper subset of both Y and Z.

In mathematical notation, the proper subsets would be represented by X ⊂ Y and X ⊂ Z.

Set Operations

To start with the understanding of set operations, let’s first create two sets. Set A will be the first three multiples of 2, and set B will be the first three multiples of 3. So, set A = {2,4,6} and set B = {3,6,9}. The first set operation I’ll go over is union. A union of sets would contain all the elements in A, B or in both A and B. That means that the union of A and B = {2,3,4,6,9}. The union of A and B can be written with the notation A ∪ B.

The next set operation I’ll go over is intersection. The intersection of sets A and B would consist of the elements in A that also belong to B. So, the intersection of sets A and B = {6} only, because it’s the only number in either set that is a multiple of both 2 and 3. Mathematically, this would represented as A ∩ B.

Now, the next two get a little more complicated. The next set operation is called the relative complement, which is sometimes referred to as the difference. So, for A and B, the relative complement of A contains all of the elements of B that are not in A. The mathematical notation for the relative complement is represented with \, so A\B = {3,9}. 6 is not included because it is in both A and B. The relative complement is also sometimes represented with the symbol, -.

Lastly, here comes the most confusing one, which is the absolute complement. The first thing I want to make clear is that absolute complements are only used in consideration with universal sets (Ω). So, going back to our set A, the absolute complement of A in regards to the universal set, Ω, is all of the elements in Ω that are not in A. Confused? That’s totally okay. Let’s follow an example. To this point, we’ve only defined what sets A and B contain and have yet to define what the universal set contains. So, let’s define Ω as all of the multiples of 2 and 3 all the way up to 15. This means that Ω = {2, 3, 4, 6, 8, 9, 10, 12, 14, 15}. The mathematical notation of the absolute complement is represented by ′, so A′ = {3,8,9,10,12,14,15} because those are all of the elements from Ω that are not in set A.

When I was first studying data science, sets were probably the first thing that really made my brain hurt, which is why I wanted to write this blog post. So if you too are having trouble understanding sets, particularly the two types of complements, I hope this post helped clarify any confusion you may have. If not, that’s okay — keep looking for resources that can help and just keep practicing. You will get it! Thank you for reading.

LinkedIn