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,-

-
What about if they both sit in the same chair? Or maybe B is really tired, and lays down taking up two or three of the chairs? – aslum Mar 28 at 18:15
If a chair is empty, then no one is sitting in it, so the answer is zero. – DCShannon Mar 28 at 19:15
How flexible are your people? – Mark Mar 28 at 22:20
Define "sit in a chair". Contrast with this‌​. – Eric Towers Mar 29 at 7:21
The formal answers are addressing the following common sense situations: 1st person can sit in and of 4 chairs, 2nd in any of 3. 4 x 3 = 12 | OR 1st person can sit in any of 4 chairs. 2nd person can ALSO sit in any of 4 chairs. 4 x 4 = 16. BUT of these 16 combinations, 4 have both in the same chair. If this is not intended then these 4 combinations are invalid so 16-4 = 12. – Russell McMahon Mar 29 at 13:45

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$.

-
To add some commentary to this: $\binom{n}{m}$ tells you the number of ways $m$ people can choose from $n$ things, in order, i.e. first person picks, then the second person picks from remaining, then third, then fourth... up to the $m$th person. This is then multiplied by $m!$ which is the total number of ways that $m$ people can be arranged in order. – Dancrumb Mar 28 at 16:19

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

-

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

-

(1) The 1st person can sit in any of 4 chairs.
For each of the 4 possible choices the st person makes there are 3 left to the 2nd person, so there are 4 sets of 3 combinations.
4 x 3 = 12

(2) As before the 1st person can sit in any of 4 chairs.
Now seat the 2nd person without regard to the location of the 1st person.
The 2nd person can ALSO sit in any of 4 chairs for each choice made by the 1st person.
4 x 4 = 16.
BUT of these 16 combinations, 4 have both people in the same chair.
If this is not intended then these 4 combinations are invalid
so 16-4 = 12.

(3) :-)
If anyone sits anywhere there are no longer 4 empty chairs, so there are 0 ways that 2 people can sit in 4 empty chairs.

-