CommerceLens
Probability

Campaign & Recommendation Combinatorics

Interactive

Counting problems show up constantly in campaign design: how many ways can offers be assigned to segments, how many distinct samples can a targeting list draw, how many bundle variants exist? The key distinction throughout is whether order matters (permutations) or doesn't (combinations).

Counting Principle & Factorials

Factorial
n! counts the number of ways to arrange n distinct items in a sequence — order matters at every step.
Worked example: 120!
5! = 5 × 4 × 3 × 2 × 1 = 120
n (0–15)
5!
120

Campaign Offer Assignment

Order Matters — Permutations
Order matters
Assigning a distinct offer to each segment is an ordered arrangement: giving Segment 1 the “10% off” offer and Segment 2 “free shipping” is a different assignment than swapping them. Each segment plays a distinct role, so we use permutations, not combinations.
Offer types (n)
Segments (r)
Distinct offer per segment
P(n, r) = n! / (n − r)! = 5! / (5 − 4)!
Distinct assignments (P(5, 4))
120
Unrestricted case: any offer can repeat across segments
Counting principle: 5 × 5 × 5 × 5 = 625

Choosing a Campaign Sample

Order Does Not Matter — Combinations
Order doesn’t matter
Choosing which k customers out of a pool of N receive a campaign is a selection, not a sequence — two different customers picked in either order form the same sample. We use combinations.
Pool size (N)
Sample size (k)
Combinations
C(N, k) = N! / [k! (N − k)!] = 1000! / [20! (1000 − 20)!]
Distinct samples (C(1000, 20))
3.3948 × 10^41

Reference value from the precomputed payload: choosing 20 from a pool of 1,000 gives 3.3948 × 10^41 distinct samples.

Product Bundle Design

Order Does Not Matter — Combinations
Order doesn’t matter
A bundle of k products chosen from an assortment of n is an unordered set — a bundle of {A, B, C} is the same bundle regardless of the order the products were added.
Assortment size (n)
Bundle size (k)
Combinations
C(n, k) = n! / [k! (n − k)!] = 12! / [3! (12 − 3)!]
Distinct bundles (C(12, 3))
220

Reference value: choosing a bundle of 3 from an assortment of 12 gives 220 distinct bundles.

Arranging a Campaign Slot Sequence with Repeats

Order Matters, with Repeated Items
Order matters
A campaign banner rotation fills a sequence of slots with copies of two offers — by default 3 copies of “Offer A” and 2 copies of “Offer B”. Because the copies of the same offer are indistinguishable from one another, we divide out the repeated arrangements. Adjust the group sizes below to see the count update live.
Copies of Offer A (n₁)
Copies of Offer B (n₂)
Permutations with repetition
n! / (n₁! · n₂!) = 5! / (3! · 2!) = 10
Distinct slot sequences
10
5 slots: 3× Offer A, 2× Offer B

Permutations vs. Combinations

Ask yourself one question: if I rearranged the chosen items, would I get something different? Assigning offer “10% off” to Segment A and “free shipping” to Segment B is not the same as the reverse — order matters, so that’s a permutation. But picking the same 20 customers for a campaign, regardless of the order you clicked their names — order doesn’t matter — is a combination.