Probability for Data Science
Probability and Combinatorics: Measuring Uncertainty and Counting Possibilities
1. What Probability Measures
Everyday decisions often involve uncertainty. A business might weigh the chance that a research investment succeeds, while an individual might wonder whether a particular outcome is likely. Probability gives a numerical way to describe how likely an event is to happen.
An event is a specific outcome or a group of outcomes. For example, when a coin is tossed, “getting heads” is one event and “getting tails” is another. When a six-sided die is rolled, “getting a four” is an event, as is “getting a number divisible by three.”
The possible outcomes of an experiment make up its sample space. For a coin toss, the sample space is {heads,tails}. For a standard six-sided die, it is {1,2,3,4,5,6}.
A favorable outcome is an outcome that satisfies the event being considered. For example, if the event is rolling an even number, the favorable outcomes are 2, 4, and 6.
When all outcomes are equally likely, probability is calculated by dividing the number of favorable outcomes by the total number of possible outcomes:
P(A)=number of outcomes in the sample spacenumber of favorable outcomesHere, P(A) means “the probability of event A.”
Probability values
Probability is commonly written as a real number from 0 to 1, inclusive.
- A probability of 0 means the event cannot occur.
- A probability of 1 means the event is certain to occur.
- A value between 0 and 1 represents some degree of likelihood. Higher values indicate greater likelihood.
For instance, a probability of 0.2 is equivalent to 20% or 51. A probability of 0.5 is equivalent to 21.
A probability describes likelihood, not a promise about what will happen on one particular trial. An event with probability 0.5 is not guaranteed to happen every second time an experiment is run. It means that, under the model being used, the event is expected to occur about half the time over many repeated trials.
Simple probability examples
For a fair coin, heads is one favorable outcome among two equally likely possibilities:
P(heads)=21=0.5For a fair six-sided die, rolling a four is one favorable outcome among six:
P(rolling a 4)=61≈0.167Rolling a number divisible by three has two favorable outcomes, 3 and 6, among the same six possibilities:
P(a number divisible by 3)=62=31≈0.33The key idea is that probability depends both on how many outcomes satisfy the event and on how many outcomes are possible overall.
When events happen together
If two independent events both need to occur, their probabilities are multiplied. Independence means that the outcome of one event does not change the probability of the other.
For example, if a card is drawn from a standard deck, the event “draw an ace” and the event “draw a spade” are independent when considered in the usual probability model. The probability of drawing the ace of spades can therefore be found by multiplying the probability of an ace by the probability of a spade:
P(ace of spades)=P(ace)P(spade)A later probability model may need to check whether events really are independent; multiplication should not be used automatically when one event affects the other.
When outcomes are equally likely, probability is the favorable count divided by the total count. For events that must happen together, multiplication applies when the events are independent.
Think About It: Why is the chance of rolling a number divisible by three greater than the chance of rolling a four, even though both are events involving the same die?
2. Theoretical Probability, Experiments, and Frequency
A theoretical probability is calculated from a model of the possible outcomes. For example, the theoretical probability of heads for a fair coin is 21.
Sometimes the true probability is difficult to calculate, or the situation is too complicated to model completely. In that case, an experiment can provide an estimate.
An experiment is a process in which an uncertain event is observed. Each individual performance of the process is a trial. Tossing a coin 20 times is one experiment containing 20 trials.
An experimental probability is calculated from the results observed in those trials:
Experimental probability=total number of trialsnumber of successful trialsSuppose a person finds a queue at a shop on 8 out of 10 visits. The experimental probability of finding a queue, based on those visits, is:
108=0.8The experimental probability is useful even if calculating an exact theoretical probability would require considering many factors. The estimate may not equal the theoretical probability, particularly after only a small number of trials. With more observations, it can serve as a more informative approximation.
Frequency is the number of times a particular outcome occurs in a set of trials or in a list of possible cases. If a sum of 8 appears in five rows of a two-dice outcome table, its frequency is 5.
Think About It: Why might an observed probability based on a small number of trials differ from the theoretical probability?
3. Expected Values: Long-Run Averages, Not Guarantees
An expected value summarizes the result an experiment is expected to produce over repeated trials. It is not necessarily an outcome that can occur on one individual trial.
Expected number of times an event occurs
For a categorical event—an event described by a category such as a suit of cards—the expected number of occurrences is the event’s theoretical probability multiplied by the number of trials:
E(number of occurrences)=P(A)nHere, P(A) is the probability of the event and n is the number of trials.
For example, a card is drawn from a standard deck, recorded, returned to the deck, and the deck is shuffled before the next draw. The probability of drawing a spade on each draw is 41. Over 20 draws, the expected number of spades is:
41×20=5This means that five spades is the long-run expectation. It does not guarantee exactly five spades in a particular set of 20 draws. The actual count could be smaller or larger.
Returning the card and shuffling matters because it restores the original conditions for the next draw. Each draw then has the same modeled probability of producing a spade.
Expected value for numerical outcomes
When outcomes are numbers, the expected value is found by multiplying each possible value by its probability and adding the products:
E(X)=i∑xiP(xi)In this formula, xi is a possible numerical outcome and P(xi) is its probability.
Consider an archery target with three scoring regions. The outer region is worth 10 points and has probability 0.5; the next region is worth 20 points and has probability 0.4; the center is worth 100 points and has probability 0.1. The expected score per shot is:
E(X)=(10)(0.5)+(20)(0.4)+(100)(0.1) E(X)=5+8+10=23A single shot cannot score 23 points. The value 23 is a weighted average: it combines each score with how likely that score is. Across many shots under the same conditions, the average score per shot would be expected to move toward 23.
Expected values are useful for making predictions from probability models and past data. They support planning even when the exact outcome is uncertain. In situations such as weather forecasting, a range of likely outcomes may be more useful than a promise of one exact value.
Think About It: In the archery example, why does an expected score of 23 still convey useful information, even though no single shot can score 23?
4. Probability Frequency Distributions
A probability frequency distribution records the probability of every possible outcome of an experiment. It can be displayed in a table or a graph. Constructing one makes it possible to compare the likelihood of different outcomes rather than considering only one event at a time.
A useful example is rolling two fair six-sided dice and adding the numbers. There are six possibilities for the first die and six for the second, so there are:
6×6=36equally likely ordered outcomes. A table with six rows and six columns can show the sum for each pair of rolls.
The sum 7 occurs in six of the 36 cases, so:
P(sum of 7)=366=61For each possible sum, its frequency is the number of times it appears in the 36 cases. Dividing each frequency by 36 gives the probability of that sum.
| Sum | Frequency | Probability |
|---|---|---|
| 2 | 1 | 361 |
| 3 | 2 | 362 |
| 4 | 3 | 363 |
| 5 | 4 | 364 |
| 6 | 5 | 365 |
| 7 | 6 | 366 |
| 8 | 5 | 365 |
| 9 | 4 | 364 |
| 10 | 3 | 363 |
| 11 | 2 | 362 |
| 12 | 1 | 361 |
The probabilities in the distribution sum to 1, because the listed sums cover every possible result:
361+2+3+4+5+6+5+4+3+2+1=1The distribution shows that 7 is the most likely individual sum. It does not show that rolling a 7 is certain or even more likely than not: its probability is only 61.
For this two-dice example, the expected sum is also 7. The distribution helps explain the relationship: outcomes near 7 have higher probabilities than outcomes near the ends. A distribution is therefore more informative than the expected value alone. The expected value gives a summary; the distribution shows how probability is spread across outcomes.
When predictions involve ranges, a probability distribution can help identify which range contains the most probability. In this symmetric dice example, ranges centered around 7 tend to include the most likely outcomes. That pattern comes from this particular distribution; the expected value alone does not guarantee that the most probable range in every situation will be centered on it.
Think About It: What does the two-dice distribution reveal that the expected value of 7 does not?
5. Complements and the Total Probability of a Sample Space
The complement of an event is the event that it does not occur. If event A is “rolling an even number,” its complement is “not rolling an even number,” which is the same as rolling an odd number.
The complement of A is commonly written A′. The complement of the complement is the original event:
(A′)′=AThe probabilities of an event and its complement add to 1, because together they account for every possibility:
P(A)+P(A′)=1Rearranging gives a useful rule:
P(A′)=1−P(A)This rule can save work when an event is easier to describe by what it excludes. For example, the event “rolling a 1, 2, 4, 5, or 6” is the complement of “rolling a 3.” Since a 3 has probability 61:
P(not rolling a 3)=1−61=65The same answer follows by adding the probabilities of the five favorable die outcomes.
The probabilities of all outcomes in a complete sample space add to 1. A fair coin must land heads or tails, so:
P(heads)+P(tails)=1If a collection of outcomes has a total probability less than 1, then it does not account for the entire sample space. If a collection of events is treated as though it covers all possibilities but its probabilities add to more than 1, the events may overlap. In that case, some outcomes have been counted more than once. Probabilities cannot represent a total likelihood greater than certainty.
Complements are especially useful when an event contains many outcomes but its opposite contains few. Instead of adding the probabilities of many outcomes, the calculation may require only one subtraction.
Think About It: Why is it easier to calculate the probability of rolling anything except a three by first calculating the probability of rolling a three?
6. Combinatorics: Counting Possible Arrangements and Selections
Combinatorics is the study of counting ways to select or arrange elements from a finite set. It is valuable in probability because probabilities often depend on counting favorable outcomes and total outcomes.
The right counting method depends on three questions:
- Is order important?
- Are all elements being used, or only some of them?
- Can an element be used more than once?
The main counting ideas are permutations, variations, and combinations.
Factorials: A building block for counting
For a positive integer n, the factorial n! is the product of the positive integers from 1 through n:
n!=1×2×3×⋯×nFor example:
3!=1×2×3=6By definition, 0!=1. Negative integers do not have factorials in the ordinary factorial system used here.
A useful property is:
n!=n(n−1)!For example:
6!=6×5!Factorials make it possible to express products compactly and to simplify counting formulas. For instance:
4!7!=1×2×3×41×2×3×4×5×6×7=5×6×7The common factors cancel, leaving only the factors from 5 through 7.
Permutations: Arranging every element
A permutation is an arrangement of elements in which order matters. When all n distinct elements are arranged, the number of possible arrangements is:
P(n)=n!For three distinct people taking the three places on a podium, there are three choices for first place, two remaining choices for second, and one remaining choice for third:
3×2×1=3!=6The same counting logic applies to arranging objects, letters, or other distinct elements. Once a position is filled, one fewer element remains for the next position.
Variations: Choosing and arranging some elements
A variation counts ways to select and arrange p elements from a set of n elements. Because positions or roles are involved, order matters.
For arrangements without repetition, an element cannot be used more than once. There are n choices for the first position, n−1 for the next, and so on until p positions are filled:
V(n,p)=(n−p)!n!For example, choosing four runners from a team of five and assigning them to four relay positions gives:
V(5,4)=(5−4)!5!=1!5!=120The calculation can also be seen directly:
5×4×3×2=120There are five possible starters, then four possible second runners, followed by three and two choices.
For variations with repetition, each position can use any of the n elements, even if the same one was used in an earlier position. With p positions, the count is:
V(n,p)=npFor a two-letter code made from the letters A, B, and C, repetition is allowed. Each of the two positions has three choices:
V(3,2)=32=9If the code can use any of the 26 letters of the alphabet, the number of two-letter codes is:
262=676Combinations: Selecting without regard to order
A combination counts selections where order does not matter. Choosing Alex, Sarah, and Dave for a group is the same selection regardless of the order in which their names are listed.
For selecting p distinct elements from n without repetition, the number of combinations is:
C(n,p)=(pn)=p!(n−p)!n!The denominator accounts for the fact that the same group can be arranged in p! different orders. Thus, combinations can be found by counting ordered selections and dividing by the number of orderings within each selection:
C(n,p)=p!V(n,p)For example, selecting three people from a group of ten gives:
C(10,3)=3!7!10!=120Counting ordered selections instead would give:
V(10,3)=10×9×8=720Each group of three is counted in 3!=6 orders, so:
6720=120This adjustment is appropriate because the group’s membership matters, but the order of selection does not.
Think About It: For a relay team, why does assigning runners to legs require a different count from merely choosing which runners will be on the team?
7. Repetition and Symmetry in Combinations
For combinations with repetition, an element may be selected more than once, but order still does not matter. The number of ways to select p elements from n types is:
C(n,p)=(pn+p−1)=p!(n−1)!(n+p−1)!For example, selecting two desserts from seven types when both selected desserts may be the same gives:
C(7,2)=2!(7−1)!(7+2−1)!=2!6!8!=28This count includes selections such as two of the same dessert as well as selections of two different desserts. A selection of two different types is counted only once, no matter which one is named first.
Combinations without repetition have a useful symmetry. Selecting p elements from n is equivalent to deciding which n−p elements to leave out:
C(n,p)=C(n,n−p)For example, choosing three employees from ten is equivalent to choosing the seven employees who will not be selected:
C(10,3)=C(10,7)=120This symmetry can simplify a calculation. When p is larger than half of n, it may be easier to calculate with the smaller number n−p.
Think About It: Why does choosing all but one item from a set create the same number of possible groups as choosing which one item to leave out?
8. The Multiplication Principle: Combining Separate Choices
When a task consists of several separate choices, the total number of possible results is the product of the number of choices at each stage, provided each choice can be paired with the options at the other stages.
A lunch menu with three sandwich options, two side options, and two drink options has:
3×2×2=12possible menus. Each sandwich can be paired with either side, and each sandwich-and-side pairing can be completed with either drink.
The same reasoning applies to constructing advertisements. If an advertisement can have one of three headings, one of five thumbnails, one of three descriptions, and one of two buttons, then the number of possible advertisements is:
3×5×3×2=90The multiplication principle is useful not only for counting. It also helps estimate workload: creating or testing every possible design requires a number of trials equal to the total number of combinations.
Applying the principle to a lottery
Suppose a lottery requires selecting five numbers from 1 through 69 and one additional Powerball number from 1 through 26.
The five main numbers are an unordered selection with no repetition, so their possible sets are counted with combinations:
C(69,5)=5!64!69!=11,238,513The additional Powerball number has 26 possibilities. Each set of five main numbers can be paired with any Powerball number, so the total number of ticket outcomes is:
11,238,513×26=292,201,338A single distinct ticket therefore has a jackpot probability of:
292,201,3381That probability is extremely small, even though the calculation follows the same favorable-outcomes-over-total-outcomes principle used for a die or coin.
If m distinct tickets are purchased, then there are m favorable ticket outcomes for winning, assuming the tickets do not duplicate one another. The probability is:
292,201,338mThe chance increases with the number of distinct tickets, but remains small unless a substantial fraction of all possible outcomes is covered.
9. Choosing the Correct Counting Method
The same situation can produce different counts depending on whether order matters and whether repetition is allowed.
| Situation | Order matters? | Repetition allowed? | Method |
|---|---|---|---|
| Arranging every element in a set | Yes | No | Permutation |
| Choosing and arranging some elements | Yes | No | Variation without repetition |
| Filling ordered positions when values can repeat | Yes | Yes | Variation with repetition |
| Selecting some elements, with no repeats | No | No | Combination |
| Selecting some elements, with repeats allowed | No | Yes | Combination with repetition |
For example, choosing four members from a team and assigning them to four relay legs involves variations: the same four people in a different running order form a different arrangement. Choosing four members simply to be on the team involves combinations: changing the order in which their names are written does not create a new team.
A practical way to decide is to ask: Would switching the positions or names change the result being counted? If it would, order matters. If not, the task is an unordered selection.
For arrangements without repetition, permutations, variations, and combinations are connected:
P(n)=n! V(n,p)=(n−p)!n! C(n,p)=p!(n−p)!n!In particular, a combination is an ordered variation divided by the number of possible orders within each group:
C(n,p)=p!V(n,p)With repetition, the corresponding formulas for variations and combinations change:
V(n,p)=np C(n,p)=p!(n−1)!(n+p−1)!These formulas are tools for counting outcomes. Selecting the right formula depends on the structure of the situation, not on which formula looks most familiar.
10. A Practical Example: Counting Meal Deals
Suppose a restaurant offers 26 pizzas, 4 drinks, and 7 desserts.
A one-person meal deal includes one pizza, one drink, and one dessert. Each component is a separate choice, so the number of possible meals is:
26×4×7=728A family deal includes two pizzas, one small drink, one large drink, and two desserts. Assume that the two pizzas must be different, the two drink choices can be the same flavor, and the two desserts may be the same type.
Counting the family deal
The two pizzas form an unordered selection without repetition:
C(26,2)=2!24!26!=325The small drink and large drink are separate positions. Each has four drink choices, and the same flavor may be chosen for both sizes:
4×4=16The two desserts form an unordered selection with repetition allowed:
C(7,2)=2!(7−1)!(7+2−1)!=28These choices combine independently, so the total number of family-deal menus is:
325×16×28=145,600Counting the Double Delight deal
Suppose this deal includes two different pizzas, two large drinks that must be different and are assigned to particular people, and two desserts that may repeat.
The pizza choices are still:
C(26,2)=325Because the two drinks must differ and the assignment to people matters, the drink choices are variations without repetition:
V(4,2)=(4−2)!4!=4×3=12The dessert choices are still:
C(7,2)=28The total number of distinct Double Delight orders is:
325×12×28=109,200The Family Deal has 36,400 more possible menus:
145,600−109,200=36,400The difference comes from the drink rule. In the Family Deal, the two drink positions can each be filled independently, giving 16 possibilities. In the Double Delight, the drinks must be different and assigned to people, giving 12 possibilities. Small changes in rules—whether repetition is allowed or order matters—can substantially change the total count.
Think About It: In the meal-deal example, why are the two desserts counted as combinations rather than variations?
Comprehensive Review
Probability quantifies the likelihood of events. For equally likely outcomes, it is found by dividing the favorable count by the size of the sample space. A theoretical probability comes from a model; an experimental probability comes from observed trials. Expected values summarize long-run outcomes, while probability frequency distributions show how likelihood is distributed across all possible outcomes.
An event and its complement cover the full sample space, so their probabilities add to 1. Expected values and distributions describe uncertainty in different ways: the expected value gives a central weighted summary, while a distribution shows the probabilities of individual outcomes.
Combinatorics supplies the counting methods needed to build many probability calculations. Permutations arrange every element, variations select and arrange some elements, and combinations select elements without regard to order. Repetition changes the counting formulas. When a task consists of multiple separate choices, the multiplication principle combines the counts for each choice.
The most reliable way to solve a counting problem is to identify what counts as a distinct outcome, determine whether order matters, check whether repetition is allowed, and then choose the matching counting method.

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