Definition
Combination with Repetition
A combination with repetition chooses
elements from available elements without placing them in order. Order does not matter, and the same element may be chosen more than once. Thus choosing gives the same combination as choosing . For a finite set
, such a combination is a multiset of size . It is determined by the multiplicities where
records how many copies of were chosen. The number of combinations with repetition is The construction can be pictured as filling
slots, one selection at a time. At every selection all elements remain available, so an earlier choice never removes anything. Once the last slot is filled, the order of the slots is discarded and only the multiplicities remain:
Derivation by Stars and Bars
Let
Reading an ordinary encoding
Fix the element order
. Read the compartments from left to right: stars before the first bar count copies of , stars between the bars count copies of , and stars after the second bar count copies of . Hence the encoding represents the selection
.
A bar at an end means a missing type
For the element order
, consider No star appears before the first bar, so
is selected zero times. The three middle stars select three copies of , and the final star selects one copy of . The represented selection is .
Adjacent bars mean an empty compartment
For the element order
, consider The adjacent bars leave no star in the
-compartment, so is absent. The final bar leaves no star in the -compartment, so is absent as well. The represented selection is .
For
Stars to the left of the bar count copies of
Every combination with repetition produces exactly one such string, and every such string determines exactly one multiplicity vector. The string contains
symbols. Choosing which
Adjacent bars, or a bar at either end, represent an element chosen zero times, so zero multiplicities are included automatically.
Distinction from Variation with Repetition
Warning
A variation with repetition records an ordered tuple, so
, , and are different. A combination with repetition records only multiplicities, so all three have the same multiplicity vector and represent one combination.
Boundary Cases
For
Unlike combinations without repetition,
Example
Choosing four scoops
Suppose four scoops of ice cream are chosen from three flavours, with repeated flavours allowed and scoop order ignored. The number of flavour combinations is