- Item types (n)
- 5
- Items chosen (r)
- 3
35
Open with these values35selections
Result: 35 selectionsThree scoops from five ice cream flavours, doubles allowed, order ignored: C(5 + 3 − 1, 3) = C(7, 3) = 35 selections. Without repeats the same question has only 10 answers. Because repeats are allowed, r may be larger than n — five scoops from two flavours is a valid question with six answers.
Held fixed: Item types (n) 5.
| Items chosen (r) | Result |
|---|---|
| 1 | 5 |
| 2 | 15 |
| 3Your value | 35 |
| 4 | 70 |
| 5 | 126 |
35
Open with these values55
Open with these values462
Open with these valuesC(n + r − 1, r)
This is the counting question in which nothing is used up: r picks from n types, every type available as often as you like, and a basket judged only by what is in it. Listing such baskets directly is awkward, because a basket has no natural order to work along. The stars and bars trick turns it into a question that is easy. Write a basket as a row: one star per item taken, plus n − 1 bars as fences between the n types, so everything left of the first bar belongs to type one, and so on. Three scoops from five flavours becomes a row of three stars and four bars. Every such row is exactly one basket and every basket exactly one row, so the rows are what has to be counted. A row has 3 + 4 = 7 positions, and which 3 of them hold stars settles it completely: C(7, 3) = 35. In general the row has n + r − 1 positions, which gives C(n + r − 1, r). Two things the number does not say. It assumes unlimited stock of every type — cap a flavour at one scoop and it counts too high. And equally many baskets are not equally likely baskets: pick at random and mixed baskets turn up far more often than three of a kind.
You draw from unlimited stock of each type, and a basket counts once however it was assembled. Three scoops from five flavours: C(5 + 3 − 1, 3) = C(7, 3) = 35 baskets.
Allowing repeats adds baskets rather than orders: three from five types gives 10 ordinary combinations but 35 with repetition. Because nothing is used up, r may also be larger than n — five scoops from two flavours has six answers.
Place r identical stars into n labelled bins; separating the bins takes n − 1 bars. Every row of r stars and n − 1 bars is exactly one selection, and there are C(n + r − 1, r) such rows.
Three scoops from five flavours is C(5, 3) = 10.
That answer forbids taking a flavour twice. With doubles allowed the count is C(7, 3) = 35.
Chocolate, vanilla, chocolate and vanilla, chocolate, chocolate are two selections.
They are two sequences but the same basket, and this calculator counts baskets. Counting the sequences instead gives n to the power r, which is far larger.
Making change from three coin values needs ordinary combinations.
Each value can be used again and again, so it belongs here. The ordinary form fits distinct physical objects, this one fits types.
| n, r | Reads as | Selections |
|---|---|---|
| 4, 0 | take nothing at all | 1 |
| 1, 5 | one flavour, five scoops | 1 |
| 3, 2 | two scoops from three flavours | 6 |
| 2, 5 | five scoops from two flavours | 6 |
| 4, 3 | three from four types | 20 |
| 5, 3 | three scoops from five flavours | 35 |
| 10, 2 | two from ten types | 55 |
| 6, 6 | six from six types | 462 |
They count the ways to pick r items from n distinct types when the same type may be taken more than once and the order does not matter. The count is the multiset coefficient C(n + r − 1, r). Three scoops from five flavours gives C(7, 3), which is 35.
Ordinary combinations spend each item, so r can never exceed n; here you draw from unlimited stock of each type, so r is free. The count is always at least as large: three from five types gives 10 ordinary combinations but 35 with repetition. Use the ordinary form for distinct physical objects, this one for types.
Both allow the same type twice, but permutations count ordered sequences and combinations count unordered baskets. Chocolate, vanilla, chocolate is a different sequence from vanilla, chocolate, chocolate, yet the same basket. Permutations give n to the power r, which is far larger.
Place r identical stars into n labelled bins; separating the bins takes n − 1 bars. Every row of r stars and n − 1 bars is exactly one selection, and there are C(n + r − 1, r) such rows. That argument is where the formula comes from.
Anywhere a basket is assembled from unlimited stock without caring about order: ice cream scoops, pizza toppings with doubles allowed, ways of making change from given coin values, sampling with replacement in statistics. The same coefficients appear in multivariate polynomial expansions.
Information, not professional advice.
Diese Seite gibt es auch auf Deutsch.
Zu Deutsch wechseln