Permutations Calculator

Permutations Calculator

No (Standard Permutation) Yes (n^r)

Result


Understanding Permutations: Order Matters

In mathematics, a permutation is an arrangement of all or part of a set of objects, where the order of the arrangement is important. This differentiates permutations from combinations, where the order does not matter.

The Permutation Formulas

Depending on whether items can be reused (repetition), the mathematical approach changes:

  • Permutations without Repetition: Use this when each object can only be used once. The formula is:
    P(n, r) = n! / (n - r)!
  • Permutations with Repetition: Use this when items can be used multiple times (like a padlock code). The formula is:
    P(n, r) = n^r

Practical Examples

Example 1: Race Results (No Repetition)
Suppose there are 8 runners in a race. How many ways can we award Gold, Silver, and Bronze medals? Here, n = 8 and r = 3. Since one person cannot win two medals, repetition is not allowed.
P(8, 3) = 8! / (8-3)! = 8 × 7 × 6 = 336 ways.

Example 2: 4-Digit PIN (With Repetition)
How many 4-digit codes can be created using the numbers 0-9? Here, n = 10 and r = 4. Since digits can repeat (e.g., 1122), we use the repetition formula.
10^4 = 10,000 ways.

Frequently Asked Questions

What is the difference between a permutation and a combination?
The simplest way to remember is: Permutations = Position (order matters). Combinations = Choosing (order doesn't matter).
What does "n!" mean?
The exclamation mark denotes a "factorial." n! means you multiply n by every whole number below it down to 1 (e.g., 5! = 5 × 4 × 3 × 2 × 1 = 120).
function factorial(num) { if (num < 0) return -1; if (num === 0 || num === 1) return 1; var result = 1; for (var i = 2; i <= num; i++) { result *= i; } return result; } function calculatePermutations() { var n = parseInt(document.getElementById('totalItemsN').value); var r = parseInt(document.getElementById('sampleSizeR').value); var repetition = document.getElementById('repetitionSelect').value; var resultBox = document.getElementById('permResultBox'); var errorBox = document.getElementById('errorBox'); var output = document.getElementById('permOutput'); var formulaDisplay = document.getElementById('permFormula'); // Reset displays resultBox.style.display = 'none'; errorBox.style.display = 'none'; // Validation if (isNaN(n) || isNaN(r)) { errorBox.innerHTML = "Please enter valid numeric values for both n and r."; errorBox.style.display = 'block'; return; } if (n < 0 || r n) { errorBox.innerHTML = "Without repetition, 'r' cannot be greater than 'n'."; errorBox.style.display = 'block'; return; } var result = 0; if (repetition === 'yes') { result = Math.pow(n, r); formulaDisplay.innerHTML = "Formula Used: nr (" + n + "" + r + ")"; } else { // P(n, r) = n! / (n-r)! var nFact = factorial(n); var nrFact = factorial(n – r); // Check for infinity or extremely large numbers if (n > 170) { errorBox.innerHTML = "The number is too large to calculate accurately with factorials (Max n is 170)."; errorBox.style.display = 'block'; return; } result = nFact / nrFact; formulaDisplay.innerHTML = "Formula Used: n! / (n – r)! (" + n + "! / " + (n – r) + "!)"; } // Format result with commas output.innerHTML = result.toLocaleString(); resultBox.style.display = 'block'; }

Leave a Comment