# Binomial Coefficient

*See also:*factorial

The binomial coefficient denotes the number of ways to select a specific number of items \(k\) from a more extensive set of \(n\) elements, disregarding the selection order. In combinatorics, the binomial coefficient is denoted using the notation \(n\) choose \(k\). The formula for the binomial coefficient is:

\[ \binom {n}{k} = \begin{cases} \displaystyle{\frac {n!}{k! \times (n-k)!}} & \text{for } n, k \in \mathbb{N}, \ 0 \leq k \leq n \\[1em] 0 & \text{if } n, k \in \mathbb{N}, \ 0 \leq n \leq k \end{cases} \]

- \(n\) represents the total number of elements in the set.
- \(k\) denotes the number of items to be selected.
- \(n!\) and \((n-k)!\) point represents the factorial of te natural numbers \(n\) and \((n-k)!\).

To determine the value of the binomial coefficient \( \large{4 \choose 2} \), we count the number of pairs that can be created from a set of four elements. Consider a set \(P=(p,q,r,s)\). The number of subsets formed by two elements is six. These subsets are:

\[ (p,q) \quad (p,r) \quad (p,s) \quad (q,r) \quad (q,s) \quad (r,s) \]

It is crucial to note that the constraint of disregarding the order of the elements is essential to achieve the presented outcome. Should we fail to adhere to this constraint, we would also have to include pairs such as \((q,p)\), \((r,q)\), and so on.

## Symmetry property

The binomial coefficient’s symmetry property is a key concept. It’s observed when selecting a subset of \(k\) elements from a set of \(n\) elements, with the number of ways to do this always equal to the number of ways to select the remaining \(n-k\) elements. This symmetry is reflected in the equivalence:

\[ \binom{n}{k} = \binom{n}{n-k} \]

This principle of symmetric selection is not just a theoretical idea, but a practical tool used in various fields. It’s particularly useful in probability theory, combinatorics, and statistics, where it helps in calculating probabilities, counting possibilities, and analyzing data.

## Additive property

The additive property of the binomial coefficient establishes a relationship between consecutive binomial coefficients. If we consider the binomial coefficients \( \large{n \choose k} \) and \( \large{{n \choose k+1}}\), then:

\[{n \choose k} + {n \choose k+1} = {n+1 \choose k+1}\]

This property is fundamental in practical applications, as it provides a way to quickly compute the value of the next binomial coefficient, knowing the previous ones. It relies on the definition of the binomial coefficient and its recursive relationship, which allows the expression of a binomial coefficient in terms of preceding binomial coefficients.

## Recursive property

The concept of recursion of the binomial coefficient provides a method of calculating binomial coefficients by utilizing preceding binomial coefficients. This approach can be useful in many situations. We can express this property as follows:

\[ {n \choose k} = {n-1 \choose k} + {n-1 \choose k-1} \]

For example, to calculate the binomial coefficient of \( \large{{3 \choose 2}} \) using the recursive property we have:

\[ {3 \choose 2} = {2 \choose 2} + {2 \choose 1} = 1 + 2 = 3 \]

## Recursive approach to code the binomial coefficient

As in the case of the factorial, calculating the binomial coefficient is often used as an example when discussing recursive functions in programming due to its simplicity. A recursive function is a type of function that calls itself. Its defining characteristic is a recursive call that continues until the base case is reached. When calculating the binomial coefficient, the base case occurs when \( k \) equals 0 or \(k = n\).

```
public class BinomialCoefficient {
public static void main(String[] args) {
int n = 3;
int k = 2;
// Printing the binomial coefficient for (n, k)
System.out.println("Binomial Coefficient of (" + n + ", " + k + ") is: " + binomialCoefficient(n, k));
}
// Recursive function to calculate the binomial coefficient
public static int binomialCoefficient(int n, int k) {
// Base case
if (k == 0 || k == n) {
return 1;
}
// Recursion to calculate the binomial coefficient
return binomialCoefficient(n - 1, k - 1) + binomialCoefficient(n - 1, k);
}
}
```