[Math] possible numbers from given numbers using permutations and combinaitions

combinationspermutations

I know this may be trivial, But i searched google and stackexachange to find the solution or the method to find the solution.

The problem in hand is I am given a number say "12345" and I should find out all possible 5 digit numbers using 1,2,3,4,5 and only 5 digits not 4 or less digits. so we have 5! values here. But If i have repeated numbers like say "11234" or "11223" then how to solve it. If there is a 0 in the given numbers then initial 0 is in valid.

Any help in finding the formula for this please? (I have learnt some 12 years ago.. so dont recollect permutations and combinations exactly to solve it myself)

PS: My numbers will never range from (0-9) it will always the digits given in the original number

Best Answer

The number of different strings of length 5 from the alphabet $\{1,2,3,4,5\}$ is what you want to calculate. There are $5^5$ such strings, as each element of the string can be chosen in 5 different ways and you then apply the "rule of product".

However, you then mention that, "If there is a 0 in the given numbers then initial 0 is [invalid]." Now, this is not really the same question. You said you were given the alphabet $\{1,2,3,4,5\}$. If this is actually the case, you wouldn't have to worry about zeros. Then again, if you did have the alphabet $\{0,1,2,3,4,5\}$ instead, then you would have to deduct the strings of types "0xxxx","00xxx","000xx","0000x", and "00000" from $6^5$ which would be the total number of strings. I will let you figure out how many strings of type "0xxxx", etc. there are.

EDIT: The question is somewhat unclear but I notice, from the discussion in the comments above, that you are not looking for selections with repetition (?). In that case, I believe what you are looking for is a formula, also given by barak manos in the comments above, namely $\dfrac{5!}{2!2!1!}$ for "11223" for example.

To derive this, you have to realize that $5!$ is first how many ways we can permute five elements. Then, if you see the two '2':s as different, you can permute them in $2!$ ways, the '3':s in $2!$ ways, and the '1':s (trivially) in $1!$ way. The formula is then to divide the total number of permutations ($5!$ in your case) with the product of all the ways you can permute each set of elements that are "the same" (the '2':s and the '3':s in the example).

Ex. How many words can we create from "BANANA"? Answer: $\dfrac{6!}{3!2!}$ (omitting the $1!$).

Hopefully I have interpreted your question correctly, otherwise, please make it clearer.