1. Home
  2. Explore
  3. Statistics
  4. Probability Fundamentals

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Probability Fundamentals

Probability, Conditioning, and Bayes’ Theorem

Probability foundations

Probability assigns a number between 000 and 111 to an event, representing how likely that event is to occur. An event is a set of outcomes from an experiment. For example, when rolling two dice, the event “the sum is four” consists of every dice outcome whose values add to four.

The set of all possible outcomes is the sample space. When every outcome is equally likely, the probability of an event can be calculated by counting:

P(E)=number of outcomes in Enumber of outcomes in the sample space.P(E)=\frac{\text{number of outcomes in }E}{\text{number of outcomes in the sample space}}.P(E)=number of outcomes in the sample spacenumber of outcomes in E​.

This counting method depends on two conditions: the outcomes in the sample space must be equally likely, and the sample space must include all possible outcomes of the experiment.

Core probability rules

The basic axioms of probability include the following:

  • Nonnegativity and bounds: For any event EEE, 0≤P(E)≤10 \leq P(E) \leq 10≤P(E)≤1.

  • Sample-space probability: The probability that some outcome in the entire sample space occurs is 111.

  • Additivity for disjoint events: If events EEE and FFF are mutually exclusive, then

    P(E∪F)=P(E)+P(F).P(E \cup F)=P(E)+P(F).P(E∪F)=P(E)+P(F).

Events are mutually exclusive when they have no outcomes in common. In set notation, this means that E∩FE \cap FE∩F is empty. For mutually exclusive events, adding their probabilities does not count any outcome more than once.

For example, if a sample space has 505050 equally likely outcomes, event EEE contains 777 outcomes, and event FFF contains 444 different outcomes, then:

P(E)=750,P(F)=450,P(E)=\frac{7}{50}, \qquad P(F)=\frac{4}{50},P(E)=507​,P(F)=504​,

and, because the events are mutually exclusive,

P(E∪F)=750+450=1150.P(E \cup F)=\frac{7}{50}+\frac{4}{50}=\frac{11}{50}.P(E∪F)=507​+504​=5011​.

The same additivity rule applies to any number of mutually exclusive events: their probabilities can be added to find the probability that at least one occurs.

Key distinction: The union E∪FE \cup FE∪F means “EEE or FFF occurs.” When EEE and FFF are disjoint, the probability of their union is the sum of their probabilities.


Complement events and a useful shortcut

The complement of an event EEE, written EcE^cEc, is the event that EEE does not occur. The event EEE and its complement are mutually exclusive, and together they cover the entire sample space: every outcome either belongs to EEE or does not.

By additivity and the fact that the sample space has probability 111,

P(E∪Ec)=P(E)+P(Ec)=1.P(E \cup E^c)=P(E)+P(E^c)=1.P(E∪Ec)=P(E)+P(Ec)=1.

Rearranging gives the complement rule:

P(Ec)=1−P(E).P(E^c)=1-P(E).P(Ec)=1−P(E).

Equivalently,

P(E)=1−P(Ec).P(E)=1-P(E^c).P(E)=1−P(Ec).

This rule is especially useful when it is easier to count or calculate the ways an event does not occur than the ways it does occur.

Example: the chance of knowing someone in a group

Suppose a campus has 17,00017{,}00017,000 people, a person knows 100100100 of them, and a group consists of 268268268 people selected uniformly from campus. The goal is to find the probability that the group contains at least one person the individual knows.

It is simpler to first calculate the probability that the group contains no friends.

  • The sample space consists of all groups of 268268268 people selected from 17,00017{,}00017,000:

    (17,000268).\binom{17{,}000}{268}.(26817,000​).
  • There are 17,000−100=16,90017{,}000-100=16{,}90017,000−100=16,900 people the individual does not know. The groups containing no friends number:

    (16,900268).\binom{16{,}900}{268}.(26816,900​).
  • Therefore,

    P(no friends)=(16,900268)(17,000268).P(\text{no friends})= \frac{\binom{16{,}900}{268}}{\binom{17{,}000}{268}}.P(no friends)=(26817,000​)(26816,900​)​.

In this example, that probability is about 0.200.200.20. The chance of meeting at least one friend is its complement, about 0.800.800.80:

P(at least one friend)=1−P(no friends).P(\text{at least one friend})=1-P(\text{no friends}).P(at least one friend)=1−P(no friends).

This illustrates a general strategy: before calculating an event directly, consider whether its complement is easier to analyze.


Conditional probability

