Putting Things in Order
Last timeOne Choice After Another
Apply the multiplication rule until the pile runs out and the factorial appears. It is the fastest growing count in ordinary use, and it is why some problems can never be solved by trying everything.
Five books go on a shelf. How many different shelves are possible?
This is the multiplication rule from the previous lesson with one new feature:
the options run out as you go.
| step | position | books still available | options here | running total |
|---|---|---|---|---|
| 1 | first | all five | 5 | 5 |
| 2 | second | the four not yet shelved | 4 | 20 |
| 3 | third | three left | 3 | 60 |
| 4 | fourth | two left | 2 | 120 |
| 5 | fifth | whatever remains | 1 | 120 |
| 6 | the answer | nothing left to place | 120 shelves |
- how many items are being arranged. All of them are placed and all of them are distinguishable
- read n factorial. The exclamation mark is notation for the product on the right and nothing more, which is worth insisting on because it is usually presented as a definition
- defined to be one. There is exactly one way to arrange nothing, namely the empty arrangement, and this is not a convention adopted for convenience but the count coming out right
- every whole number between the two ends, each appearing exactly once
How fast this grows
The factorial is the fastest growing count anybody meets in ordinary work, and
it is faster than exponential growth, which the previous course already
established as alarming.
The reason is visible in the construction. An exponential multiplies by the
same factor at every step. A factorial multiplies by a factor that itself
increases: going from ten items to eleven multiplies the count by eleven, and
going from twenty to twenty one multiplies it by twenty one. There is no fixed
base, so no exponential can keep up for long.
| n squared | two to the n | n factorial | how long to list them at | |
|---|---|---|---|---|
| n = 5 | 25.000000 | 32.000000 | 120.000000 | 0.000000 |
| n = 10 | 100.000000 | 1024.000000 | 3628800.000000 | 3.600000 |
| n = 13 | 169.000000 | 8192.000000 | 6227020800.000000 | 6227.000000 |
| n = 15 | 225.000000 | 32768.000000 | 1307674368000.000000 | 1307674.000000 |
| n = 20 | 400.000000 | 1048576.000000 | 2430000000000000000.000000 | 2430000000000.000000 |
| n = 25 | 625.000000 | 33554432.000000 | 1.55e+25 | 15500000000000000000.000000 |
The practical reading is a boundary rather than a formula. Around ten or eleven
items, trying every arrangement is free. Around thirteen it is a real
computation. Beyond about fifteen it is not a slow approach, it is not an
approach at all, and no faster machine changes that: a thousandfold speedup
buys about three more items. A problem whose only known method is checking all
arrangements of twenty things needs a different method, and recognising that
early is worth more than any amount of optimisation.
The lesson stops here
2 more paragraphs to go
You have read the opening. The rest of the argument, the problems that check whether it landed, and the lines worth keeping at the end all come with a plan.
The first lesson of every course in the library reads the whole way through, free, so you can see exactly what the rest of them are.
See the planThe contentsThis is the reading half
Starting the course gives you your own copy of it. Every idea on every page has problems standing under it, marked with a reason rather than a tick, and any sentence you do not believe can be opened and argued with. None of that can happen on a page nobody owns.
The contents