Probability Fundamentals
Probability, Conditioning, and Bayes’ Theorem
Probability foundations
Probability assigns a number between 0 and 1 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:
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 E, 0≤P(E)≤1.
Sample-space probability: The probability that some outcome in the entire sample space occurs is 1.
Additivity for disjoint events: If events E and F are mutually exclusive, then
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∩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 50 equally likely outcomes, event E contains 7 outcomes, and event F contains 4 different outcomes, then:
and, because the events are mutually exclusive,
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∪F means “E or F occurs.” When E and F are disjoint, the probability of their union is the sum of their probabilities.
Complement events and a useful shortcut
The complement of an event E, written Ec, is the event that E does not occur. The event E and its complement are mutually exclusive, and together they cover the entire sample space: every outcome either belongs to E or does not.
By additivity and the fact that the sample space has probability 1,
Rearranging gives the complement rule:
Equivalently,
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,000 people, a person knows 100 of them, and a group consists of 268 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 268 people selected from 17,000:
(26817,000).There are 17,000−100=16,900 people the individual does not know. The groups containing no friends number:
(26816,900).Therefore,
P(no friends)=(26817,000)(26816,900).
In this example, that probability is about 0.20. The chance of meeting at least one friend is its complement, about 0.80:
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 E given F is written P(E∣F) and defined by:
Here:
F is the conditioning event: the information that is known to be true.
E∩F is the event that both E and F occur.
The denominator P(F) restricts attention to outcomes in which F occurs.
Conditioning can be understood as entering a reduced sample space. Once F is known to have occurred, outcomes outside F are no longer possible for the calculation. The favorable outcomes are those in both E and F.
Example: two dice with a known first die
When two fair dice are rolled, there are 36 equally likely ordered outcomes. The sum is four in exactly three of them:
Thus the unconditional probability that the sum is four is:
Now suppose the first die is known to show 2. 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). Therefore,
The probability has increased because the new information has reduced the possible outcomes. If the first die is known to be 1 or 3, the conditional probability of a sum of four is also 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) is not the same as P(E∩F).
P(E∩F) asks for the probability that both events occur, without assuming either one has occurred.
P(E∣F) asks for the probability of E within the reduced world where F is known to have occurred.
Likewise, the order of a conditional probability matters. In general,
The first conditions on F and asks about E;thesecondconditionsonEandasksaboutF$. 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.3 million out of 50.9 million users watch a particular movie, the observed fraction is approximately 0.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:
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:
Since E∩F and F∩E are the same event, the rule can also be written:
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) concerns both events happening.
The conditional probability P(E∣F) concerns the chance of E after F is known.
The chain rule links them by multiplying P(F) by P(E∣F).
Extending the chain rule
The chain rule can be applied repeatedly to several events:
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 P represent the event that a baby has pooped and T the event that the baby cries. Suppose:
The probability that the baby has pooped and cries is:
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 F and Fc divide the sample space into two cases. Event E can occur either alongside F or alongside Fc. These two possibilities are mutually exclusive, so:
Applying the chain rule to each term gives:
This formula is useful when the probability of E 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 21, the probability of crying given a poop is 21, and the probability of crying given no poop is 81. The probability of crying is:
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) is not enough to determine 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,…,Fn that cover the sample space. Such a collection is a partition. Then:
Each term describes the probability of E in one case, weighted by how likely that case is.
Example: bacterial survival and mutation
Suppose 10% of bacteria have a mutation. A bacterium with the mutation has a 20% chance of surviving, while a bacterium without the mutation has a 1% chance of surviving. Let M denote mutation and S denote survival:
Since mutation and no mutation form a partition,
With P(Mc)=1−0.10=0.90,
Thus, the probability that a randomly selected bacterium survives is 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:
and
Equating these expressions and rearranging gives Bayes’ theorem:
When E can occur under either F or Fc, the law of total probability expands the denominator:
The formula has a practical interpretation:
Prior: P(F) is the probability of the state before the observation.
Likelihood: P(E∣F) is the probability of seeing the observation if the state is true.
Evidence: P(E) is the overall probability of seeing the observation.
Posterior: 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:
F: the message is spam.
E: the message contains “dear.”
The desired probability is P(F∣E). It may be easier to estimate the reverse conditional probability, 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% of messages are spam, then:
If 20% of spam messages contain “dear,” and 5% of non-spam messages contain it, then:
Therefore,
In this example, a message containing “dear” has an estimated spam probability of about 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%, the test correctly returns positive for 98% of people who have the disease, and 1% of people who do not have it nevertheless test positive. Let F mean that a person has the disease and E mean that the test is positive:
Bayes’ theorem gives:
Despite the high test sensitivity, the probability of having the disease after a positive result is only about 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,000 people, an illness with prevalence 0.5% would affect about 5 people. If all five test positive, but 1% of the other 995 people also test positive, there will be about 10 false positives. Among the roughly 15 positive results, only about 5 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 K mean that the student knows the concept and C mean that the answer is correct. If 75% of students know the concept, then:
If students who do not know the concept have a one-in-four chance of guessing correctly, then:
If q is the probability that a student who knows the concept answers correctly, then:
A numerical answer requires the value of q. 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) asks for the probability that both E and F occur.
Union: P(E∪F) asks for the probability that E or F occurs, including the possibility that both occur. If they are mutually exclusive, their probabilities add directly.
Conditional probability: P(E∣F) asks for the probability of E when F 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)>0, because 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.