# Three ob­jects in a line

How many ways are there to ar­range three ob­jects in a line? (I’ll use num­bers $$1,2,3$$ to rep­re­sent the ob­jects; pre­tend I painted the num­bers onto the re­spec­tive ob­jects.) For ex­am­ple, $$1,2,3$$ is one way to ar­range the three ob­jects; $$1,3,2$$ is an­other; and so on.

To be com­pletely con­crete, let’s say I have three same-sized cubes and I have three same-sized boxes to place them in; the boxes are ar­ranged into one row and can’t be moved (they’re too heavy), but the cubes are made of balsa wood and can be moved freely. The num­ber $$1$$ is painted on one cube; $$2$$ on an­other; and $$3$$ on the third. How many ways are there to ar­range the cubes into the fixed boxes?

Have a think about this, then re­veal the an­swer and a pos­si­ble way of get­ting the an­swer.

The to­tal num­ber of ways is $$6$$. The com­plete list of pos­si­ble op­tions is:

• $$1,2,3$$

• $$1,3,2$$

• $$2,1,3$$

• $$2,3,1$$

• $$3,1,2$$

• $$3,2,1$$

I’ve listed them in an or­der that hope­fully makes it fairly easy to see that there are no more pos­si­bil­ities. First I listed ev­ery pos­si­ble way $$1$$ could come at the be­gin­ning; then ev­ery pos­si­ble way $$2$$ could; then ev­ery pos­si­ble way $$3$$ could.

If you got the an­swer $$6$$ through some other method, that’s (prob­a­bly) fine: there are many ways to think about this prob­lem. <div><div>

How about ar­rang­ing four ob­jects in a line? (That is, four cubes into four fixed boxes.)

The to­tal num­ber of ways is $$24$$. The com­plete list of pos­si­ble op­tions is:

• $$1,2,3,4$$

• $$1,2,4,3$$

• $$1,3,2,4$$

• $$1,3,4,2$$

• $$1,4,2,3$$

• $$1,4,3,2$$

• $$2,1,3,4$$

… I got bored.

How could we do this with­out list­ing all the pos­si­bil­ities? I promise the an­swer re­ally is $$24$$, but you should think about this for a bit be­fore con­tin­u­ing.

# How to ar­range four objects

There’s an in­sight that makes ev­ery­thing much eas­ier.

Once we’ve placed a cube into the left­most box, all we have left to do is fit the re­main­ing three cubes into the re­main­ing three boxes.

We’ve already seen above that there are $$6$$ ways to ar­range three cubes among three boxes!

So the to­tal num­ber of ways of do­ing four cubes among four boxes is:

• $$6$$ ways where the left­most box con­tains cube $$1$$ (and I ac­tu­ally listed all of those above be­fore I got bored);

• $$6$$ ways where the left­most box con­tains cube $$2$$;

• $$6$$ ways where the left­most box con­tains cube $$3$$;

• $$6$$ ways where the left­most box con­tains cube $$4$$.

That comes to $$24$$ in to­tal.

# In­ter­lude: Exercise

Can you work out how many ways there are to ar­range five cubes into five fixed boxes? Take a hint from how we did four boxes above.

There are $$120$$ ways to do this. Re­mem­ber, there are $$24$$ ways to ar­range four cubes among four boxes.

Then to ar­range five cubes among five boxes:

• $$24$$ ways where the left­most box con­tains cube $$1$$

• $$24$$ ways where the left­most box con­tains cube $$2$$

• $$24$$ ways where the left­most box con­tains cube $$3$$

• $$24$$ ways where the left­most box con­tains cube $$4$$

• $$24$$ ways where the left­most box con­tains cube $$5$$

That comes to $$120$$ in to­tal. <div><div>

# In general

OK, that was all well and good. But if we didn’t already know how to ar­range four ob­jects into four boxes, how could we jump straight to ar­rang­ing five ob­jects into five boxes?

Well, you might have no­ticed a pat­tern already.

• To ar­range five boxes, we added the four-boxes num­ber to it­self five times; that is, we mul­ti­plied the four-boxes num­ber by $$5$$.

