Tuesday, May 20, 2025

Probability - Quick Intro

 🧠 What is Probability?

Probability is the likelihood or chance that a certain event will happen.

  • Probability is always a number between 0 and 1.

    • 0 = impossible event (e.g., tossing a coin and getting a mango 🍋)

    • 1 = certain event (e.g., tossing a coin and getting either heads or tails)

Formula:

Probability=Number of favorable outcomesTotal number of outcomes\text{Probability} = \frac{\text{Number of favorable outcomes}}{\text{Total number of outcomes}}

🎯 Let’s Begin with Real-World Examples


Problem 1: Tossing a Coin

You toss a fair coin. What’s the probability of getting heads?

Favorable outcomes = 1 (heads)
Total outcomes = 2 (heads, tails)

P(Heads)=12=0.5=50%P(\text{Heads}) = \frac{1}{2} = 0.5 = 50\%

Problem 2: Rolling a Die 🎲

You roll a standard 6-sided die. What’s the probability of getting a 4?

Favorable outcomes = 1 (just the number 4)
Total outcomes = 6 (1 to 6)

P(4)=160.167=16.7%P(4) = \frac{1}{6} \approx 0.167 = 16.7\%

Problem 3: Drawing a Card

A card is drawn from a standard 52-card deck. What is the probability it is a red card?

  • Red cards = 26 (13 Hearts + 13 Diamonds)

  • Total cards = 52

P(Red)=2652=12=50%P(\text{Red}) = \frac{26}{52} = \frac{1}{2} = 50\%

Problem 4: Real Life – Email Spam Detection

Out of 1,000 emails, 200 are spam. What’s the probability that a randomly picked email is spam?

P(Spam)=2001000=0.2=20%P(\text{Spam}) = \frac{200}{1000} = 0.2 = 20\%

This is how spam filters work — by calculating the probability that a certain email is spam based on keywords, sender, etc.


Problem 5: Weather Forecasting

If the weather department says there's a 70% chance of rain, what does that mean?

It means:

“Based on historical data and current conditions, in 70 out of 100 similar situations, it rained.”

Probability isn't a guarantee — it's a best estimate based on available information.


🔄 Want to Practice?

Here’s a quick practice quiz (answers below):

  1. What is the probability of getting an even number when rolling a die?

  2. A bag has 3 red balls, 2 green balls, and 5 blue balls. What’s the probability of drawing a green ball?

  3. A startup claims 95% customer satisfaction. If you pick a random customer, what’s the probability they're not satisfied?


✅ Practice Quiz Answers:

  1. Even numbers = 2, 4, 6 → 3/6 = 0.5

  2. Green = 2, total = 10 → 2/10 = 0.2

  3. Not satisfied = 100% - 95% = 5% → 0.05


🧮 1. Addition Rule of Probability – “OR” Situations

This rule applies when you're calculating the probability that either one event OR another happens.

🔹 Basic Formula:

P(A or B)=P(A)+P(B)P(A and B)P(A \text{ or } B) = P(A) + P(B) - P(A \text{ and } B)

Example 1: Drawing a King or a Queen

