🔢 Factorial Calculator

Calculate n! (n factorial)

Understanding Factorials

A factorial is the product of all positive integers less than or equal to a given number. It is denoted by the symbol "!" after the number.

Factorial Notation

The factorial of n (written as n!) is calculated as:

  • n! = n × (n-1) × (n-2) × ... × 2 × 1
  • 0! = 1 (by definition)
  • 1! = 1

Examples

  • 5! = 5 × 4 × 3 × 2 × 1 = 120
  • 3! = 3 × 2 × 1 = 6
  • 10! = 3,628,800

Why is 0! = 1?

By mathematical convention, 0! is defined as 1. This definition makes many mathematical formulas work correctly, particularly in combinatorics and calculus. It represents the number of ways to arrange zero objects, which is exactly one way (do nothing).

Practical Applications

  • Permutations: The number of ways to arrange n objects is n!
  • Combinations: Used in the formula C(n,r) = n! / (r! × (n-r)!)
  • Probability: Calculating probabilities in various scenarios
  • Series Expansions: Used in Taylor and Maclaurin series
  • Algebra: Binomial theorem and polynomial expansions

Frequently Asked Questions

What is a factorial?

A factorial is the product of all positive integers from 1 to n. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120. It's used extensively in mathematics, particularly in permutations, combinations, and probability calculations.

Why is 0! equal to 1?

0! is defined as 1 by mathematical convention. This definition ensures consistency in mathematical formulas, especially in combinatorics. It represents the number of ways to arrange zero objects, which is one way (the empty arrangement).

How do I calculate factorials of large numbers?

Factorials grow extremely fast. This calculator can handle numbers up to 170, beyond which the result exceeds JavaScript's number limits. For very large factorials, the result is displayed in scientific notation (e.g., 1.2345e+100).

What is the factorial of a negative number?

Factorials are not defined for negative numbers in standard mathematics. The factorial function is only defined for non-negative integers (0, 1, 2, 3, ...). If you try to calculate a negative factorial, you'll receive an error message.

What are factorials used for?

Factorials are used in many areas: calculating permutations (arrangements), combinations (selections), probability theory, series expansions in calculus, and solving various mathematical problems. For example, the number of ways to arrange 5 books on a shelf is 5! = 120.

What is the relationship between factorials and permutations?

The number of permutations (arrangements) of n distinct objects is n!. For example, 3 objects can be arranged in 3! = 6 different ways. Partial permutations use the formula P(n,r) = n! / (n-r)!, which represents arranging r objects from n total objects.