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 be the number of available element types and let be the total number of selected occurrences. Represent each of the selections by a star and separate the element types with bars. The number of stars in compartment is the multiplicity of the -th element type.
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 element types and selections, there is one bar among four symbol positions. Each path chooses its position and thereby fixes one combination:
Stars to the left of the bar count copies of ; stars to its right count copies of . The four paths are exactly the four combinations with repetition.
Every combination with repetition produces exactly one such string, and every such string determines exactly one multiplicity vector. The string contains
symbols. Choosing which positions contain stars—equivalently, which positions contain bars—gives
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 , there is one empty multiset. For , there is one combination for every : choose the sole element times.
Unlike combinations without repetition, may exceed .
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