The product of the first \(k\) positive integers (counting numbers) is called \(k\) factorial and is denoted \(k!\) (Weiss 2010).

\[ k! = k \times (k - 1) \times ...\times 2 \times 1 \]

We also define \(0! = 1\).

Let us consider an easy example and calculate the factorial of 6. Plugging into the equation from above this gives us:

\[ 6! = 6 \times 5 \times 4 \times 3 \times 2 \times 1 \]

In R we write…

## [1] 720

…or we use the in-built function factorial()

## [1] 720

Binomial Coefficients

If \(n\) is a positive integer and \(k\) is a non negative integer less than or equal to \(n\), then the binomial coefficient \({n \choose k}\) is defined as:

\[ {n \choose k}= \frac{n!}{k!(n - k)!}\]

The binomial coefficients \({n \choose k}\) is often read aloud as “n choose k”, because there are \({n \choose k}\) ways to choose \(k\) elements, disregarding their order, from a set of \(n\) elements. Or in other words, the binomial coefficients refers to the number of combinations of \(n\) things taken \(k\) at a time without repetition. Please note, that the order of selection does not matter.

Let us try an example to gain some intuition.

Consider a simple word, such as “dog”, containing three different letters; d,o,g. How many possibilities exist to draw exactly one letter out those 3 letters? For sure, there are 3 possibilities to draw exactly 1 letter: “d”, “o”, or “g”. Thus we can write all the combinations as \({3 \choose 1}\). What about two letters? How many combinations exist to draw exactly two letters out of 3 letters? The combinations are “do”, “dg”, and “og” (Please note that for example “og” and “go” are counted only as one combinations, as order does not matter right now). Accordingly, the answer is 3 which can be written as \({3 \choose 2}\). One final question: How many combinations exist to draw exactly three letters out of 3 letters? Let us ask R!

First, we implement a naive approach, by applying the formula from above.

n <- 3 # the word "dog" has 3 letters
k <- 3 # we draw exactly three letters
## [1] 1

However, we may as well apply the built-in function called choose() to calculate the number of combinations. We do that for \(k = 1,2,3\).

n <- 3
choose(n, 1)
## [1] 3
choose(n, 2)
## [1] 3
choose(n, 3)
## [1] 1

Now, that we are familiar with the concept let us consider a more complex example: The Department of Earth Sciences of FU Berlin asks all graduates to choose their favorite 4 courses of the curriculum. How many different answers could the students give, if the curriculum offers 24 courses to choose from? Any guesses? Let us ask R.

choose(24, 4)
## [1] 10626

The students could give 10,626 different answers.

Bernoulli Trials

Repeated trials of an experiment are called Bernoulli trials if the following three conditions are satisfied:

  1. The experiment (each trial) has two possible outcomes, denoted \(s\), for success, and \(f\), for failure.
  2. The trials are independent.
  3. The probability of a success, called the success probability and denoted \(p\), remains the same from trial to trial.