How many possible combinations in 8 character String?

430 Views Asked by At

Assume that we have $52$ characters; $26+26$ lowercase and uppercase letters.

We want to create passwords of eight characters long.

There are two conditions

  • The letter I (uppercase i) has to be included.
  • Characters may appear only once.

So, for instance "aaaaaaIaa" is illegal, however "aIbcdefgh" is OK.

My solution:

Since no character may be duplicated and the string must contain at least one I , we have the following basic forms:

I********

*I*******

**I******

***I*****

****I****

*****I***

******I**

********I

Then the possible combination would be $ 8*Perm_{7}(51) = 8* \frac{51!}{(51-7)!} $

Is that correct ?

3

There are 3 best solutions below

7
On

Your solution is correct.

Multiplying with $8$ is OK, and the "basic forms" are OK. The question remains: How many possibilities are there to place the $51$ remaining characters in to the $7$ remaining places.

The first place can filled with $51$ characters, the second can be filled with only $50$ characters, ..., and finally the seventh place can be filled with the remaining $45$ characters.

So, the total number is

$$8\times 51\times 50\times \cdots \times 45\approx 4.7\times 10^{12}.$$


EDIT

There have been tow approaches to the same problem.

Problem

There are $n$ different symbols and $k$ slots to place them ($k<n$).

One of the symbols (the obligatory symbol) has a special role: it has to be part of all the arrangements. The other condition is that one symbol may appears only once.

Approach 1

One can place the obligatory symbol first. It may appear in $k$ different slots. As a result the the remaining $n-1$ symbols will have to be placed in the remaining $k-1$ slots. So the solution is

$$k\times(n-1)(n-2)\cdots (n-k+1).$$

If $n=52$ and $k=8$ then the result is

$$8\times 51\times 50\times 49 \times \cdots 45\approx 4.7\times 10^{12}$$

Approach 2

First we select $k-1$ symbols out of the $n-1$ ones and then multiply the resulting number with the possible orderings of the $k$ symbols (the obligatory one + the $k-1$ ones chosen.) The total is

$$\binom {n-1}{k-1}k!.$$

In our case the result is again $\binom{51}7\times 8!\approx 4.7\times 10^{12}$.

5
On

Include 'I', select $7$ characters and them permute the $8$ letters. So,

Number of possible passwords
$=\dbinom{51}{7}\times 8!$


Proof: Take a small example. Suppose we have the letters (a,b,c,d) to select from and we are counting the possible arrangements of $3$ letters where c must be come in each arrangement.

According to the same principle used, $\dbinom{3}{2} \times 3!=18$ arrangements are possible. These are

abc,acb,bac,bca,cab,cba
acd,adc,cad,cda,dac,dca
bcd,bdc,cbd,cdb,dbc,dcb

Accoding to some other answers, it must be $\dbinom{3}{2} \times 3=9$ which is clearly not the right way of approaching this problem.

0
On

Yes you are correct.

Number of ways = $8 \times \frac{51!}{(51-7)!}$