Basics of Probability and Statistics

Introduction: Welcome to the ZPD

  • You’ve just been hired by the Zootopia Police Department.

  • … Not as an officer, but as the City’s Data Analyst.

  • A stack of paperwork lands on your desk.

    • “Every year, ZPD puts out a report,” she says. “Hiring numbers, exam scores, patrol stats, you name it. The mayor’s office wants someone independent to check it. That’s you now.”

    • She taps the folder. “Before you can check anything, though, you need to understand chance. Random noise looks a lot like a pattern if you don’t know what you’re looking at.”

A Random Experiment

Definition

A random experiment is any process whose outcome can’t be predicted with certainty in advance, but we do know the possible outcomes.

  • ZPD randomly selects one recruit from this year’s academy class to review.

    • The recruit is selected at random from the pool of all recruits in the class.
  • We do not know who will be selected, but we know the pool of candidates.

Outcomes, Sample Space, and Events

  • An outcome is one specific result of the experiment.

    • e.g., Officer Hopps
  • The sample space is the set of all possible outcomes.

    • e.g., the graduating class of 2025
  • An event is any collection of outcomes we care about.

    • e.g., the recruit picked works Patrol

Looking Forward

Probability is just a way of assigning a number to how likely an event is, based on the sample space it came from.

Probability Ground Rules

  1. Every probability is between 0 and 1. 0 \le P(A) \le 1 where P(A) = \begin{cases} 0, & \text{A is impossible} \\ 1, & \text{A is guaranteed} \end{cases}

  2. All possible outcomes, added together, equal 1.

    • The full sample space accounts for 100% of the possibilities.

The Complement Rule

The Complement Rule

P(A^c) = 1 - P(A)

The probability an event doesn’t happen is 1 minus the probability it does.

  • Why it’s useful: sometimes the complement of what you want is much easier to work out directly.

Practice: Complement Rule

Example

If 72% of recruits work Patrol, what fraction work Desk duty?

  • P(\text{Desk}) = 1 - P(\text{Patrol}) = 1 - 0.72 = 0.28

  • 28% of recruits work Desk duty.

Practice: Complement Rule

Example

ZPD’s records show that 15% of academy applicants fail the physical exam. What’s the probability a randomly chosen applicant passes?

  • P(\text{pass}) = 1 - P(\text{fail}) = 1 - 0.15 = 0.85

  • We expect that a randomly chosen applicant will pass 85% of the time.

Conditional Probability

Conditional probability

P(A \mid B)

The probability of A, given that B has already happened. New information (B) changes what we believe is likely.

  • Conditional probability shrinks the sample space down to the part we now know is true, then calculates the probability.

Practice: Conditional Probability

Example

Suppose ZPD’s weather log shows it rains fairly often in Rainforest District, but almost never in Sahara Square. You are asked to find P(\text{rain} \mid \text{Rainforest District}). How is this different from P(\text{rain})?

  • P(\text{rain}) is for all of Zootropolis.

  • P(\text{rain} \mid \text{Rainforest District}) is for only the Rainforest District.

Practice: Conditional Probability

Example

Among all ZPD recruits, 60% work in Tundratown. Among Tundratown recruits specifically, 10% passed the academy exam on their first attempt.

  • What does P(\text{pass} \mid \text{Tundratown}) = 0.10 actually tell you?

    • If you already know a recruit is stationed in Tundratown, there’s a 10% chance they passed the exam the first time they took it.

    • This is a more specific number than the first-time pass rate for ZPD as a whole.

Independence

Independent Events

Two events are independent when knowing one tells you nothing about the other: P(A \mid B) = P(A)

  • Independence means shrinking the sample space changes nothing; eliminating part of it doesn’t change the probability at all.

Practice: Independence

Example

Suppose P(\text{pass exam}) = 0.85 overall, and P(\text{pass exam} \mid \text{Tundratown}) = 0.10. Are “passing the exam” and “being assigned to Tundratown” independent?

  • No. If they were independent, both numbers would be equal.

  • Because they are not, this implies that, knowing someone’s district does change what we’d expect about their exam outcome.

Practice: Independence

Example

