Math
Text

# Math Background

Lesson 4 Chapter 2

To tackle and solve the probability problem, there is always a need to count how many elements available in the event and sample space. Here, we discuss some important counting principles and techniques.

## Counting all possible outcomes

Let's consider the special case of having two experiments as and . The basic principle states that if one experiment ( ) results in N possible outcomes and if another experiment ( ) leads to M possible outcomes, then conducting the two experiments will have possible outcome, in total. Assume experiment has M possible outcomes as and has N possible outcomes as .

It is easy to prove such a principle for its special case. All you need in to count all possible outcomes of two experiments: The generalized principle of counting can be expressed as below:

### Generalized Basic Principle of Counting

Assume we have q different experiments with the corresponding number of possible outcomes as . Then we can conclude that there is a total of outcomes for conducting all q experiments.

## Permutation

What is a permutation? Suppose we have three persons called Michael, Bob, and Alice. Assume the three of them stay in a queue. How many possible arrangements we have? Take a look at the arrangements as follows: As above, you will see six permutations. Right? But, we cannot always write all possible situations! We need some math. The intuition behind this problem is that we have three places to fill in a queue when we have three persons. For the first place, we have three choices. For the second place, there are two remaining choices. Finally, there is only one choice left for last place! So we can extend this conclusion to the experiment that we have choices. Hence, we get the following number of permutations: which you can compute by Python as below:

NOTE: The descending order of multiplication from to is as above (the product of all positive integers less than or equal to n), denote as , and called factorial.

## Combination

The combination stands for different combinations of objects from a larger set of objects. For example, assume we have a total number of objects. With how many ways can we select objects from that objects? Let's get back to the above examples. Assume we have three candidates named Michael, Bob, and Alice, and we only desire to select two candidates. How many different combinations of candidates exist? Let's get back to the general question: How many selections we can have if we desire to pick objects from objects?

### Combination

The number of unordered selections of objects from objects is denoted and calculated as: NOTE: In the combination selection, we referred to the unordered selection. It means, the combination of is the same as i.e., the order does NOT matter.

The above definition can be generalized.

### Generalization

Assume we have objects, groups of objects each with objects, and . The number of unordered possible divisions of n objects into these distinct groups can be calculated as below: 