Combinatorics Formulas

42 formulas
Counting PrinciplesGo to
Inclusion-ExclusionGo to
PermutationsGo to
Combinations & DistributionsGo to
Binomial Coefficient IdentitiesGo to
Binomial & Multinomial TheoremsGo to

Counting Principles

(6 formulas)

Addition Rule

A1A2Ak=A1+A2++Ak,AiAj= for ij.|A_1 \cup A_2 \cup \cdots \cup A_k| = |A_1| + |A_2| + \cdots + |A_k|, \quad A_i \cap A_j = \emptyset \text{ for } i \neq j.
See details
Back to top
explanationconditionsnotationvariantsrelated formulasrelated definitions

Counts the total outcomes when a procedure can be performed by one of kk mutually exclusive methods. If method ii has mim_i ways to occur and no two methods share any outcome, the total number of ways is m1+m2++mkm_1 + m_2 + \cdots + m_k.

Equivalently in set-theoretic form: for pairwise disjoint sets, the cardinality of the union is the sum of the cardinalities.
Back to top

Multiplication Rule

A1×A2××Ak=A1A2Ak=m1m2mk.|A_1 \times A_2 \times \cdots \times A_k| = |A_1| \cdot |A_2| \cdots |A_k| = m_1 \cdot m_2 \cdots m_k.
See details
Back to top
explanationconditionsnotationvariantsrelated formulasrelated definitions

Counts the total outcomes when an outcome is built from a sequence of kk independent steps. If step ii has mim_i options, and the steps are independent, the combined sequence has m1m2mkm_1 \cdot m_2 \cdots m_k possible outcomes.

In set-theoretic form: the cardinality of a Cartesian product of finite sets is the product of their cardinalities.
Back to top

Complementary Counting

A=UUA=UAc.|A| = |U| - |U \setminus A| = |U| - |A^c|.
See details
Back to top
explanationconditionsnotationvariantsrelated formulasrelated definitions

Computes the size of a target set by subtracting its complement from the universe. Most useful when the target condition has the form "at least one" — its negation "none" often partitions into a single tractable count, while the direct count requires case analysis over overlapping subcases.
Back to top

Double Counting

S=f(n)=g(n)    f(n)=g(n).|S| = f(n) = g(n) \implies f(n) = g(n).
See details
Back to top
explanationderivationvariantsrelated formulasrelated definitions

A proof technique rather than a numerical count. The same set SS is enumerated by two genuinely different arguments — typically by selecting members directly versus by partitioning the selection into stages or cases. Both expressions equal S|S|, so they equal each other. The output is an identity.
Back to top

Pigeonhole Principle

n>k     container with 2 items.n > k \implies \exists \text{ container with } \ge 2 \text{ items}.
See details
Back to top
explanationderivationconditionsvariantsrelated formulasrelated definitions

The basic form: if nn items are distributed among kk containers and n>kn > k, at least one container holds at least two items. An existential statement — guarantees a collision must occur without identifying where.
Back to top

Pigeonhole Principle (Generalized)

n items into k containers     container with n/k items.n \text{ items into } k \text{ containers} \implies \exists \text{ container with } \ge \lceil n/k \rceil \text{ items}.
See details
Back to top
explanationderivationnotationrelated formulasrelated definitions

A strengthening of the basic principle: if nn items are distributed among kk containers, at least one container must hold at least n/k\lceil n/k \rceil items, where \lceil \cdot \rceil is the ceiling function.

The basic Pigeonhole Principle is the case n=k+1n = k + 1, where n/k=2\lceil n/k \rceil = 2.
Back to top

Inclusion-Exclusion

(5 formulas)

Inclusion-Exclusion Principle (Two Sets)

AB=A+BAB.|A \cup B| = |A| + |B| - |A \cap B|.
See details
Back to top
explanationderivationrelated formulasrelated definitions

Counts the elements of the union of two overlapping sets. Adding A+B|A| + |B| counts each element of ABA \cap B twice; subtracting AB|A \cap B| removes the double count.
Back to top

Inclusion-Exclusion Principle (Three Sets)

