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 ABA \cup B represents outcomes where either AA occurs, or BB occurs, or both occur.

Formula:

P(AB)=P(A)+P(B)P(AB)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:

  • AB={1,2,3,4,6}A \cup B = \{1, 2, 3, 4, 6\}
  • AB={2}A \cap B = \{2\}

Calculations step-by-step:

P(A)=36=12P(B)=36=12P(AB)=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(AB)=36+3616=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 ABA \cap B represents outcomes where both AA and BB occur simultaneously.

General Formula

In all cases:

P(AB)=P(A)×P(BA)P(A \cap B) = P(A) \times P(B|A)

where P(BA)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(AB)=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(AB)=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(AB)=P(A)×P(BA)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(AB)=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

Suggested prompts:

Can you explain more about the difference between union and intersection in probability?

Could you give another example using Venn diagrams?

How do conditional probabilities fit into these rules?

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 ABA \cup B represents outcomes where either AA occurs, or BB occurs, or both occur.

Formula:

P(AB)=P(A)+P(B)P(AB)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:

  • AB={1,2,3,4,6}A \cup B = \{1, 2, 3, 4, 6\}
  • AB={2}A \cap B = \{2\}

Calculations step-by-step:

P(A)=36=12P(B)=36=12P(AB)=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(AB)=36+3616=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 ABA \cap B represents outcomes where both AA and BB occur simultaneously.

General Formula

In all cases:

P(AB)=P(A)×P(BA)P(A \cap B) = P(A) \times P(B|A)

where P(BA)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(AB)=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(AB)=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(AB)=P(A)×P(BA)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(AB)=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