# Ch. 2 Probability

Sections covered: 2.1, 2.2, 2.3, 2.5

(2.4 will be covered later in the semester)

## 2.3 Counting Techniques

### R

**Factorial**

`factorial(5)`

`## [1] 120`

**Combinations**

“5 choose 2” = choose 2 items out of 5

`choose(5, 2)`

`## [1] 10`

**Permutations**

There is no built-in function to calculate permutations. You can multiply the number of combinations by *k!*.

Ex. Number of permutations of size 2 that can be formed from 5 distinct items:

`## [1] 20`

You can create your own function to do this:

`## [1] 20`