ABC=A+B+CABACBC+ABC.|A \cup B \cup C| = |A| + |B| + |C| - |A \cap B| - |A \cap C| - |B \cap C| + |A \cap B \cap C|.
See details
Back to top
explanationderivationrelated formulasrelated definitions

Extends the two-set formula with one additional correction. Singles add three times for an element in all three sets; pairwise intersections subtract three times; the triple intersection adds once. The net count of any element is exactly one.
Back to top

Inclusion-Exclusion Principle (General)

i=1nAi=k=1n(1)k+11i1<i2<<iknAi1Ai2Aik.\left| \bigcup_{i=1}^{n} A_i \right| = \sum_{k=1}^{n} (-1)^{k+1} \sum_{1 \le i_1 < i_2 < \cdots < i_k \le n} |A_{i_1} \cap A_{i_2} \cap \cdots \cap A_{i_k}|.
See details
Back to top
explanationderivationnotationvariantsrelated formulasrelated definitions

The nn-set form. Add singles, subtract pairwise intersections, add triple intersections, and continue with alternating signs through the nn-fold intersection. Every non-empty subset of the nn sets contributes exactly one term — 2n12^n - 1 terms total.
Back to top

Inclusion-Exclusion Complementary Form

A1A2An=UA1A2An.\left| \overline{A_1} \cap \overline{A_2} \cap \cdots \cap \overline{A_n} \right| = |U| - \left| A_1 \cup A_2 \cup \cdots \cup A_n \right|.
See details
Back to top
explanationderivationvariantsrelated formulasrelated definitions

Counts elements that satisfy none of the conditions defined by A1,,AnA_1, \ldots, A_n. Natural for problems phrased as "how many elements avoid all of the following" — derangements, surjective functions, arrangements with forbidden positions, divisibility problems requiring relative primality.
Back to top

Surjective Functions Count

#{surjections [n][k]}=j=0k(1)j(kj)(kj)n.\#\{\text{surjections } [n] \to [k]\} = \sum_{j=0}^{k} (-1)^j \binom{k}{j} (k-j)^n.
See details
Back to top
explanationderivationconditionsrelated formulasrelated definitions

Counts the surjective (onto) functions from a domain of size nn to a codomain of size kk. Direct enumeration is awkward — the count comes out cleanly by Inclusion-Exclusion on the complementary set "functions that miss at least one codomain element."
Back to top

Permutations

(9 formulas)

Factorial

n!=n(n1)(n2)21,0!=1.n! = n \cdot (n-1) \cdot (n-2) \cdots 2 \cdot 1, \quad 0! = 1.
See details
Back to top
explanationconditionsnotationvariantsrelated formulasrelated definitions

The product of all positive integers from 11 to nn. Counts the number of distinct orderings of nn items — the foundational quantity behind every permutation formula.
Back to top

Full Permutation

P(n)=n!P(n) = n!
See details
Back to top
explanationderivationconditionsnotationrelated formulasrelated definitions

The number of distinct linear arrangements of nn distinct items, with every item used exactly once. Each item is placed at a single position, and reordering produces a different arrangement.
Back to top

Partial Permutation

P(n,r)=n!(nr)!=n(n1)(n2)(nr+1).P(n, r) = \frac{n!}{(n-r)!} = n(n-1)(n-2) \cdots (n-r+1).
See details
Back to top
explanationderivationconditionsnotationvariantsrelated formulasrelated definitions

The number of ordered arrangements of rr distinct items chosen from nn distinct items, with no item reused. Order matters and items appear at most once.
Function machine
pos 1
pos 2
\cdots
pos rr
n!(nr)!\dfrac{n!}{(n-r)!}
nn choices
n1n - 1 choices
\cdots
nr+1n - r + 1 choices
Back to top

Permutation with Repetition

Prep(n,r)=nr.P_{\text{rep}}(n, r) = n^r.
See details
Back to top
explanationderivationconditionsnotationrelated formulasrelated definitions

The number of ordered arrangements of rr positions, where each position is filled independently from a pool of nn items and items may repeat. This is the only permutation scenario whose count is unbounded as rr grows past nn.
Back to top

