Conditional probability, simply explained

Tivadar Danka small portrait Tivadar Danka
The definition of conditional probability

Understanding math will make you a better engineer.

So, I am writing the best and most comprehensive book about it.

What is the single most important concept in statistics?

Conditional probability. Without a way to account for prior information in our models, statistical models would be useless.

Let's see what conditional probability simply means!

If A\textstyle A and B\textstyle B are two events, they are not necessarily independent of each other. This means that the occurrence of one can give information about the other.

When performing statistical modeling, this is frequently the case. To illustrate, we will take a look at spam filters!

Suppose that you have 100 emails in your inbox. 40 is spam. 60 is not.

Spam vs not spam

Based only on this information, if you receive a random letter, the best guess is a 40% chance of it being spam. This is not good enough for effective spam detection. Let's look at some additional information!

What about taking a look at the mail and checking for the word "offer"? It turns out that among the 48 mails containing this word, 36 are spam! Here, we can find this by simply counting.

Spam vs not spam, when looking at particular words

So, let's formulate this in the language of probability! Based on this sample, if you know that a mail contains the word "offer", there is a 75% chance of being spam. In mathematical words, we have

P(spam  contains the word "offer")=3648=0.75. P(\text{spam } | \text{ contains the word "offer"}) = \frac{36}{48} = 0.75.

Knowing this can help you make a better decision when filtering out unwanted spam mail.

Essentially, conditional probability restricts the event space to the observed event. It allows you to refine your statistical models upon gaining new information.


However, obtaining it is not always as simple. Often, you can't just simply count all the cases. For these situations, the Bayes formula provides a tractable way to update our beliefs about the world, given new information. (I recently wrote a blog post on this, check it out!)

Having a deep understanding of math will make you a better engineer.

I want to help you with this, so I am writing a comprehensive book that takes you from high school math to the advanced stuff.
Join me on this journey and let's do this together!