Suppose P(\text{pass exam}) = 0.85 overall, and among recruits whose last name starts with a vowel, P(\text{pass exam} \mid \text{vowel last name}) = 0.85 as well. Are “passing the exam” and “having a last name that starts with a vowel” independent?

  • Both numbers are equal. Knowing a recruit’s last name starts with a vowel doesn’t change the probability they passed the exam.

  • P(A \mid B) = P(A), therefore, A is independent of B.

Unions and Intersections

  • Before we talk more about probability we should first discuss unions and intersections.
A B

Union: A \cup B

Everything in A, B, or both.

A B

Intersection: A \cap B

What’s in both A and B together.

Mutually Exclusive Events

  • Mutually exclusive events are events that can never happen together.

    • There is no intersection.
A B

P(A \cap B) = 0

The Addition Rule

Addition Rule

If we have two events, A and B, the probability of A \text{ or } B is given by:

P(A \cup B) = P(A) + P(B) - P(A \cap B)

If A and B are mutually exclusive, this simplifies to: P(A \cup B) = P(A) + P(B)

Practice: Addition Rule

Example

A recruit is randomly selected. ZPD wants to know the probability this recruit works in either Sahara Square (20%) or Tundratown (60%). Which approach is appropriate?

  • A recruit cannot work in more than one district, so these are mutually exclusive events.

\begin{align*} P(\text{Sahara $\cup$ Tundra}) &= P(\text{Sahara}) + P(\text{Tundra}) - P(\text{Sahara $\cap$ Tundra}) \\ &= P(\text{Sahara}) + P(\text{Tundra}) \\ &= 0.20 + 0.60 \\ &= 0.80 \end{align*}

Practice: Addition Rule

Example

A recruit is randomly selected. 30% of recruits work Patrol, and 45% report getting 8+ hours of sleep. 15% of recruits both work Patrol and get 8+ hours of sleep. What’s the probability a recruit works Patrol or gets 8+ hours of sleep?

  • A recruit can work Patrol and get plenty of sleep (they are not mutually exclusive).

\begin{align*} P(\text{Patrol $\cup$ 8+ hrs}) &= P(\text{Patrol}) + P(\text{8+ hrs}) - P(\text{Patrol $\cap$ 8+ hrs}) \\ &= 0.30 + 0.45 - 0.15 \\ &= 0.60 \end{align*}

The Multiplication Rule (Independent Events)

Multiplication Rule

For independent events: P(A \cap B) = P(A) \times P(B)

  • If knowing B doesn’t change A, then the chance of both happening is just the product of their individual chances.

The Multiplication Rule (Dependent Events)

Multiplication Rule

For dependent events: P(A \cap B) = P(A) \times P(B \mid A)

  • We are accounting for the dependence between A and B with the conditional probability.

Practice: Multiplication Rule

Example

Suppose P(\text{passes exam}) = 0.85 and P(\text{reports 8+ hrs sleep}) = 0.40. Further, we know that P(\text{reports 8+ hrs sleep} \mid \text{passes exam}) = 0.40. What’s the probability a randomly chosen recruit passes the exam and reports 8+ hours of sleep?

\begin{align*} P(\text{passes exam $\cap$ 8+ hrs}) &= P(\text{passes exam}) \times P(\text{8+ hrs} \mid \text{passes exam}) \\ &= P(\text{passes exam}) \times P(\text{8+ hrs}) \\ &= 0.85 \times 0.40 \\ &= 0.34 \end{align*}

Practice: Multiplication Rule

Example

Suppose P(\text{Tundratown}) = 0.60, and among Tundratown recruits specifically, P(\text{passes exam} \mid \text{Tundratown}) = 0.10. What’s the probability a randomly chosen recruit is assigned to Tundratown and passes the exam on their first attempt?

\begin{align*} P(\text{Tundra} \cap \text{pass exam}) &= P(\text{Tundra}) \times P(\text{pass exam} \mid \text{Tundra}) \\ &= 0.60 \times 0.10 \\ &= 0.06 \end{align*}

Wrap Up

  • This lecture gave an overview of probability basics.

    1. Complement: P(A^c) = 1 - P(A)

    2. Conditional: P(A \mid B)

    3. Independence: P(A \mid B) = P(A)

    4. Addition: P(A \cup B) = P(A) + P(B) - P(A \cap B)

    5. Multiplication: P(A \text{ and } B) = P(A) \times P(B \mid A)

  • The next lecture covers probability distribution basics.