Why multiply a smaller factorial by the input?
The factorial recurrence
Theo Brooks
For any positive whole number n, keep n outside and the remaining product is (n − 1)!.
Transcript
Let's open up 2 factorial and keep the 2 outside so you can see what the smaller call needs to supply.
See how writing 2 factorial as 2 times 1 lets you keep the 2 outside? That leaves the next number down, and since 2 minus 1 is 1, that's the only factor you still need. You can write that last factor as 1 factorial because its whole product is just 1. So 2 factorial equals 2 times 1 factorial, with the smaller factorial supplying just the 1, not the 2 you kept.
Now instead of starting with 2, pick any whole number greater than 1 and use n for that input. In n factorial, n is the largest factor, so that's the one you keep outside. Since you kept only the largest factor, the remaining factors start at n minus 1 and run all the way down to 1, each appearing just once. So you can write the remaining product as the factorial of n minus 1 because you've got every factor it needs.
Now take the smallest positive input: in 1 factorial, the only factor is 1. Keep that 1 outside and there's nothing left to multiply, so whatever stands beside it must leave it unchanged. Since 1 minus 1 is 0, what you multiply by here is 0 factorial. And 0 factorial is 1, so 1 times 0 factorial still equals 1 factorial.
So the split works for every positive whole number: n factorial equals n times the factorial of n minus 1. That's a recurrence because it tells you how to find one answer using the answer for a smaller input. The recurrence tells you exactly which smaller factorial to ask for. In the return statement, asking for the factorial of n minus 1 gives you the product of everything except the factor you kept. So multiply that answer by n and you've got the full product back, with nothing missing and nothing counted twice.