Factorial and Combinatorics

Understand factorials and combinatorial formulas. Calculate permutations and combinations by expressing n! as a product chain in the math expression evaluator.

Number Theory

Detailed Explanation

Factorial Calculations

The factorial of a number n (written n!) is the product of all positive integers from 1 to n. While the evaluator does not have a built-in factorial function, you can express any specific factorial as a multiplication chain.

Computing Factorials

5! = 5 * 4 * 3 * 2 * 1 = 120
7! = 7 * 6 * 5 * 4 * 3 * 2 * 1 = 5040
10! = 10*9*8*7*6*5*4*3*2*1 = 3628800

Permutations

The number of ways to arrange r items from n items:

P(n,r) = n! / (n-r)!

Example: How many ways to arrange 3 items from 5?

P(5,3) = (5*4*3*2*1) / (2*1) = 120/2 = 60

Or more efficiently:

5 * 4 * 3 = 60

Combinations

The number of ways to choose r items from n (order does not matter):

C(n,r) = n! / (r! * (n-r)!)

Example: Choose 3 from 10:

(10*9*8) / (3*2*1) = 720/6 = 120

Stirling's Approximation

For large n, you can approximate n! using:

n! ~ sqrt(2*pi*n) * (n/e)^n

Example for n=10:

sqrt(2*pi*10) * (10/e)^10 = 3598695.6

(Actual 10! = 3628800, so the approximation is within 1%.)

Practical Applications

  • Probability: Card hands, dice combinations, lottery odds
  • Computer science: Algorithm complexity analysis
  • Statistics: Binomial coefficients for distributions

Use Case

A statistics student computing the number of possible committees or card hands using combinatorial formulas.

Try It — Math Expression Evaluator

Open full tool