A conditional probability is the probability of an event given that another event is known to have occurred. It describes how information changes the probability being considered.

The probability of EEE given FFF is written P(E∣F)P(E\mid F)P(E∣F) and defined by:

P(E∣F)=P(E∩F)P(F),P(F)>0.P(E\mid F)=\frac{P(E \cap F)}{P(F)}, \qquad P(F)>0.P(E∣F)=P(F)P(E∩F)​,P(F)>0.

Here:

  • FFF is the conditioning event: the information that is known to be true.

  • E∩FE \cap FE∩F is the event that both EEE and FFF occur.

  • The denominator P(F)P(F)P(F) restricts attention to outcomes in which FFF occurs.

Conditioning can be understood as entering a reduced sample space. Once FFF is known to have occurred, outcomes outside FFF are no longer possible for the calculation. The favorable outcomes are those in both EEE and FFF.

Example: two dice with a known first die

When two fair dice are rolled, there are 363636 equally likely ordered outcomes. The sum is four in exactly three of them:

(1,3),(2,2),(3,1).(1,3),\quad (2,2),\quad (3,1).(1,3),(2,2),(3,1).

Thus the unconditional probability that the sum is four is:

P(sum=4)=336=112.P(\text{sum}=4)=\frac{3}{36}=\frac{1}{12}.P(sum=4)=363​=121​.

Now suppose the first die is known to show 222. Only six outcomes remain possible, one for each value of the second die. Exactly one of these outcomes makes the sum four, namely (2,2)(2,2)(2,2). Therefore,

P(sum=4∣first die=2)=16.P(\text{sum}=4\mid \text{first die}=2)=\frac{1}{6}.P(sum=4∣first die=2)=61​.

The probability has increased because the new information has reduced the possible outcomes. If the first die is known to be 111 or 333, the conditional probability of a sum of four is also 16\frac{1}{6}61​: in each case, one of the six possible second-die values gives the desired sum.

Conditioning on events and intersections

The expression P(E∣F)P(E\mid F)P(E∣F) is not the same as P(E∩F)P(E \cap F)P(E∩F).

  • P(E∩F)P(E \cap F)P(E∩F) asks for the probability that both events occur, without assuming either one has occurred.

  • P(E∣F)P(E\mid F)P(E∣F) asks for the probability of EEE within the reduced world where FFF is known to have occurred.

Likewise, the order of a conditional probability matters. In general,

P(E∣F)≠P(F∣E).P(E\mid F)\neq P(F\mid E).P(E∣F)=P(F∣E).

The first conditions on FFF and asks about E;thesecondconditionsonE; the second conditions onE;thesecondconditionsonEandasksaboutand asks aboutandasksaboutF$. They refer to different reduced sample spaces.

Empirical estimates of probability

A probability can sometimes be estimated from observed data. If a large population of users is available, the fraction who perform an action can estimate the probability that a randomly selected user performs it.

For example, if 10.310.310.3 million out of 50.950.950.9 million users watch a particular movie, the observed fraction is approximately 0.200.200.20. This gives an estimate of the probability that a randomly selected user watches that movie.

Conditional probabilities can be estimated in the same way, but by restricting the count to a relevant subgroup. For example, the probability that a user watches one movie given that they watched another can be estimated as:

number of users who watched both moviesnumber of users who watched the conditioning movie.\frac{\text{number of users who watched both movies}} {\text{number of users who watched the conditioning movie}}.number of users who watched the conditioning movienumber of users who watched both movies​.

Observing one event may raise or lower the probability of another. The events do not need to be obviously related for a conditional probability to be defined; the observed data determine whether the conditional probability differs from the unconditional one.


The chain rule

Rearranging the definition of conditional probability gives the chain rule:

P(E∩F)=P(F)P(E∣F).P(E \cap F)=P(F)P(E\mid F).P(E∩F)=P(F)P(E∣F).

Since E∩FE \cap FE∩F and F∩EF \cap EF∩E are the same event, the rule can also be written:

P(E∩F)=P(E)P(F∣E).P(E \cap F)=P(E)P(F\mid E).P(E∩F)=P(E)P(F∣E).

The chain rule connects the probability that two events both occur to a probability for one event and a conditional probability for the other. It is important to distinguish the quantities:

  • The joint probability P(E∩F)P(E \cap F)P(E∩F) concerns both events happening.

  • The conditional probability P(E∣F)P(E\mid F)P(E∣F) concerns the chance of EEE after FFF is known.

  • The chain rule links them by multiplying P(F)P(F)P(F) by P(E∣F)P(E\mid F)P(E∣F).

