How many ways can 2 person sit in 4 empty chairs?

I can find the answer using brute force as 12, but what is the formula to calculate this for any combination of person and chairs.

Here is the brute force combinations for 2 person, 4 chair:

Group where A is always placed before B

A,-,-,B,
A,B,-,-
-,-,A,B
-,A,-,B
A,-,B,-
-,A,B,-

Group where B is always placed before A

B,-,-,A
B,A,-,-
-,-,B,A
-,B,-,A
B,-,A,-
-,B,A,-

Seat A first, then B. A has $4$ choices, leaving $3$ choices for B, giving a (multiplicative) total of $4\times3=12$ different seatings.


Choose 2 seats out of 4 for the two people and the 2 people can arrange themselves in $2!$ ways. Thus the answer is $$2! \times \binom{4}{2} = 2 \times 6 = 12$$

For $n$ chairs and $m$ people (assuming $\binom{n}{m} = 0$ for $m \ge n$) this reduces to choosing $m$ seats out of $n$ and then permuting the $m$ people which is given by the formula $$m! \times \binom{n}{m}$$

Here $\binom{n}{m}$ is the binomial coefficient which denotes the number of ways to choose $m$ objects from a collection of $n$ distinct objects.

The number $m! \times \binom{n}{m}$ is also denoted as $^nP_m$.


Some would call this the "fundamental principle of counting"; multiply the options at each step, e.g., in this case, $4 \times 3 = 12$.

In combinatorics, the rule of product or multiplication principle is a basic counting principle (a.k.a. the fundamental principle of counting). Stated simply, it is the idea that if there are $a$ ways of doing something and $b$ ways of doing another thing, then there are $a · b$ ways of performing both actions.

Rule of product, Wikipedia