freeCodeCamp/guide/english/mathematics/counting/combinations/index.md

1.9 KiB

title
Combinations

Combinations

A combination is a selection of items from a collection,where the order of selection does not matter. More formally:

A k-combination of a set S is a subset of k distinct elements of S. If the set has n elements, the number of k-combinations is equal to the binomial coefficient1

alt text

Or if you prefer using the factorial:

alt text

Combinations refer to the combination of n things taken k at a time without repetition. To refer to combinations in which repetition is allowed, the terms k-selection or k-combination with repetition are often used and we use the following formulae:

alt text

Some examples:

Combinations are very usefull when you want to solve combinatoric problems like the following one:

Compute the probability to obtain a poker from
a standard fifty-two card deck drawing 5 cards
at the same time

In order to solve this simple problem you need to compute the number of 5 card hands possible using combinations:

alt text

Mind that alt text is equal to 48 as per binomial coefficient definition.

Sources

1 Wikipedia Combination entry