All combinations of 4 items taken 2 at a time:
1. A, B
2. A, C
3. A, D
4. B, C
5. B, D
6. C, D
Lecture 7 - Combinations
2025-07-10
The art and science of systematic enumeration
Learning Objectives
By the end of this lecture, you will be able to:
Combination
A selection of objects where order does NOT matter
Committee Selection:
ABC, BAC, CAB → Same committee!
Race Results:
ABC, BAC, CAB → Different outcomes!
Note
Key Point: Order doesn’t matter for combinations
All combinations of 4 items taken 2 at a time:
1. A, B
2. A, C
3. A, D
4. B, C
5. B, D
6. C, D
Key Formula
\(C(n,r)\) or \(\binom{n}{r}\): Number of ways to choose \(r\) objects from \(n\) distinct objects (order doesn’t matter)
\[C(n,r) = \binom{n}{r} = \frac{n!}{r!(n-r)!}\]
\(\binom{n}{r}\) reads “\(n\) choose \(r\)”
How many ways can we choose 3 people from a group of 8 for a committee?
Solution. \(C(8,3) = \frac{8!}{3!(8-3)!} = \frac{8!}{3! \times 5!} = \frac{8 \times 7 \times 6}{3 \times 2 \times 1} = 56\)
Relationship
and,
Plugging (2) into (1) and multiplying by \(r\) which represents the number of arrangements we get :
\(P(n,r) = C(n,r) \times r!\) (multiply by arrangements)
Why? For each combination of \(r\) objects, there are \(r!\) ways to arrange them
Similarly,
\(C(n,r) = P(n,r)/ r!\) (divide out arrangements)
Why? diving by \(r\) removes the arrangements from our formula and leaves us with the number of selection possible from \(n\) objects.
Note
Permutations = Combinations × Arrangements
Combinations answer: “How many ways can I choose?”
Arrangements answer: “How many ways can I order what I chose?”*
Permutations answer: “How many ways can I choose AND order?”
\(\text{Choose} \times \text{Arrange} = \text{Choose and Arrange}\)
\[ \underbrace{\binom{n}{r}}{\substack{\text{choose which}\\r\text{ elements}}} \;\times\; \underbrace{r!}{\substack{\text{order those}\\r\text{ elements}}} \;=\; \frac{n!}{r!(n-r)!}\;\times\;r! \;=\; \frac{n!}{(n-r)!} \;=\; P(n,r). \]
Thus,
\(C(n,r)×r!= P(n,r)\)
Select 3 people from a group of 5 for different purposes.
For a ranked competition (order matters):
1st place, 2nd place, 3rd place matter
Use permutations: \(P(5,3) = \frac{5!}{(5-3)!} = \frac{5!}{2!} = \frac{120}{2} = 60\) ways
For a committee (order doesn’t matter):
Just need 3 people, no specific roles
Use combinations: \(C(5,3) = \frac{5!}{3!(5-3)!} = \frac{5!}{3! \cdot 2!} = \frac{120}{6 \cdot 2} = 10\) ways
Verifying the relationship:
\(P(5,3)=C(5,3)×3!\)
\(60=10 \times 6 \checkmark\)
For each of the 10 combinations, there are \(3! = 6\) ways to arrange them, giving us the 60 permutations.
How to Decide
Ask yourself: Does order matter?
Order matters → Use Permutations
Order doesn’t matter → Use Combinations
Note
✅ \(P(n,r)\) = counts both selection & arrangement → grows faster
✅ \(C(n,r)\) = counts only selection → grows slower
✅ The difference comes from \(r!\), which is big even for modest \(r\).
From a class of 20 students:
Solution.
Properties
\(\binom{8}{3} = \binom{8}{5} = 56\) ✓
Pascal’s Triangle
1 ← (x + y)⁰
1 1 ← (x + y)¹
1 2 1 ← (x + y)²
1 3 3 1 ← (x + y)³
1 4 6 4 1 ← (x + y)⁴
1 5 10 10 5 1 ← (x + y)⁵
Each number equals \(\binom{n}{r}\) where \(n\) is the row number and \(r\) is the position from the left (starting at 0).
Note
Pattern: Each number is the sum of the two numbers above it.
Formula: \(\binom{n}{r} = \binom{n-1}{r-1} + \binom{n-1}{r}\)
Example: \(\binom{4}{2} = 6\) (row 4, position 2)
Row 3: 1 3 3 1
↙ ↘ ↙ ↘ ↙ ↘ ↙ ↘
Row 4: 1 4 6 4 1
Key Formula
\[(x + y)^n = \sum_{r=0}^{n} \binom{n}{r} x^{n-r} y^r\]
This formula tells us how to expand \((x + y)\) raised to any positive integer power \(n\).
EXAMPLE
\((x + y)^3 = \binom{3}{0}x^3 + \binom{3}{1}x^2y + \binom{3}{2}xy^2 + \binom{3}{3}y^3\)
\(= x^3 + 3x^2y + 3xy^2 + y^3\)
Key Insights
The General Pattern
Powers decrease and increase systematically:
Powers of \(x\): \(n, n-1, n-2, \ldots, 1, 0\)
Powers of \(y\): \(0, 1, 2, \ldots, n-1, n\)
Sum of powers in each term: always equals \(n\)
Coefficients come from Pascal’s Triangle:
Coefficient of \(x^{n-r}y^r\) is \(\binom{n}{r}\)
Read directly from row \(n\) of Pascal’s Triangle
Symmetry in coefficients:
First and last terms have coefficient 1 Coefficients are symmetric: \(\binom{n}{0} = \binom{n}{n}\), \(\binom{n}{1} = \binom{n}{n-1}\), etc.
A committee of 4 people is chosen from 7 women and 5 men. What’s the probability that exactly 2 are women?
Total ways to choose 4 from 12: \(\binom{12}{4} = 495\)
Ways to choose 2 women from 7: \(\binom{7}{2} = 21\)
Ways to choose 2 men from 5: \(\binom{5}{2} = 10\)
Solution. Favorable outcomes: \(\binom{7}{2} \times \binom{5}{2} = 21 \times 10 = 210\)
Probability: \(\frac{210}{495} = \frac{14}{33}\)
A standard deck has 52 cards. What’s the probability that a 5-card hand contains:
Solution.
Total number of 5-card hands \[\binom{52}{5} = \frac{52\cdot51\cdot50\cdot49\cdot48}{5\cdot4\cdot3\cdot2\cdot1} = \frac{311{,}875{,}200}{120} \\ = 2{,}598{,}960 \]
Ways to choose exactly 3 aces \[ \binom{4}{3} = \frac{4\cdot3\cdot2}{3\cdot2\cdot1} = \frac{24}{6} = 4 \]
Ways to choose the other 2 cards from the 48 non-aces \[ \binom{48}{2} = \frac{48\cdot47}{2\cdot1} = \frac{2{,}256}{2} = 1{,}128 \]
Total “successful” hands \(4 \times 1{,}128 = 4{,}512\)
Probability \[P = \frac{\text{successful}}{\text{total}} = \frac{4{,}512}{2{,}598{,}960} \approx 0.001735 \;=\;0.1735\%\]
A standard deck has 52 cards. What’s the probability that a 5-card hand contains:
Solution.
Ways to pick 5 cards with zero aces All 5 come from the 48 non-aces: \[\binom{48}{5} = \frac{48\cdot47\cdot46\cdot45\cdot44}{5\cdot4\cdot3\cdot2\cdot1} = \frac{205{,}476{,}480}{120} = 1{,}712{,}304\]
Probability of no aces \[ P(\text{no aces}) = \frac{\binom{48}{5}}{\binom{52}{5}} = \frac{1{,}712{,}304}{2{,}598{,}960} \approx 0.659 \quad \text{or} 65.9 \% \]
Subtract from 1 \[P(\text{at least one ace}) = 1 - P(\text{no aces}) = 1 - 0.659 \approx 0.341\]
Tip
where \(N=52\), \(K=4\) aces, \(n=5\) draws, and \(k\) is the number of aces you want.
This structure makes it easy to plug in any “number of successes” you need, or to use the complement when you want “at least one.”
Hypergeometric in one formula
For part (a) you could also write directly:
\[P(k=3) = \frac{\binom{4}{3}\,\binom{48}{2}}{\binom{52}{5}} = \frac{4\cdot1{,}128}{2{,}598{,}960} \approx 0.001735\]
And for part (b):
\[ P(\ge1) = 1 - \frac{\binom{48}{5}}{\binom{52}{5}} = 1 - 0.6590 = 0.3410\]
How many 6-letter “words” can be formed from the letters A, B, C, D, E, F if:
No letter is repeated
A and B must be adjacent
Solution. Treat AB as a single unit
5 units to arrange: (AB), C, D, E, F → \(5! = 120\) ways
A and B can be arranged within their unit: \(2! = 2\) ways
Total: \(5! \times 2! = 240\) ways
The Principle of Inclusion–Exclusion lets you count (or find the probability of) the union of several sets by alternately adding and subtracting the sizes of their intersections.
For two sets \(A\) and \(B\): \[|A \cup B| = |A| + |B| - |A \cap B|\]
For three sets \(A\), \(B\), and \(C\): \[|A \cup B \cup C| = |A| + |B| + |C| - |A \cap B| \\ - |A \cap C| - |B \cap C| + |A \cap B \cap C|\]
How many integers from 1 to 100 are divisible by 2, 3, or 5?
Let:
\(A\) = divisible by 2: \(|A| = 50\)
\(B\) = divisible by 3: \(|B| = 33\)
\(C\) = divisible by 5: \(|C| = 20\)
Note
\(|A \cap B| = 16\) (divisible by 6)
\(|A \cap C| = 10\) (divisible by 10)
\(|B \cap C| = 6\) (divisible by 15)
\(|A \cap B \cap C| = 3\) (divisible by 30)
Solution. \[|A \cup B \cup C| = 50 + 33 + 20 - 16 - 10 - 6 + 3 = 74\]
Answer: 74 integers from 1 to 100 are divisible by at least one of 2, 3, or 5
Multinomial Coefficient
Number of ways to divide \(n\) objects into groups of sizes \(n_1, n_2, \ldots, n_k\):
\[\binom{n}{n_1, n_2, \ldots, n_k} = \frac{n!}{n_1! \times n_2! \times \cdots \times n_k!}\]
How many ways can 12 people be divided into 3 teams of 4?
\(\binom{12}{4,4,4} = \frac{12!}{4! \times 4! \times 4!} = 34,650\)
Strategy
Common Mistakes
A class has 15 students: 8 women and 7 men. How many ways can we:
Solution.
Password Security:
8-character password with letters, digits, symbols
\((26 + 26 + 10 + 32)^8 = 94^8 \approx 6.1 \times 10^{15}\)
Hash Functions:
Distributing data into buckets
Collision probability calculations
Algorithm Analysis:
Counting operations, comparisons
Big O notation foundations
DNA Sequences:
4 bases (A, T, G, C)
Gene of length \(n\): \(4^n\) possible sequences
Protein Folding:
Number of possible conformations
Combinatorial explosion
Population Genetics:
Hardy-Weinberg calculations
Allele combinations
Lottery:
Powerball: Choose 5 from 69, then 1 from 26
Odds: \(\frac{1}{\binom{69}{5} \times 26} \approx \frac{1}{292,000,000}\)
Cryptography:
Key space size determines security
RSA encryption relies on large number factorization
Sports Tournaments:
March Madness bracket: \(2^{63}\) possible outcomes
Round-robin tournaments: \(\binom{n}{2}\) games
Summary of Key Formulas
Tools
Calculators:
Use nPr
and nCr
functions
Be careful with large numbers
Software:
R: factorial()
, choose()
, combn()
Python: math.factorial()
, math.comb()
Excel: FACT()
, COMBIN()
, PERMUT()
Online Tools:
Wolfram Alpha for complex calculations
Combination/permutation calculators
A standard deck of cards is shuffled. What’s the probability that:
Solution.
\(\frac{13}{52} \times \frac{12}{51} \times \frac{11}{50} \times \frac{10}{49} = \frac{13 \times 12 \times 11 \times 10}{52 \times 51 \times 50 \times 49} \approx 0.0026\)
Choose 1 card from each of 13 ranks: \(4^{13}\) Total 13-card hands: \(\binom{52}{13}\) Probability: \(\frac{4^{13}}{\binom{52}{13}} \approx 6.3 \times 10^{-6}\)
Distributions
Hypergeometric Distribution:
Drawing without replacement
Uses combinations: \(P(X = k) = \frac{\binom{K}{k}\binom{N-K}{n-k}}{\binom{N}{n}}\)
Binomial Distribution:
Drawing with replacement
Uses combinations: \(P(X = k) = \binom{n}{k}p^k(1-p)^{n-k}\)
We’ll explore these distributions in detail in future lectures
History
Blaise Pascal (1623-1662) and Pierre de Fermat (1601-1665): - Founded probability theory through gambling problems - Pascal’s triangle and combinations
Leonhard Euler (1707-1783): - Advanced combinatorics - Graph theory connections
Modern applications span computer science, biology, physics, and economics
Q: “When do I use permutations vs combinations?”
A: Ask “Does order matter?” Order matters → permutation
Q: “How do I handle restrictions?”
A: Break the problem into cases or use complementary counting
Q: “What if objects are identical?”
A: Use the formula for permutations with repetition
Q: “How do I check my answer?”
A: Verify with small examples or use different methods
Next Lecture
Next lecture: Discrete Probability Distributions - Binomial distribution (using combinations!)
Hypergeometric distribution
Geometric distribution
Expected value and variance
Connection: Today’s counting techniques are essential for probability calculations
Tips
What We’ve Covered
In this lecture, we’ve addressed all the learning objectives:
Counting is fundamental to:
Probability calculations
Statistical inference
Computer algorithms
Scientific modeling
Know the Basics
Permutations and combinations are the building blocks for advanced statistical concepts
Office Hours: Thursday’s 11 AM On Zoom (Link on Canvas)
Email: nmathlouthi@ucsb.edu
Next Class: Random Variables
Understanding Data - Counting © 2025 Narjes Mathlouthi