Extending the chain rule

The chain rule can be applied repeatedly to several events:

P(E1∩E2∩E3)=P(E1) P(E2∣E1) P(E3∣E1∩E2).P(E_1 \cap E_2 \cap E_3) = P(E_1)\,P(E_2\mid E_1)\,P(E_3\mid E_1 \cap E_2).P(E1​∩E2​∩E3​)=P(E1​)P(E2​∣E1​)P(E3​∣E1​∩E2​).

For a sequence of events, each successive factor is the probability that the next event occurs given that all the preceding events have occurred. This gives a step-by-step decomposition of the probability that every event in the sequence occurs.

Example: a baby who may cry

Let PPP represent the event that a baby has pooped and TTT the event that the baby cries. Suppose:

P(P)=12,P(T∣P)=12.P(P)=\frac{1}{2}, \qquad P(T\mid P)=\frac{1}{2}.P(P)=21​,P(T∣P)=21​.

The probability that the baby has pooped and cries is:

P(P∩T)=P(P)P(T∣P)=12⋅12=14.P(P\cap T)=P(P)P(T\mid P) =\frac{1}{2}\cdot\frac{1}{2} =\frac{1}{4}.P(P∩T)=P(P)P(T∣P)=21​⋅21​=41​.

The two given probabilities have different meanings: one is the probability of pooping, while the other is the probability of crying among cases where pooping has occurred. Their product gives the probability of the two events occurring together.


The law of total probability

The law of total probability calculates the probability of an event by splitting the sample space into mutually exclusive cases that cover it.

Suppose FFF and FcF^cFc divide the sample space into two cases. Event EEE can occur either alongside FFF or alongside FcF^cFc. These two possibilities are mutually exclusive, so:

P(E)=P(E∩F)+P(E∩Fc).P(E)=P(E\cap F)+P(E\cap F^c).P(E)=P(E∩F)+P(E∩Fc).

Applying the chain rule to each term gives:

P(E)=P(E∣F)P(F)+P(E∣Fc)P(Fc).P(E)=P(E\mid F)P(F)+P(E\mid F^c)P(F^c).P(E)=P(E∣F)P(F)+P(E∣Fc)P(Fc).

This formula is useful when the probability of EEE is difficult to calculate directly, but its probability in each background case is known.

Example: crying with or without pooping

Suppose the probability that a baby has pooped is 12\frac{1}{2}21​, the probability of crying given a poop is 12\frac{1}{2}21​, and the probability of crying given no poop is 18\frac{1}{8}81​. The probability of crying is:

P(T)=P(T∣P)P(P)+P(T∣Pc)P(Pc)=12⋅12+18⋅12=516.\begin{aligned} P(T) &=P(T\mid P)P(P)+P(T\mid P^c)P(P^c)\\ &=\frac{1}{2}\cdot\frac{1}{2} +\frac{1}{8}\cdot\frac{1}{2}\\ &=\frac{5}{16}. \end{aligned}P(T)​=P(T∣P)P(P)+P(T∣Pc)P(Pc)=21​⋅21​+81​⋅21​=165​.​

The calculation includes both ways crying can occur: crying when there is a poop and crying when there is not. Knowing only P(T∣P)P(T\mid P)P(T∣P) is not enough to determine P(T)P(T)P(T), because the second case must also be accounted for.

General form using a partition

The two-case formula extends to any set of mutually exclusive events F1,…,FnF_1,\ldots,F_nF1​,…,Fn​ that cover the sample space. Such a collection is a partition. Then:

P(E)=∑i=1nP(E∣Fi)P(Fi).P(E)=\sum_{i=1}^{n}P(E\mid F_i)P(F_i).P(E)=∑i=1n​P(E∣Fi​)P(Fi​).

Each term describes the probability of EEE in one case, weighted by how likely that case is.

Example: bacterial survival and mutation

Suppose 10%10\%10% of bacteria have a mutation. A bacterium with the mutation has a 20%20\%20% chance of surviving, while a bacterium without the mutation has a 1%1\%1% chance of surviving. Let MMM denote mutation and SSS denote survival:

P(M)=0.10,P(S∣M)=0.20,P(S∣Mc)=0.01.P(M)=0.10,\qquad P(S\mid M)=0.20,\qquad P(S\mid M^c)=0.01.P(M)=0.10,P(S∣M)=0.20,P(S∣Mc)=0.01.

Since mutation and no mutation form a partition,