Permutation with Identical Items

P(n;n1,n2,,nk)=(nn1,n2,,nk)=n!n1!n2!nk!,n1+n2++nk=n.P(n; n_1, n_2, \ldots, n_k) = \binom{n}{n_1, n_2, \ldots, n_k} = \frac{n!}{n_1! \, n_2! \cdots n_k!}, \quad n_1 + n_2 + \cdots + n_k = n.
See details
Back to top
explanationderivationconditionsnotationrelated formulasrelated definitions

The number of distinct linear arrangements of nn items split into kk groups of indistinguishable items of sizes n1,n2,,nkn_1, n_2, \ldots, n_k. The naive n!n! orderings overcount by a factor of n1!n2!nk!n_1! \, n_2! \cdots n_k! since swapping identical items produces no new arrangement.
Function machine
nn distinct items
n!n! orderings
n!n1!n2!nk!\dfrac{n!}{n_1! \, n_2! \cdots n_k!}
arrange all: n!n!
divide by n1!nk!n_1! \cdots n_k!
Back to top

Circular Permutation

Pcirc(n)=(n1)!P_{\text{circ}}(n) = (n-1)!
See details
Back to top
explanationderivationconditionsvariantsrelated formulasrelated definitions

The number of distinct arrangements of nn distinct items around a circle, where rotations of the same arrangement are considered identical. Fixing the position of one item removes the rotational redundancy.
Back to top

Derangement

!n=n!k=0n(1)kk!.!n = n! \sum_{k=0}^{n} \frac{(-1)^k}{k!}.
See details
Back to top
explanationderivationnotationvariantsrelated formulasrelated definitions

The number of permutations of {1,2,,n}\{1, 2, \ldots, n\} in which no element appears in its original position. Of the n!n! total permutations, only !n!n qualify.
Back to top

Derangement Recurrence

!n=(n1)(!(n1)+!(n2)),!0=1,!1=0.!n = (n-1) \bigl( !(n-1) + !(n-2) \bigr), \quad !0 = 1, \quad !1 = 0.
See details
Back to top
explanationderivationvariantsrelated formulasrelated definitions

A two-term linear recurrence for the Derangement count. More efficient than the closed-form for computing !n!n from prior values, especially for tabulating sequences.
Back to top

Derangement Asymptotic Limit

limn!nn!=1e0.367879.\lim_{n \to \infty} \frac{!n}{n!} = \frac{1}{e} \approx 0.367879.
See details
Back to top
explanationderivationnotationrelated formulasrelated definitions

The fraction of permutations of {1,,n}\{1, \ldots, n\} that are derangements approaches a non-zero constant — namely 1/e1/e — as nn grows. For any sufficiently large nn, roughly 36.8%36.8\% of all permutations are derangements.
Back to top

Combinations & Distributions

(5 formulas)

Combination

(nr)=n!r!(nr)!.\binom{n}{r} = \frac{n!}{r! \, (n-r)!}.
See details
Back to top
explanationderivationconditionsnotationvariantsrelated formulasrelated definitions

The number of unordered rr-element subsets of an nn-element set. Different orderings of the same items count as the same combination — what distinguishes combinations from permutations.
Function machine
n,rn, r
P(n,r)P(n, r)
n!r!(nr)!\dfrac{n!}{r!\,(n-r)!}
order: P(n,r)=n!(nr)!P(n, r) = \dfrac{n!}{(n-r)!}
unorder: divide by r!r!
Back to top

Partition into Groups

n!n1!n2!nk!,n1+n2++nk=n.\frac{n!}{n_1! \, n_2! \cdots n_k!}, \quad n_1 + n_2 + \cdots + n_k = n.
See details
Back to top
explanationderivationconditionsvariantsrelated formulasrelated definitions

The number of ways to partition nn distinct items into kk groups of specified sizes n1,n2,,nkn_1, n_2, \ldots, n_k. The formula is the Multinomial Coefficient when group labels are kept distinct.
Back to top

Weak Composition

