Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

All right, sorry in advance if this exists on here already. What I'm after is figuring out all possible orders of a set.

So I have 2 items

1,2
2,1
=2

3 items

1,2,3
1,3,2
2,1,3
2,3,1
3,1,2
3,2,1
=6

I can't seem to find a correlation I can burn down to an equation.

Any ideas? Thanks.

share|improve this question
    
go nowhere --> en.wikipedia.org/wiki/Permutation –  jay-sun Feb 28 '13 at 21:46

5 Answers 5

up vote 5 down vote accepted

For computing the number of permutations of $n$ elements of a set, (distinct arrangements of elements of the set), there are $$n! = n(n-1)(n-2) \cdots 2 \cdot 1$$ possible combinations.

share|improve this answer
1  
So for $n = 2, 2! = 2 \times 1 = 2$ permutations. For $n = 3,$ there are $3! = 3\times 2 \times 1 = 6$ permutations. For n = 5, there are $5! = 5 \times 4\times 3\times 2 \times 1 = 120$ possible permutations of a set of size $5$. $n!$ reads $n$-factorial: see factorial –  amWhy Feb 28 '13 at 21:56
    
The logic makes sense when you consider that for a set of, say $4$ elements, there are $4$ choices for picking which element is first, then $3$ choices for picking which element is second, then only $2$ choices for picking which element is third, and we're stuck with only one option for the last element. So there are $4 \times 3 \times 2\times 1 = 4!$ possible unique combinations/permutations. –  amWhy Feb 28 '13 at 22:42

for $\emptyset$ with $0$ elements we have 1 permutation

for $\{1\}$ set with $1$ element we have $$1$$ permutation

for $\{1,2\}$ set with $2$ elements we have $$2=1\cdot2=2!$$ permutations

$12$

$21$

for $\{1,2,3\}$ set with $3$ elements we have $$6=1\cdot2\cdot3=3!$$ permutations

$123,132$

$213,231$

$312,321$

for $\{1,2,3,4\}$ set with $4$ elements we have $$24=1\cdot2\cdot3\cdot4=4!$$ permutations

$1234,1243,1324,1342,1423,1432$

$2134,2143,2314,2341,2413,2431$

$3124,3142,3214,3241,3412,3421$

$4123,4132,4213,4231,41312,4321$

Continuing this way we have that set with n elements has $$1\cdot 2\cdot3\cdot...\cdot n=n!$$ permutations

share|improve this answer
    
+1 long nice illustration Adi. :) –  Babak S. Mar 1 '13 at 6:37
    
+1 for getting 0! out of the way. –  Loki Clock Mar 2 '13 at 7:00

So you mean ordered combinations that use all the elements in every combination. Since a set can't contain the same element more than once, you're talking about the number of permutations of the set, which is n!, where n is the size of the set.

share|improve this answer
    
I'm sorry, I don't really know the lingo, I also am not sure what n! is. –  kelton52 Feb 28 '13 at 21:48
    
Sorry, fixed the definition of n. –  Loki Clock Feb 28 '13 at 21:49
    
So with a set of 2 2(2-1)(2-2)(2-2+1)=0? Do you just not add the last 2-2? –  kelton52 Feb 28 '13 at 21:54
    
You start from 1 and then multiply by 2, etc.. So you got 6 because 1*2*3=6. –  Loki Clock Feb 28 '13 at 22:34

The classroom thinking is : I have n boxes

How many elements can i can choose to put in the first box : $n$

How many elements can i can choose to put in the second box : $n - 1$ since i have put one in the first box.

And so on, so the total posibilities are $n \times n-1 \times \dots 1 = n!$, the factorial number.

share|improve this answer

$n! = n \cdot (n-1) \dots 1$

In C/C++:

int max = n ; //( 3 or 2 .. )
total = max;

while (max > 0){
     max --;
     total = total * max;
 }
share|improve this answer
    
Can you add one more ... in there? I can't quite see the pattern. –  kelton52 Feb 28 '13 at 21:50
    
I believe you can see it now since you are a developer –  Mr.Me Feb 28 '13 at 21:59
    
Heh, thanks. That does help. –  kelton52 Feb 28 '13 at 21:59
    
Well actually, wouldn't this be better? int setSize; int sampleSize; int result = setSize; for(int i=setSize;i>0;--i) { result = result * i; } result = result * ((setSize - sampleSize) + 1); –  kelton52 Feb 28 '13 at 22:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.