Permutation Calculator
Permutations calculator (nPr) with solution and graphical visualization.

Permutation Calculator
Permutations calculator (nPr) with a solution. Computes the number of possible permutations and generates all the arrangements, whether with or without repetitions
What is a permutation?
A permutation is a selection of r items from a set of n items where the order we pick our items matters.
Examples of permutations
Permutations without repetitions
Let's say that we wanted to pick 2 balls out of a bag of 3 balls colored red (R), green (G) and purple (P)
How many unique permutations will we have if we cannot repeat balls?
6 different ways. Our options are: RG, GR, RP, PR, GP and PG.
We can show this mathematically using the permutations formula with n = 3 and r = 2
# permutations =  n!  =  3!  =  3!  = 6 
(nr)!  (32)!  1! 
We can see examples of this type in real life in the results of a running race (assuming that two people can't tie for the same place) as we clearly care if we come first and our competitor comes second or if it is the other way around.
Permutations with repetitions
Let's say that we wanted to pick 2 balls out of a bag of 3 balls colored red (R), green (G) and purple (P).
If each time we select a ball we place it back in the bag, how many unique permutations will we have?
9 different ways. Our options are: RR, RG, GR, RP, PR, GG, GP, PG and PP.
We can show this mathematically by using the permutations with repetitions formula with n = 3 and r = 2.
# permutations = n^{r} = 3^{2} = 9
We can see this in real life in the number of codes on a safe  we can repeat numbers if we want (and have a password such as 1111) and we care about the order of the numbers (so if 1234 opens the safe, 4321 will not).
Explaining the combinations and permutations formulas
How many ways do we have of ordering n balls?
If we have 3 balls colored red (R), green (G) and purple (P) then there are 6 different ways. We have 3 options for the first color, then 2 options for the second color and one choice for the last color. Therefore we have 3 * 2 * 1 different options or 3! For 4 balls, we have 4! different permutations available. For 5 balls we have 5! different options, etc. For n balls we have n! options.
Explaining the permutations formula
How many permutations are there for selecting 3 balls out of 5 balls without repetitions? We can select any of the 5 balls in the first pick, any of the 4 remaining in the second pick and any of the 3 remaining in the third pick. This is 5 * 4 * 3 which can be written as 5!/2! (which is n! / (n  r)! with n=5, r=3).
There is also an alternative way to pick a selection of 3 balls. Let's say we wanted to pick balls 123. Then we could go on to pick the remaining 2 balls too. This would give us the possible permutations 12345 and 12354. We can see that there are 2! (which is 2) different ways of selecting 5 balls if we want 123 to be the first 3 selections. Therefore, we can obtain then number of selections of 3 balls from 5 balls by dividing 5! (the total number of selections) by 2! (permutations in the list of 5! options which begin with 123, or any other 3 balls you may choose). . How many 5 ball permutations will it start? Well 2! because for this selection you have two balls left and they can be arranged in 2! different ways (as we saw above). Therefore to get the number of permutations of 3 balls selected from 5 balls we have to divide 5! by 2!.
Explaining the combinations formula
Each combination of 3 balls can represent 3! different permutations. Therefore, we can derive the combinations formula from the permutations formula by dividing the number of permutations (5! / 2!) by 3! to obtain 5! / (2! * 3!) = 10 different ways. This generalises to other combinations too and gives us the formula #combinations = n! / ((n  r)! * r!)
Explaining permutations with repetitions formula
If we again picked 3 out of 5 balls but with repetitions then we have 5 options for each selection, giving us 5 * 5 * 5 = 125 selections overall. The general formula is therefore #permutations = n^{r}.
Explaining combinations with repetitions formula
Let's see how many combinations there are for selecting 3 balls out of 5 (red (R), green (G), purple (P), turquoise (T) and yellow (Y)) with repetitions. You will notice that our trick from the normal combinations formula does not work. For example, if we look at the combination of two red balls and one green ball only has 3 possible permutations (RGG, GRG, GGR) instead of 3! = 6, since the green appears twice. Therefore we cannot just divide the number of permutations by 6! and be done. Instead we will use a nice representation to make our task easier. We can represent selections in a table so if we wanted to select 2 reds and a green ball we might note it as:
R  G  P  T  Y
OO  O   
Which can be written more compactly, by omitting the header and unnecessary spaces, as OOO
and selecting one green, one purple and one yellow ball can be written as:
R  G  P  T  Y
 O  O   O
which can be written more compactly as OOO
Finally, selecting 3 turquoise balls can be written in a table like this:
R  G  P  T  Y
    OOO
which can be written as OOO
Each string of 4 's and 3 O's corresponds to a selection and vice versa. Therefore the number of ways of selecting 3 balls out of 5 with repetition and where order matters is the same as the number of ways of writing strings from 4 's and 3 O's. To figure out how many of these there are, we can start from 7! and then see that we need to divide by 4! because we repeat strings 4! because of  repetition (since initially we treat the 4 's as separate symbols) and divide by 3! since we repeat strings 3! times because of O repetition. Therefore there are 7!/(4!3!) different combinations = (n + r  1)! / ((n  1)! * r!), which is the formula that we are after.
Combinations versus permutations, what's the difference?
The difference is whether we care about the order. With combinations, the order does not matter. If we had to pick a sports team then the order in which we pick players does not matter. If we do care about the order then we are choosing a permutation. If instead of a sports team we looked at the results of a running race then order becomes important. We do care if we come first and our main contender comes second or vice versa, even though these would be part of the same combination.
How to use the permutations calculator?
Order is important: defines whether you want to use the combinations (when it's not active) or the permutations (when it's active).
With repetitions: allows you to select combinations and permutations with repetitions (active) or without (inactive).
This is relevant both the combinations and the permutations.
Identical items: allows you to specify if your problem has some repetitions of items but not infinite replacement (active) or whether it does not (inactive). When it's active, you can fill in the number of repetitions for each item. Note that in this case the number of items textbox will represent the number of unique items.
The identical items switch is relevant both to the combinations and the permutations.
Permutations Formulas
nPr formula
Number of permutations without repetitions  = ^{n}P_{r}  

Permutations with
repetitions formula
Number of permutations with repetitions  = n^{r} 
Combinations Formulas
nCr formula
Number of combinations without repetitions  = ^{n}C_{r}  

Combinations with
repetitions formula
Number of combinations with repetitions 