( ⁣ ⁣(nr) ⁣ ⁣)=(n+r1r1).\left(\!\!\binom{n}{r}\!\!\right) = \binom{n + r - 1}{r - 1}.
See details
Back to top
explanationderivationconditionsnotationvariantsrelated formulasrelated definitions

The number of ways to distribute nn identical items into rr labeled containers, where any container may receive zero or more items. Equivalently, the number of non-negative integer solutions to x1+x2++xr=nx_1 + x_2 + \cdots + x_r = n.
Back to top

Strong Composition

(nr)=(n1r1).\left\langle \binom{n}{r} \right\rangle = \binom{n - 1}{r - 1}.
See details
Back to top
explanationderivationconditionsnotationvariantsrelated formulasrelated definitions

The number of ways to distribute nn identical items into rr labeled containers, with every container receiving at least one item. Equivalently, the number of positive integer solutions to x1+x2++xr=nx_1 + x_2 + \cdots + x_r = n.
Function machine
nn items, rr containers
nrn - r items remain
(n1r1)\dbinom{n - 1}{r - 1}
pre-allocate 1 per container
weak compose
Back to top

Distribution into Cells

rn.r^n.
See details
Back to top
explanationderivationconditionsvariantsrelated formulasrelated definitions

The number of ways to assign each of nn distinct items to one of rr labeled containers. Items are distinct, containers are distinguishable, and any container may receive any number of items (zero allowed).

Equivalently: the number of functions from an nn-element domain to an rr-element codomain.
Back to top

Binomial Coefficient Identities

(10 formulas)

Binomial Coefficient

(nk)=n!k!(nk)!.\binom{n}{k} = \frac{n!}{k! \, (n-k)!}.
See details
Back to top
explanationconditionsnotationvariantsrelated formulasrelated definitions

The number of kk-element subsets of an nn-element set. The same expression organizes polynomial expansions, governs probability distributions, and satisfies a network of identities — treating (nk)\binom{n}{k} as a standalone mathematical object reveals structure that the subset interpretation alone does not expose.
Back to top

Generalized Binomial Coefficient

(xk)=x(x1)(x2)(xk+1)k!,kZ0,  xR (or C).\binom{x}{k} = \frac{x(x-1)(x-2) \cdots (x-k+1)}{k!}, \quad k \in \mathbb{Z}_{\ge 0}, \; x \in \mathbb{R} \text{ (or } \mathbb{C}\text{)}.
See details
Back to top
explanationconditionsnotationvariantsrelated formulasrelated definitions

The binomial coefficient extended to real or complex upper index. The numerator is a polynomial of degree kk in xx, so (xk)\binom{x}{k} is itself a polynomial in xx. Standard combinatorial interpretation fails when xx is not a non-negative integer — the value is purely algebraic.

This is the form that appears in Newton's Generalized Binomial Theorem.
Back to top

Binomial Symmetry Identity

(nk)=(nnk).\binom{n}{k} = \binom{n}{n-k}.
See details
Back to top
explanationderivationconditionsrelated formulasrelated definitions

Choosing which kk elements to include in a subset is the same act as choosing which nkn - k elements to exclude. The two perspectives count the same subsets, so the binomial coefficients agree.

In Pascal's triangle, the identity manifests as left-right symmetry within each row.
Back to top

Pascal's Rule

(nk)=(n1k1)+(n1k).\binom{n}{k} = \binom{n-1}{k-1} + \binom{n-1}{k}.
See details
Back to top
explanationderivationconditionsnotationvariantsrelated formulasrelated definitions

A recursive identity expressing each binomial coefficient as the sum of the two directly above it in Pascal's triangle. The rule is what generates the triangle row by row from the boundary values (n0)=(nn)=1\binom{n}{0} = \binom{n}{n} = 1.
Back to top

Absorption Identity

k(nk)=n(n1k1).k \binom{n}{k} = n \binom{n-1}{k-1}.
See details
Back to top
explanationderivationconditionsvariantsrelated formulasrelated definitions

Also called the committee identity. Both sides count the number of ways to choose a kk-element subset of an nn-element set and then designate one of its members as distinguished.
Back to top