P(S)=P(S∣M)P(M)+P(S∣Mc)P(Mc).P(S)=P(S\mid M)P(M)+P(S\mid M^c)P(M^c).P(S)=P(S∣M)P(M)+P(S∣Mc)P(Mc).

With P(Mc)=1−0.10=0.90P(M^c)=1-0.10=0.90P(Mc)=1−0.10=0.90,

P(S)=0.20(0.10)+0.01(0.90)=0.029.P(S)=0.20(0.10)+0.01(0.90)=0.029.P(S)=0.20(0.10)+0.01(0.90)=0.029.

Thus, the probability that a randomly selected bacterium survives is 2.9%2.9\%2.9%. The total probability combines the survival chances in the two mutation cases rather than treating all bacteria as if they had the same survival rate.


Bayes’ theorem

Bayes’ theorem reverses a conditional probability. It is useful when the probability of an observation given a state of the world is known, but the desired probability is the state of the world given the observation.

The chain rule can be written in either of two ways:

P(E∩F)=P(E∣F)P(F)P(E\cap F)=P(E\mid F)P(F)P(E∩F)=P(E∣F)P(F)

and

P(E∩F)=P(F∣E)P(E).P(E\cap F)=P(F\mid E)P(E).P(E∩F)=P(F∣E)P(E).

Equating these expressions and rearranging gives Bayes’ theorem:

P(F∣E)=P(E∣F)P(F)P(E).P(F\mid E)=\frac{P(E\mid F)P(F)}{P(E)}.P(F∣E)=P(E)P(E∣F)P(F)​.

When EEE can occur under either FFF or FcF^cFc, the law of total probability expands the denominator:

P(F∣E)=P(E∣F)P(F)P(E∣F)P(F)+P(E∣Fc)P(Fc).P(F\mid E)= \frac{P(E\mid F)P(F)} {P(E\mid F)P(F)+P(E\mid F^c)P(F^c)}.P(F∣E)=P(E∣F)P(F)+P(E∣Fc)P(Fc)P(E∣F)P(F)​.

The formula has a practical interpretation:

  • Prior: P(F)P(F)P(F) is the probability of the state before the observation.

  • Likelihood: P(E∣F)P(E\mid F)P(E∣F) is the probability of seeing the observation if the state is true.

  • Evidence: P(E)P(E)P(E) is the overall probability of seeing the observation.

  • Posterior: P(F∣E)P(F\mid E)P(F∣E) is the updated probability of the state after observing the evidence.

The denominator normalizes the result by accounting for every way the evidence could have occurred.


Bayes’ theorem in applications

Spam email

Suppose an email filter wants to determine the probability that a message is spam given that it contains the word “dear.” Define:

  • FFF: the message is spam.

  • EEE: the message contains “dear.”

The desired probability is P(F∣E)P(F\mid E)P(F∣E). It may be easier to estimate the reverse conditional probability, P(E∣F)P(E\mid F)P(E∣F), by checking what fraction of known spam messages contain the word. Bayes’ theorem turns that quantity into the probability of spam given the observed word.

If 60%60\%60% of messages are spam, then:

P(F)=0.60,P(Fc)=0.40.P(F)=0.60,\qquad P(F^c)=0.40.P(F)=0.60,P(Fc)=0.40.

If 20%20\%20% of spam messages contain “dear,” and 5%5\%5% of non-spam messages contain it, then:

P(E∣F)=0.20,P(E∣Fc)=0.05.P(E\mid F)=0.20,\qquad P(E\mid F^c)=0.05.P(E∣F)=0.20,P(E∣Fc)=0.05.

Therefore,

P(F∣E)=0.20(0.60)0.20(0.60)+0.05(0.40)≈0.857.P(F\mid E) = \frac{0.20(0.60)} {0.20(0.60)+0.05(0.40)} \approx 0.857.P(F∣E)=0.20(0.60)+0.05(0.40)0.20(0.60)​≈0.857.

In this example, a message containing “dear” has an estimated spam probability of about 85.7%85.7\%85.7%. The calculation accounts for both spam and non-spam messages that could produce the observed word.

Medical testing and false positives

A positive test result does not by itself determine whether someone has a condition. The relevant probability is often the probability of having the condition given a positive result, which depends on:

  • How common the condition is before testing.

  • How often the test is positive for people who have the condition.

  • How often the test is positive for people who do not have it.

Suppose the prevalence of a disease is 0.5%0.5\%0.5%, the test correctly returns positive for 98%98\%98% of people who have the disease, and 1%1\%1% of people who do not have it nevertheless test positive. Let FFF mean that a person has the disease and EEE mean that the test is positive:

