# combinations() Function & Examples

Use the combinations() probability function in Calcul.io. Review its syntax, edit working examples, understand the result, and explore related math functions.

## combinations

#### combinations(n, k)

Try it yourself:

```calculio
combinations(7, 5)
```

[permutations](https://calcul.io/function/permutations/index.md)

[factorial](https://calcul.io/function/factorial/index.md)

---

## combinations(): choose distinct items

**combinations(n, k)** counts ways to choose k items from n distinct items when order does not matter and no item can be chosen twice. `combinations(5, 2)` is 10: five objects produce ten unordered pairs.

## Formula

The calculation is the binomial coefficient, `n!/(k!(n-k)!)`. It differs from permutations: choosing A then B is the same selection as B then A. Use [permutations()](https://calcul.io/function/permutations/index.md) when arrangement order matters.

## Applications

Combinations model committees, card hands, sample selection, and branching choices. [factorial()](https://calcul.io/function/factorial/index.md) explains the formula, while [combinationsWithRep()](https://calcul.io/function/combinationsWithRep/index.md) covers selections that allow repeats. For probabilities, combine the count with [division](https://calcul.io/function/divide/index.md).

## Limits

n and k should be non-negative integers with k no larger than n. Large values grow rapidly, so retain exact values where possible and avoid converting to floating point prematurely.

[All functions](https://calcul.io/functions/index.md)