Binomial Row Sum

k=0n(nk)=2n.\sum_{k=0}^{n} \binom{n}{k} = 2^n.
See details
Back to top
explanationderivationrelated formulasrelated definitions

The sum of the entries in row nn of Pascal's triangle equals 2n2^n — the size of the power set of an nn-element set. Each subset is counted exactly once by the row sum, grouped by size.
Back to top

Alternating Binomial Sum

k=0n(1)k(nk)=0,n1.\sum_{k=0}^{n} (-1)^k \binom{n}{k} = 0, \quad n \ge 1.
See details
Back to top
explanationderivationconditionsrelated formulasrelated definitions

The alternating sum of row nn of Pascal's triangle is zero for n1n \ge 1. Equivalently, the number of even-sized subsets of an nn-set equals the number of odd-sized subsets.
Back to top

Vandermonde's Identity

(m+nr)=k=0r(mk)(nrk).\binom{m + n}{r} = \sum_{k=0}^{r} \binom{m}{k} \binom{n}{r - k}.
See details
Back to top
explanationderivationconditionsvariantsrelated formulasrelated definitions

Expresses a single binomial coefficient as a convolution sum of smaller ones. The identity says choosing rr items from m+nm + n items partitions according to how many come from each of two disjoint groups of sizes mm and nn.
Back to top

Hockey Stick Identity

i=kn(ik)=(n+1k+1).\sum_{i=k}^{n} \binom{i}{k} = \binom{n+1}{k+1}.
See details
Back to top
explanationderivationconditionsvariantsrelated formulasrelated definitions

A sum along a diagonal of Pascal's triangle collapses to a single entry one row below. The visual pattern of the summed entries plus the result forms a "hockey-stick" shape — the diagonal handle plus the off-diagonal tip.

Also called the Christmas stocking identity.
Back to top

Sum of Squares of Binomial Coefficients

k=0n(nk)2=(2nn).\sum_{k=0}^{n} \binom{n}{k}^2 = \binom{2n}{n}.
See details
Back to top
explanationderivationconditionsnotationrelated formulasrelated definitions

The sum of squared entries in row nn of Pascal's triangle equals the central binomial coefficient (2nn)\binom{2n}{n}. A special case of Vandermonde's Identity with m=nm = n and r=nr = n.
Back to top

Binomial & Multinomial Theorems

(7 formulas)

Multinomial Coefficient

(nk1,k2,,kr)=n!k1!k2!kr!,k1+k2++kr=n.\binom{n}{k_1, k_2, \ldots, k_r} = \frac{n!}{k_1! \, k_2! \cdots k_r!}, \quad k_1 + k_2 + \cdots + k_r = n.
See details
Back to top
explanationderivationconditionsnotationvariantsrelated formulasrelated definitions

Counts the number of ways to partition nn distinct items into rr labeled groups of specified sizes k1,k2,,krk_1, k_2, \ldots, k_r. Equivalently, the number of distinct arrangements of nn items where kik_i are of type ii. Generalizes the Binomial Coefficient from r=2r = 2 groups to arbitrary rr.
Back to top

Binomial Theorem

(a+b)n=k=0n(nk)ankbk.(a + b)^n = \sum_{k=0}^{n} \binom{n}{k} a^{n-k} b^k.
See details
Back to top
explanationderivationconditionsvariantsrelated formulasrelated definitions

Expands the nn-th power of a binomial. The coefficients are precisely the entries of row nn of Pascal's triangle. The expansion has n+1n + 1 terms, indexed by kk from 00 through nn.
Back to top

General Term in Binomial Expansion

Tk+1=(nk)ankbk.T_{k+1} = \binom{n}{k} a^{n-k} b^k.
See details
Back to top
explanationconditionsnotationvariantsrelated formulasrelated definitions

The (k+1)(k+1)-th term of the binomial expansion of (a+b)n(a + b)^n. The tool for problems asking about one specific term — a particular power of one variable, the term independent of a variable — without expanding the entire polynomial.
Back to top

Middle Term in Binomial Expansion

