Professional Documents
Culture Documents
Stay safe, friends. Learn to code from home. Use our free 2,000 hour
curriculum.
Permuta on and
Combina on: The Difference
Explained with Formula
Examples
Alexander Arobelidze
The fascina on with the world of Mathema cs provides a great service in my journey of
becoming a successful developer. I am excited about the idea of helping others acquire
high quality resources.
Donate
Part 1: Permutations
Permutations Where Repetition is
Allowed
Imagine you got a new phone. As you start using this new phone, at
some point you will be asked to set up a password.
Since you may use the same digit again, the number of choices for
the second digit of our password will be 10 again! Thus, choosing
two of the password digits so far, the permuta ons are 10 mes
10, or 10 x 10 = 100 or 102.
The same thinking goes for the third digit of your password. You
get to choose from the same 10 choices again. This me you will
have 10 mes 10 mes 10, or 10 x 10 x 10 = 1,000 or 103
permuta ons.
At last, for the fourth digit of the password and the same 10 digits
to choose from, we end up with 10 mes 10 mes 10 mes 10, or
10 x 10 x 10 x 10 = 10,000 or 104 permuta ons.
But life isn't all about passwords with digits to choose from. What
if you have a birthday party and need to choose 5 colored balloons
from 20 different colors available?
Donate
Since you have 20 different colors to choose from and may choose
the same color again, forimage
eachofballoon
colored balloons
you have 20 choices. The
first balloon is 20, the second balloon is 20 mes 20, or 20 x 20 =
400 etc. For the fi h balloon you get 20 x 20 x 20 x 20 x 20 =
3,200,000 or 205 permuta ons.
Let's summarize with the general rule: when order ma ers and
repe on is allowed, if n is the number of things to choose from
(balloons, digits etc), and you choose r of them (5 balloons for the
party, 4 digits for the password, etc.), the number of permuta ons
will equal P = nr.
The first choice will have 8 possibili es. The second choice will
have 8 minus 1 equals 7 possibili es, then 6, followed by 5,
followed by 4, un l we have 1 planet le in the list.
Following the logic from the previous scenario, the total number of
permuta ons is: P = 8 x 7 x 6 x 5 x 4 x 3 x 2 x 1 = 40,320.
But why stop here? Why not apply our logic to come up with a
more general formula? To make the above nota on easy to
remember for any numbers of objects, we will use a trick. In a
frac on, mul plying both numerator and denominator by the same
number (except zero), does not affect that frac on. Thus:
P(n, r) = n! / (n - r)!
From here, the result from earlier example can be derived. There,
you arranged all 8 out of 8 available planets. Using the new
formula, P = 8! / (8 - 8)! = 8! / 0!. Since, factorial of zero is agreed
to equal 1, P = 8! / 1 = 8!. Or more generally:
P = n! / (n - n)! = n! / 0! = n!.
Pop quiz:
30
360
720
15
Submit
Part 2. Combinations
Combinations Without Repetition
To make the comparison more vivid, let's revisit our planet
selec on example. What if you want to know just which planets
are chosen and not their order of appearance?
There you had 6,720 dis nct ways of arranging 5 out of 8 planets.
But since the order of appearance does not ma er now, many of
these ways are redundant. They are the same to us.
How many groups do you have that are the same? If you choose r
planets per group, you get r! groups. For r = 5, you get r! = 5! = 120
groups.
Thus, to eliminate the unnecessary groups that are the same, you
divide the number of original 6,720 Permuta ons by 5!. The result
is 6,720 / 120 = 56.
And this assumes that order does not ma er and there are no
repe ons (that is – there is only one Jupiter to choose from).
360
15
30
720
Submit
Donate
What if we can have repe ons? What if, as in our earlier example,
we can choose more than one balloon of the same color? If the
number of balloons to choose from is n and we choose r of them
while allowing for same colors and disregarding the order of
arrangement, we will end up with (n + r - 1)! / (r!(n - 1)!)
Combina ons.
If you read this far, tweet to the author to show them you care.
Tweet a thanks
Our mission: to help people learn to code for free. We accomplish this by crea ng thousands of
videos, ar cles, and interac ve coding lessons - all freely available to the public. We also have
thousands of freeCodeCamp study groups around the world.
Dona ons to freeCodeCamp go toward our educa on ini a ves, and help pay for servers, services,
and staff.
Linux Tutorial
CSS Tutorial
jQuery Example
SQL Tutorial
CSS Example
React Example
Angular Tutorial
Bootstrap Example
WordPress Tutorial
PHP Example