{ webApps }

Permutation App


Permutation can be summed up by asking the question, how many different ways can we arrange a set when order does matter? So if we have the set {1,2}, then the arrangements are {1,2} and {2,1}. The formula is simple : n!/ (n-k)! , n being the number of elements in a set, and k is the length of the arrangements.

If this is all old news to you, skip the next example and give the app a try by clicking the button below.


try it

S = {

}

Here we have a set of three unique cards, how many permutations are there of length 3? Using the formula for the total number of permutations we get 6 (3!/0! = 6). A good way to approach this problem is to imagine 3 slots or placeholders. Three placeholders, since in our set of cards we have three elements. The reason why 3! gives us the total number of permutations is because for the first placeholder we have three cards we can pick from , for the second placeholder we only have 2 cards to pick from and for the last placeholder there is just one card left.(3 x 2 x 1 = 3! = 6). Hopefully that makes sense , if not give it another read


Let's solve this by deciding on cards for the first placeholder then find all arrangements of the second two placeholders. Setting the first placeholder to the 2 of Clubs, we get:

{

}

{

}

Now lets set the first placeholder to the Ace of Spades, and find all arrangements of the second 2 placeholders. We get:

{

}

{

}

Setting the first placeholder to the Jack of Spades, we get:

{

}

{

}

Add all the above arangments up and we have 6 total.

Word: Lenght:
run

Combination App


Much like permutation, combination also involves arranging things. However the difference is that unlike permutation, order does not matter. The formula for combination is: n! / (r!(n-r)!). n is the number of elements in a set, and r is the length, or the number of elements used in an arrangement.

To skip all this boring stuff and try some of your own examples, click below.


try it

Alrighty then, let's do a simple example with cards. we have a set s of three cards defined below:

S = {

}

We are going to find all combinations of length 2, or 3 choose 2. One way to solve this is to pay attention to the order of the set of cards and pair the first card with all cards that come after it in the set. Repeat this for all cards. So let's pair the first card with all cards that come after it:

{

}

{

}

Now , the same for the second card, pair the second card with all cards that come after it:

{

}

Can't go any further since we are at card 3 at this point, and that's the last card, there are no cards after it to pair with, however, we can do one thing, which is to do a sanity check. In our example we got 3 combinations of 2. Lets use the formula to see if that is correct. 3! / (2!(3-2)!) = 6/2 = 3 so yup, looks like we are good.

Word: Lenght:
run