Tn/2+1=(nn/2)an/2bn/2,n even.T_{n/2 + 1} = \binom{n}{n/2} a^{n/2} b^{n/2}, \quad n \text{ even}.
See details
Back to top
explanationconditionsnotationvariantsrelated formulasrelated definitions

When nn is even, the expansion of (a+b)n(a + b)^n has a unique middle term — the (n/2+1)(n/2 + 1)-th term. Its coefficient (nn/2)\binom{n}{n/2} is the maximum value in row nn of Pascal's triangle: binomial coefficients grow from the edges of each row toward the middle.

This maximum coefficient is called the central binomial coefficient.
Back to top

Weighted Binomial Sum

k=1nk(nk)=n2n1.\sum_{k=1}^{n} k \binom{n}{k} = n \cdot 2^{n-1}.
See details
Back to top
explanationderivationrelated formulasrelated definitions

A weighted analogue of the Binomial Row Sum. Combinatorially, k(nk)k \binom{n}{k} counts (k-subset,distinguished member)(k\text{-subset}, \text{distinguished member}) pairs of size kk — summing over kk counts all (subset, distinguished member) pairs of any size.
Back to top

Newton's Generalized Binomial Theorem

(1+x)α=k=0(αk)xk,x<1,  αR (or C).(1 + x)^{\alpha} = \sum_{k=0}^{\infty} \binom{\alpha}{k} x^k, \quad |x| < 1, \; \alpha \in \mathbb{R} \text{ (or } \mathbb{C}\text{)}.
See details
Back to top
explanationconditionsnotationvariantsrelated formulasrelated definitions

Extends the Binomial Theorem from non-negative integer exponents nn to arbitrary real (or complex) exponents α\alpha. The expansion becomes an infinite series, converging for x<1|x| < 1.

When α=n\alpha = n is a non-negative integer, the Generalized Binomial Coefficient (nk)\binom{n}{k} equals 00 for k>nk > n, so the series terminates and recovers the ordinary binomial theorem.
Back to top

Multinomial Theorem

(x1+x2++xr)n=k1+k2++kr=nki0(nk1,k2,,kr)x1k1x2k2xrkr.(x_1 + x_2 + \cdots + x_r)^n = \sum_{\substack{k_1 + k_2 + \cdots + k_r = n \\ k_i \ge 0}} \binom{n}{k_1, k_2, \ldots, k_r} x_1^{k_1} x_2^{k_2} \cdots x_r^{k_r}.
See details
Back to top
explanationderivationconditionsnotationvariantsrelated formulasrelated definitions

Generalizes the Binomial Theorem from two-term to rr-term sums. The coefficient of x1k1x2k2xrkrx_1^{k_1} x_2^{k_2} \cdots x_r^{k_r} is the Multinomial Coefficient.
Back to top
Counting Principles
Addition RuleMultiplication RuleComplementary CountingDouble CountingPigeonhole PrinciplePigeonhole Principle (Generalized)
Inclusion-Exclusion
Inclusion-Exclusion Principle (Two Sets)Inclusion-Exclusion Principle (Three Sets)Inclusion-Exclusion Principle (General)Inclusion-Exclusion Complementary FormSurjective Functions Count
Permutations
FactorialFull PermutationPartial PermutationPermutation with RepetitionPermutation with Identical ItemsCircular PermutationDerangementDerangement RecurrenceDerangement Asymptotic Limit
Combinations & Distributions
CombinationPartition into GroupsWeak CompositionStrong CompositionDistribution into Cells
Binomial Coefficient Identities
Binomial CoefficientGeneralized Binomial CoefficientBinomial Symmetry IdentityPascal's RuleAbsorption IdentityBinomial Row SumAlternating Binomial SumVandermonde's IdentityHockey Stick IdentitySum of Squares of Binomial Coefficients
Binomial & Multinomial Theorems
Multinomial CoefficientBinomial TheoremGeneral Term in Binomial ExpansionMiddle Term in Binomial ExpansionWeighted Binomial SumNewton's Generalized Binomial TheoremMultinomial Theorem