P(F)=0.005,P(E∣F)=0.98,P(E∣Fc)=0.01.P(F)=0.005,\qquad P(E\mid F)=0.98,\qquad P(E\mid F^c)=0.01.P(F)=0.005,P(E∣F)=0.98,P(E∣Fc)=0.01.

Bayes’ theorem gives:

P(F∣E)=P(E∣F)P(F)P(E∣F)P(F)+P(E∣Fc)P(Fc)=0.98(0.005)0.98(0.005)+0.01(0.995)≈0.33.\begin{aligned} P(F\mid E) &= \frac{P(E\mid F)P(F)} {P(E\mid F)P(F)+P(E\mid F^c)P(F^c)}\\ &= \frac{0.98(0.005)} {0.98(0.005)+0.01(0.995)}\\ &\approx 0.33. \end{aligned}P(F∣E)​=P(E∣F)P(F)+P(E∣Fc)P(Fc)P(E∣F)P(F)​=0.98(0.005)+0.01(0.995)0.98(0.005)​≈0.33.​

Despite the high test sensitivity, the probability of having the disease after a positive result is only about 33%33\%33% under these assumptions. The reason is that the disease is rare: many more people do not have it, so even a small false-positive rate can produce many positive results among people without the disease.

A population-count interpretation makes the effect clear. In a group of 1,0001{,}0001,000 people, an illness with prevalence 0.5%0.5\%0.5% would affect about 555 people. If all five test positive, but 1%1\%1% of the other 995995995 people also test positive, there will be about 101010 false positives. Among the roughly 151515 positive results, only about 555 are true positives, giving a proportion close to one-third.

The same reasoning explains why the probability after a negative test can differ substantially from the probability after a positive test. Each result must be analyzed using the prior prevalence and the test’s error rates.

Inferring whether someone knows a concept

Bayes’ theorem can also infer an unobserved state, such as whether a student understands a concept, from an observable result, such as whether the student answers a multiple-choice question correctly.

Let KKK mean that the student knows the concept and CCC mean that the answer is correct. If 75%75\%75% of students know the concept, then:

P(K)=0.75,P(Kc)=0.25.P(K)=0.75,\qquad P(K^c)=0.25.P(K)=0.75,P(Kc)=0.25.

If students who do not know the concept have a one-in-four chance of guessing correctly, then:

P(C∣Kc)=0.25.P(C\mid K^c)=0.25.P(C∣Kc)=0.25.

If qqq is the probability that a student who knows the concept answers correctly, then:

P(K∣C)=P(C∣K)P(K)P(C∣K)P(K)+P(C∣Kc)P(Kc)=0.75q0.75q+0.25(0.25).P(K\mid C) = \frac{P(C\mid K)P(K)} {P(C\mid K)P(K)+P(C\mid K^c)P(K^c)} = \frac{0.75q}{0.75q+0.25(0.25)}.P(K∣C)=P(C∣K)P(K)+P(C∣Kc)P(Kc)P(C∣K)P(K)​=0.75q+0.25(0.25)0.75q​.

A numerical answer requires the value of qqq. The key point is that observing a correct answer does not prove understanding: the answer could be correct because of knowledge or because of guessing. Bayes’ theorem combines both possibilities with their prior probabilities.


Choosing the right probability expression

Probability notation distinguishes three questions that are easy to confuse:

  • Intersection: P(E∩F)P(E\cap F)P(E∩F) asks for the probability that both EEE and FFF occur.

  • Union: P(E∪F)P(E\cup F)P(E∪F) asks for the probability that EEE or FFF occurs, including the possibility that both occur. If they are mutually exclusive, their probabilities add directly.

  • Conditional probability: P(E∣F)P(E\mid F)P(E∣F) asks for the probability of EEE when FFF is known to have occurred.

The chain rule connects intersection and conditional probability, while the law of total probability combines mutually exclusive cases, and Bayes’ theorem reverses the direction of conditioning. Recognizing which question is being asked is essential before selecting a formula.


Conditioning and zero-probability events

The ordinary definition of conditional probability requires P(F)>0P(F)>0P(F)>0, because P(F)P(F)P(F) appears in the denominator. In a finite setting, an event with probability zero cannot occur, so observing it would be inconsistent with the model. In more advanced settings, such as continuous probability models, an individual outcome can have probability zero without being impossible; conditioning on zero-probability events then requires additional mathematical tools.


Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent