Tivadar Danka Profile picture
Feb 15 14 tweets 5 min read
People are inherently bad at probabilistic thinking.

Our intuition deceives us. We often encounter seemingly contradictory phenomena that go against our expectations.

The most famous example is the Monty Hall paradox. Let's see what it is and how to resolve it!

↓ A thread. ↓
In the ’60s, there was a TV show in the United States called Let’s Make a Deal.

As a contestant, you faced three closed doors, one having a car behind it (that you could take home), while the rest were empty.

You had the opportunity to open one.
Suppose that after selecting door No. 1, Monty Hall, the show host, opens the third, showing that it was not the winning one.

Now, you have the opportunity to change your mind and open door No. 2 instead of the first one.

Do you take it?
At first glance, your chances are 50%-50%, so you are not better off switching.

However, this couldn't be further from the truth!

Let's explain why.
To set things straight, let’s do a careful probabilistic analysis!

Let Aᵢ denote the event that the price is behind the i-th door, while Bᵢ is the event of Monty opening the i-th door.

Regarding the price, each door is equally probable.
However, Monty opening the third door changes everything.

When building probabilistic models, we must account for events that influence each other's occurrence.

This is formalized by conditional probability. (Below is my explainer.)

We want the probability of the price behind the first and the second door, given that Monty Hall opened the third one.

By thinking from the perspective of the show host, which door would you open?
If Monty knows that the price is behind the 1st door, he opens the 2nd and 3rd one with equal probability.

However, if the price is actually behind the 2nd door (and the contestant selected the 1st one), Monty always opens the 3rd one!
Using the Bayes formula, we can finally calculate the probabilities we need.

In summary, if we picked the 1st door and Monty opened the 3rd one, we are twice as likely to win if we switch doors!

What seemed counterintuitive is now proven.
(If you are not familiar with the Bayes formula, here is an explanation thread I posted recently. 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 about the subject.

If you are interested in the details and beauties of mathematics, check out the early access!

tivadardanka.com/book
I regularly post deep-dive explanations about seemingly complex concepts from mathematics and machine learning.

If you have enjoyed this thread, consider giving it a retweet and following me!

Mathematics is beautiful, and I want to show this to you.
I have made a small mistake in this thread, pointed out by @AlfonAmayuelas!

The crux of the issue is that P(B1), P(B2), and P(B3) are unknown to us. Therefore, the final probabilities are obtained the following way. ↓

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Tivadar Danka

Tivadar Danka Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @TivadarDanka

Jan 12
You can explain the Bayes formula in pure English.

Despite being overloaded with seemingly complex concepts, it conveys an important lesson about how observations change our beliefs about the world.

Let's take it apart!

↓ A thread. ↓
Essentially, the Bayes formula describes how to update our models, given new information.

To understand why, we will look at a simple example with a twist: tossing a biased coin.
Suppose that we have a magical coin!

When tossed, it can come up with heads or tails, but not necessarily with equal chance.

The catch is, we don't know the exact probabilities. So, we have to perform some experiments to find that out.
Read 14 tweets
Dec 27, 2021
Entropy is not the easiest thing to understand.

It is rumored to describe something about information and disorder, but it is unclear why.

What do logarithms and sums have to do with the concept of information?

Let me explain!

↓ A thread. ↓
I have randomly selected an integer between 0 and 31.

Can you guess which one? You can ask as many questions as you want.

What is the minimum number of questions you have to ask to be 100% sure?

You can start guessing the numbers one by one, sure. But there is a better way!
If you ask, "is the number larger or equal than 16?" you immediately eliminate half the search space!

Continuing with this tactic, you can find the number for sure in 5 questions.
Read 15 tweets
Dec 16, 2021
Why is matrix multiplication defined the way it is?

When I first learned about it, the formula seemed too complicated and counter-intuitive! I wondered, why not just multiply elements at the same position together?

Let me explain why!

↓ A thread. ↓

1/11
First, let's see how to make sense of matrix multiplication!

The elements of the product are calculated by multiplying rows of 𝐴 with columns of 𝐵.

It is not trivial at all why this is the way. 🤔

To understand, let's talk about what matrices really are!

2/11
Matrices are just representations of linear transformations: mappings between vector spaces that are interchangeable with addition and scalar multiplication.

Let's dig a bit deeper to see why are matrices and linear transformations are (almost) the same!

3/11
Read 11 tweets
Dec 15, 2021
Expected value is one of the most fundamental concepts in probability theory and machine learning.

Have you ever wondered what it really means and where it comes from?

The formula doesn't tell the entire story right away.

💡 Let's unravel what is behind the scenes! 💡
First, let's take a look at a simple example.

Suppose that we are playing a game. You toss a coin, and

• if it comes up heads, you win $1,
• but if it is tails, you lose $2.

Should you even play this game with me? 🤔

We are about to find out!
After 𝑛 rounds, your earnings can be calculated by the number of heads times $1 minus the number of tails times $2.

If we divide total earnings by 𝑛, we obtain the average earnings per round.

What happens if 𝑛 approaches infinity? 🤔
Read 9 tweets
Dec 9, 2021
Just released a new chapter in the early access of my Mathematics of Machine Learning book!

It is about computing determinants in practice. Sadly, this is often missing from linear algebra courses, so I decided to fill this gap.

↓ Here's the gist. ↓
The determinant of a matrix is essentially the product of

• the orientation of its column vectors (which is either 1 or -1),
• and the area of the parallelepiped determined by them.

For 2x2 matrices, this is illustrated below.
Here is the thing.

In mathematics, we generally use two formulas to compute this quantity.

First, we have a sum that runs through all permutations of the columns.

This formula is hard to understand, let alone to implement.
Read 10 tweets
Dec 8, 2021
Math Twitter!

I have an annoyingly simple problem that has been bugging me for years. It is about the 3-regular infinite tree graph with a root.

Can we collaboratively solve this problem? I'll explain below.

(Retweet so this reaches as many smart people as possible.) Image
The 3-regular infinite tree with a root (3RT) is very simple to define.

The root vertex has two children, and besides that, every vertex has two more. This goes on infinitely.

You get the pattern. This is illustrated below. Image
It is easy to see that 3RT is a planar graph; that is, you can draw it on the plane without any edges intersecting.

I am particularly interested in drawing the 3RT inside a bounded set of the plane without any edges intersecting.
Read 7 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

:(