- With Repetition (Unlimited Repeats)[^2]: If objects can repeat, the number of permutations of $n$ objects taken $r$ at a time is:
$$
n^r
$$
- With Repetition (Limited Repeats) [^3]: If there are $k_1$ objects of one type, $k_2$ of another, ..., and $k_t$ of type $t$, the number of permutations is:
A combination is a selection of objects where the order does not matter.
- Without Repetition: The number of combinations of $n$ distinct objects taken $r$ at a time is denoted by $nC_r$ or $\binom{n}{r}$, and is calculated as:
$$
nC_r = \binom{n}{r} = \frac{n!}{r!(n - r)!}
$$
- With Repetition: If repetition is allowed, the number of combinations of $n$ objects taken $r$ at a time is:
$$
\binom{n + r - 1}{r}
$$
---
## Examples
### Counting Strings Over an Alphabet
How many strings of length 3 can we form with the alphabet $\Sigma = \{a, b, c, d, e\}$?
- Since there are 5 choices for each position, the total number of strings is:
$$
5 \cdot 5 \cdot 5 = 5^3 = 125
$$
### Combinations Without Repetition
How many subsets of size 3 can we form from $A = \{a, b, c, d, e\}$?
- First, calculate the number of permutations:
$$
\frac{5!}{(5-3)!} = 5 \cdot 4 \cdot 3
$$
Divide by $3!$ to account for order:
$$
\frac{5 \cdot 4 \cdot 3}{3!} = 10
$$
### Combinations With Repetition
In a restaurant offering 12 desserts, how many ways can you choose 4 desserts (allowing repeats)?
- Using the formula for combinations with repetition:
$$
\binom{12 + 4 - 1}{4} = \binom{15}{4} = 1365
$$
---
## The Pigeonhole Principle
If $n$ items are placed into $m$ containers and $n > m$, at least one container must hold more than one item.
- If there are 13 pigeons and 12 pigeonholes[^6], at least one hole must contain more than one pigeon.
---
## Recurrence Relations
A recurrence relation defines a sequence by relating each term to previous terms.
- The Fibonacci sequence is defined by:
$$
F(n) = F(n - 1) + F(n - 2)
$$
with initial conditions $F(0) = 0$ and $F(1) = 1$.
### Solving Recurrence Relations
1. Backtracking[^7]: Repeatedly substitute the recurrence relation to find a pattern.