Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Understanding Probability Basics | Probability & Statistics
Mathematics for Data Science

bookUnderstanding Probability Basics

Note
Definition

Probability is the measure of the likelihood that an event will occur. It quantifies uncertainty and is essential in fields like data science, statistics, and machine learning, helping us analyze patterns, make predictions, and assess risks.

The Basic Definition of Probability

The probability of an event AA occurring is given by:

P(A)=NumberΒ ofΒ favorableΒ outcomesTotalΒ numberΒ ofΒ possibleΒ outcomesP(A) = \frac{\text{Number of favorable outcomes}}{\text{Total number of possible outcomes}}

This formula tells us how many ways our desired event can happen compared to all possible outcomes. Probability always ranges from 0 (impossible) to 1 (certain).

Understanding Sample Space and Events

  • Sample space - all possible outcomes of an experiment;
  • Event - a specific outcome or set of outcomes we're interested in.

Example with flipping a coin:

  • Sample space = {Heads, Tails} ;
  • Event A = {Heads} .

Then:

P(A)=P(Heads)P(Heads)+P(Tails)=0.50.5+0.5=0.5P(A) = \frac{P(\text{Heads})}{P(\text{Heads}) + P(\text{Tails})} = \frac{0.5}{0.5+0.5} = 0.5

Union Rule: "A OR B Happens"

Definition: the union of two events AβˆͺBA \cup B represents outcomes where either AA occurs, or BB occurs, or both occur.

Formula:

P(AβˆͺB)=P(A)+P(B)βˆ’P(A∩B)P(A \cup B) = P(A) + P(B) - P(A \cap B)

We subtract the intersection to avoid double-counting outcomes that appear in both events.

Union Example: Rolling a Die

Let's roll a six-sided die:

  • Event A = {1, 2, 3} (rolling a small number)
  • Event B = {2, 4, 6} (rolling an even number)

Union and intersection:

  • AβˆͺB={1,2,3,4,6}A \cup B = \{1, 2, 3, 4, 6\}
  • A∩B={2}A \cap B = \{2\}

Calculations step-by-step:

P(A)=36=12P(B)=36=12P(A∩B)=16P(A) = \frac{3}{6} = \frac{1}{2} \\[6pt] P(B) = \frac{3}{6} = \frac{1}{2} \\[6pt] P(A \cap B) = \frac{1}{6}

Apply the union formula:

P(AβˆͺB)=36+36βˆ’16=56P(A \cup B) = \frac{3}{6} + \frac{3}{6} - \frac{1}{6} = \frac{5}{6}

Intersection Rule: "A AND B Both Happen"

Definition: The intersection of two events A∩BA \cap B represents outcomes where both AA and BB occur simultaneously.

General Formula

In all cases:

P(A∩B)=P(A)Γ—P(B∣A)P(A \cap B) = P(A) \times P(B|A)

where P(B∣A)P(B|A) is the conditional probability of BB given that AA has already occurred.

Case 1: Independent Events

If the events do not affect each other (e.g., flipping a coin and rolling a die):

P(A∩B)=P(A)Γ—P(B)P(A \cap B) = P(A) \times P(B)

Example:

  • P(HeadΒ onΒ aΒ coin)=12P(\text{Head on a coin}) = \frac{\raisebox{1pt}{$1$}}{\raisebox{-1pt}{$2$}};
  • P(6Β onΒ aΒ die)=16P(\text{6 on a die}) = \frac{\raisebox{1pt}{$1$}}{\raisebox{-1pt}{$6$}}.

Then:

P(A∩B)=12Γ—16=112P(A \cap B) = \tfrac{1}{2} \times \tfrac{1}{6} = \tfrac{1}{12}

Case 2: Dependent Events

If the result of the first event influences the second (e.g., drawing cards without replacement):

P(A∩B)=P(A)Γ—P(B∣A)P(A \cap B) = P(A) \times P(B|A)

Example:

  • P(firstΒ cardΒ isΒ anΒ Ace)=452P(\text{first card is an Ace}) = \tfrac{\raisebox{1pt}{$4$}}{52};
  • P(secondΒ cardΒ isΒ anΒ AceΒ |Β firstΒ cardΒ wasΒ anΒ Ace)=351P(\text{second card is an Ace | first card was an Ace}) = \tfrac{\raisebox{1pt}{$3$}}{\raisebox{-1pt}{$51$}}.

Then:

P(A∩B)=452Γ—351=1221P(A \cap B) = \tfrac{4}{52} \times \tfrac{3}{51} = \tfrac{1}{221}
question mark

In a deck of 52 cards, what is the probability of drawing a red king?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 5. ChapterΒ 1

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Awesome!