• To ar­range four boxes, we added the three-boxes num­ber to it­self four times; that is, we mul­ti­plied the three-boxes num­ber by $$4$$.

Per­haps you can see that this will always work: to ar­range $$n$$ boxes, we add the $$n-1$$-boxes num­ber to it­self $$n$$ times. That is, we mul­ti­ply the $$n-1$$-boxes num­ber by $$n$$. In­deed, there are $$n$$ pos­si­ble ways to fill the left­most box noteWe can do it with the num­ber $$1$$, or the num­ber $$2$$, or… or the num­ber $$n$$; that’s $$n$$ ways. and once we’ve done that, there are “the $$n-1$$-boxes num­ber” ways to fill the re­main­ing $$n-1$$ boxes.

But this still doesn’t help us jump straight to how to ar­range five ob­jects into five boxes. Here comes the clever bit.

Let’s write $$5!$$ (with an ex­cla­ma­tion mark) for the num­ber that is “how many ways to ar­range five ob­jects into five boxes”. noteWe already know this num­ber is ac­tu­ally $$120$$. Similarly, $$4!$$ is “how many ways to ar­range four ob­jects into four boxes”, and in gen­eral $$n!$$ is “how many ways to ar­range $$n$$ ob­jects into $$n$$ boxes”.

Then the pat­terns we noted ear­lier be­come:

• $$5! = 5 \times 4!$$

• $$4! = 4 \times 3!$$

(No­tice how much cleaner that is than “To ar­range five boxes, we added the four-boxes num­ber to it­self five times; that is, we mul­ti­plied the four-boxes num­ber by $$5$$”. This is why math­e­mat­i­ci­ans use no­ta­tion: to make ev­ery­thing eas­ier to say.)

And the gen­eral rule is: noteBe­ing care­ful to put $$n-1$$ in brack­ets, be­cause oth­er­wise it looks like $$n \times n - 1!$$, which means $$(n \times n)-1!$$ ac­cord­ing to the or­der of op­er­a­tions.

$$n! = n \times (n-1)!$$

OK, we have

• $$n! = n \times (n-1)!$$, and

• $$(n-1)! = (n-1) \times (n-2)!$$, and

• $$(n-2)! = (n-2) \times (n-3)!$$, and so on.

So

$$n! = n \times (n-1)! = n \times (n-1) \times (n-2)! = n \times (n-1) \times (n-2) \times (n-3)!$$
and so on.

If we just keep go­ing, we’ll even­tu­ally reach

$$n \times (n-1) \times (n-2) \times \dots \times 5 \times 4 \times 3!$$
and we already know that $$3! = 6$$, which I’ll write as $$3 \times 2 \times 1$$ for rea­sons which are about to be­come ob­vi­ous.

So we have the fol­low­ing for­mula, which is how we define the fac­to­rial:

$$n! = n \times (n-1) \times \dots \times 4 \times 3 \times 2 \times 1$$

$$n!$$” is read out loud as ”$$n$$ fac­to­rial”, and it means “the num­ber of ways to ar­range $$n$$ ob­jects into any or­der”.

# Edge cases

We’ve seen $$3!$$, but never $$2!$$ or $$1!$$.

• It’s easy to see that there are two ways to ar­range two ob­jects into an or­der: $$1,2$$ or $$2,1$$. So $$2! = 2$$.

• It’s also easy (if a bit weird) to see that there is just one way of ar­rang­ing one ob­ject into an or­der: $$1$$ is the only pos­si­ble way. So $$1! = 1$$.

• How about ar­rang­ing no ob­jects into an or­der? This is even weirder, but the an­swer is $$1$$. There is a way to ar­range no ob­jects into an or­der: just don’t put down any ob­jects. This is some­thing which you should just ac­cept with­out think­ing about it too hard, and it al­most never crops up. Any­way, $$0! = 1$$.

Parents:

• Factorial

The num­ber of ways you can or­der things. (Alter­nately sub­ti­tled: Is that ex­cla­ma­tion point a fac­to­rial, or are you just ex­cited to see me?)

• Mathematics

Math­e­mat­ics is the study of num­bers and other ideal ob­jects that can be de­scribed by ax­ioms.