You draw 1 card from a 52-card deck. What's the probability of getting a King or a Queen?

  • P(King) = 4/52

  • P(Queen) = 4/52

  • P(King and Queen at the same time) = 0 (can't happen in one draw)

P(K or Q)=452+4520=852=213P(K \text{ or } Q) = \frac{4}{52} + \frac{4}{52} - 0 = \frac{8}{52} = \frac{2}{13}

➖ 2. Subtraction in Probability – “NOT” Events

Use subtraction when you want the probability that something doesn’t happen.

🔹 Formula:

P(Not A)=1P(A)P(\text{Not A}) = 1 - P(A)

Example 2: Weather App

The weather forecast says 80% chance of rain. What's the probability it won’t rain?

P(No rain)=10.8=0.2=20%P(\text{No rain}) = 1 - 0.8 = 0.2 = 20\%

✖️ 3. Multiplication Rule of Probability – “AND” Situations

This is used when both events must happen.

🔹 Independent Events (like tossing a coin and rolling a die):

P(A and B)=P(A)×P(B)P(A \text{ and } B) = P(A) \times P(B)

Example 3: Toss a Coin AND Roll a Die

What's the probability of getting Heads and rolling a 6?

  • P(Heads) = 1/2

  • P(6) = 1/6

P(H and 6)=12×16=112P(H \text{ and } 6) = \frac{1}{2} \times \frac{1}{6} = \frac{1}{12}

➗ 4. Division in ProbabilityConditional Probability

This is used when one event affects the probability of another. Example: medical tests, fraud detection, investment performance under conditions.

🔹 Formula:

P(AB)=P(A and B)P(B)P(A|B) = \frac{P(A \text{ and } B)}{P(B)}

“Probability of A given B has happened.”


Example 4: Testing for Disease

Out of 1,000 people:

  • 100 have a disease.

  • 90 of those test positive.

  • 50 healthy people also test positive (false positive).

What’s the probability a person has the disease given they tested positive?

  • Total positive tests = 90 (true) + 50 (false) = 140

  • True positives = 90

P(DiseasePositive)=901400.643=64.3%P(\text{Disease}|\text{Positive}) = \frac{90}{140} \approx 0.643 = 64.3\%

🧠 Quick Summary

OperationUse CaseExample
➕ AdditionA or BKing or Queen in a deck
➖ SubtractionNot ANo rain = 1 - P(Rain)
✖️ MultiplicationA and BCoin = Heads AND die = 6
➗ DivisionA given B (Conditional)Disease given test is positive

🧩 What is Conditional Probability?

Conditional probability means:

“What’s the probability of A happening, given that B already happened?

It’s like asking:

“Now that we know B is true, what’s the chance that A is also true?”


🔁 Formula Recap:

P(AB)=P(A and B)P(B)P(A \mid B) = \frac{P(A \text{ and } B)}{P(B)}

  • P(A | B)” is read as: Probability of A given B

  • You divide the chance of both A and B happening by the chance of B happening alone


🔍 Let’s Use a Real-World Example:

Example: Medical Test for a Rare Disease

You test 1,000 people.

  • 100 people actually have the disease

  • The test correctly identifies 90 out of those 100 (true positives)

  • But it wrongly flags 50 healthy people as positive (false positives)

So, total positive test results =
→ 90 (from diseased) + 50 (from healthy) = 140

Now we ask:

If someone tested positive, what is the chance they actually have the disease?

You're only looking at the people who tested positive (140 total).

Among them, only 90 actually have the disease.

So:

P(Has Disease | Tested Positive)=901400.643=64.3%P(\text{Has Disease | Tested Positive}) = \frac{90}{140} \approx 0.643 = 64.3\%

✅ Even though the test is 90% accurate, the actual chance of having the disease given a positive test is only 64.3% — because of false positives!


🔄 Another Easy Example: Family & Tea

Let’s say:

  • 100 people visited your house.

  • 40 people were women.

  • 30 women drank tea.

  • 20 men also drank tea.

Q: If a person is drinking tea, what’s the probability they are a woman?


Step-by-step:

  • Total tea drinkers = 30 (women) + 20 (men) = 50

  • Tea drinkers who are women = 30

So:

P(WomanTea)=3050=0.6=60%P(\text{Woman} \mid \text{Tea}) = \frac{30}{50} = 0.6 = 60\%


📦 Summary: Think Like a Filter

  • Conditional probability narrows your world to just the group you're told about (e.g., “people who tested positive”).

  • Then ask: How many in that group also fit the condition you care about?

🎯 Concept: Conditional Probability with More Than 1 Condition

We now look at:

🔍 What’s the probability of Event A, given that B and C have both occurred?

This is written as:

P(AB and C)P(A \mid B \text{ and } C)

Real-Life Example: Hiring Based on Skills and Experience

You are a manager hiring candidates.
You have data on 100 applicants.

CriteriaNo. of People
Knows Python (B)60
Has >3 years experience (C)50
Knows Python and has >3 yrs exp (B and C)30
Got Selected (A) AND knows Python and has >3 yrs experience24

❓What is the probability a person is selected (A), given they know Python and have >3 years experience (B and C)?

You are now asking:

P(AB and C)=P(A and B and C)P(B and C)P(A \mid B \text{ and } C) = \frac{P(A \text{ and } B \text{ and } C)}{P(B \text{ and } C)}

From the table:

  • P(A and B and C)=24100P(A \text{ and } B \text{ and } C) = \frac{24}{100}

  • P(B and C)=30100P(B \text{ and } C) = \frac{30}{100}

P(AB and C)=24/10030/100=2430=0.8=80%P(A \mid B \text{ and } C) = \frac{24/100}{30/100} = \frac{24}{30} = 0.8 = 80\%

💡 What does this mean?

Among those who know Python and have experience, 80% were selected. So, if a new candidate meets both conditions, the chance of getting selected is very high.

No comments:

Post a Comment

15 Stock Investment Tips from Rakesh Jhunjhunwala

1. Always go against tide. Buy when others are selling and sell when others are buying.  2. If you believe in the growth prospects o...