Completion rate improved to 1.96

bookUnderstanding Probability Basics

Swipe to show menu

Note
Definition

Probability is the measure of the likelihood that an event will occur. It quantifies uncertainty and is essential in fields like data science, statistics, and machine learning, helping us analyze patterns, make predictions, and assess risks.

The Basic Definition of Probability

The probability of an event AA occurring is given by:

P(A)=NumberΒ ofΒ favorableΒ outcomesTotalΒ numberΒ ofΒ possibleΒ outcomesP(A) = \frac{\text{Number of favorable outcomes}}{\text{Total number of possible outcomes}}

This formula tells us how many ways our desired event can happen compared to all possible outcomes. Probability always ranges from 0 (impossible) to 1 (certain).

Understanding Sample Space and Events

  • Sample space - all possible outcomes of an experiment;
  • Event - a specific outcome or set of outcomes we're interested in.

Example with flipping a coin:

  • Sample space = {Heads, Tails} ;
  • Event A = {Heads} .

Then:

P(A)=P(Heads)P(Heads)+P(Tails)=0.50.5+0.5=0.5P(A) = \frac{P(\text{Heads})}{P(\text{Heads}) + P(\text{Tails})} = \frac{0.5}{0.5+0.5} = 0.5

Union Rule: "A OR B Happens"

Definition: the union of two events AβˆͺBA \cup B represents outcomes where either AA occurs, or BB occurs, or both occur.

Formula:

P(AβˆͺB)=P(A)+P(B)βˆ’P(A∩B)P(A \cup B) = P(A) + P(B) - P(A \cap B)

We subtract the intersection to avoid double-counting outcomes that appear in both events.

Union Example: Rolling a Die

Let's roll a six-sided die:

  • Event A = {1, 2, 3} (rolling a small number)
  • Event B = {2, 4, 6} (rolling an even number)

Union and intersection:

  • AβˆͺB={1,2,3,4,6}A \cup B = \{1, 2, 3, 4, 6\}
  • A∩B={2}A \cap B = \{2\}

Calculations step-by-step:

P(A)=36=12P(B)=36=12P(A∩B)=16P(A) = \frac{3}{6} = \frac{1}{2} \\[6pt] P(B) = \frac{3}{6} = \frac{1}{2} \\[6pt] P(A \cap B) = \frac{1}{6}

Apply the union formula:

P(AβˆͺB)=36+36βˆ’16=56P(A \cup B) = \frac{3}{6} + \frac{3}{6} - \frac{1}{6} = \frac{5}{6}

Intersection Rule: "A AND B Both Happen"

Definition: The intersection of two events A∩BA \cap B represents outcomes where both AA and BB occur simultaneously.

General Formula

In all cases:

P(A∩B)=P(A)Γ—P(B∣A)P(A \cap B) = P(A) \times P(B|A)

where P(B∣A)P(B|A) is the conditional probability of BB given that AA has already occurred.

Case 1: Independent Events

If the events do not affect each other (e.g., flipping a coin and rolling a die):

P(A∩B)=P(A)Γ—P(B)P(A \cap B) = P(A) \times P(B)

Example:

  • P(HeadΒ onΒ aΒ coin)=12P(\text{Head on a coin}) = \frac{\raisebox{1pt}{$1$}}{\raisebox{-1pt}{$2$}};
  • P(6Β onΒ aΒ die)=16P(\text{6 on a die}) = \frac{\raisebox{1pt}{$1$}}{\raisebox{-1pt}{$6$}}.

Then:

P(A∩B)=12Γ—16=112P(A \cap B) = \tfrac{1}{2} \times \tfrac{1}{6} = \tfrac{1}{12}

Case 2: Dependent Events

If the result of the first event influences the second (e.g., drawing cards without replacement):

P(A∩B)=P(A)Γ—P(B∣A)P(A \cap B) = P(A) \times P(B|A)

Example:

  • P(firstΒ cardΒ isΒ anΒ Ace)=452P(\text{first card is an Ace}) = \tfrac{\raisebox{1pt}{$4$}}{52};
  • P(secondΒ cardΒ isΒ anΒ AceΒ |Β firstΒ cardΒ wasΒ anΒ Ace)=351P(\text{second card is an Ace | first card was an Ace}) = \tfrac{\raisebox{1pt}{$3$}}{\raisebox{-1pt}{$51$}}.

Then:

P(A∩B)=452Γ—351=1221P(A \cap B) = \tfrac{4}{52} \times \tfrac{3}{51} = \tfrac{1}{221}
question mark

In a deck of 52 cards, what is the probability of drawing a red king?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 5. ChapterΒ 1
some-alt