

You could say that 1! equals 1, because it's the product of all the integers from 1 through 1.

Now you need to solve the subproblem of computing 3!, which is 3 ⋅ 2 ! 3 \cdot 2! 3 ⋅ 2 ! 3, dot, 2, !.Now you need to solve the subproblem of computing 4!, which you can compute as 4 ⋅ 3 4 \cdot 3 4 ⋅ 3 4, dot, 3 !.We say that computing ( n − 1 ) ! (n-1)! ( n − 1 ) ! left parenthesis, n, minus, 1, right parenthesis, ! is a subproblem that we solve to compute n n n n !. You can compute the factorial function on n n n n by first computing the factorial function on n − 1 n-1 n − 1 n, minus, 1. We said that you can compute n ! n! n ! n, ! by computing ( n − 1 ) ! (n-1)! ( n − 1 ) ! left parenthesis, n, minus, 1, right parenthesis, ! and then multiplying the result of computing ( n − 1 ) ! (n-1)! ( n − 1 ) ! left parenthesis, n, minus, 1, right parenthesis, ! by n n n n. Did you see what we just did? We wrote n ! n! n ! n, ! as a product in which one of the factors is ( n − 1 ) ! (n-1)! ( n − 1 ) ! left parenthesis, n, minus, 1, right parenthesis, !. But notice that ( n − 1 ) ⋯ 2 ⋅ 1 (n-1) \cdots 2 \cdot 1 ( n − 1 ) ⋯ 2 ⋅ 1 left parenthesis, n, minus, 1, right parenthesis, 2, dot, 1 is another way of writing ( n − 1 ) ! (n-1)! ( n − 1 ) ! left parenthesis, n, minus, 1, right parenthesis, !, and so we can say that n ! = n ⋅ ( n − 1 ) ! n! = n \cdot (n-1)! n ! = n ⋅ ( n − 1 ) ! n, !, equals, n, dot, left parenthesis, n, minus, 1, right parenthesis, !. For positive values of n n n n, let's write n ! n! n ! n, ! as we did before, as a product of numbers starting from n n n n and going down to 1: n ! n! n ! n, ! = n ⋅ ( n − 1 ) ⋯ 2 ⋅ 1 n \cdot (n-1) \cdots 2 \cdot 1 n ⋅ ( n − 1 ) ⋯ 2 ⋅ 1 n, dot, left parenthesis, n, minus, 1, right parenthesis, 2, dot, 1.
