# How many possible combinations in 8 character String?

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 ?

• Your question is not clear. Commented Jan 21, 2017 at 14:29
• How many passwords consisting of eight characters contain only upper- And lowercase letters, at least once the uppercase letter I and none Char multiple times? Commented Jan 21, 2017 at 14:36
• it need to be multiplied with 8! i think Commented Jan 21, 2017 at 14:59

## 3 Answers

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.

• It should be not 8! as we have to place I in any place and we have 8 ways. Not 8! Commented Jan 21, 2017 at 16:27
• @KanwaljitSingh, see my edit. I tried with a small example and I think my answer is right. Commented Jan 21, 2017 at 17:24
• @Kiran Yes, it's right. Commented Jan 21, 2017 at 21:57
• The difference is that you are using combination and I am using permutation. So both are right. Commented Jan 22, 2017 at 4:09
• To make it absolutely clear: $8! = 8\cdot7!$ and $8!\cdot\binom{51}{51-7} = 8!\cdot\frac{51!}{7!(51-7)!} = 8\cdot\frac{51!}{(51-7)!}$ Commented Jan 22, 2017 at 21:03

Yes you are correct.

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

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}$.

• sorry am i not correct ? Commented Jan 21, 2017 at 14:58
• My Result is the same is yours , Commented Jan 21, 2017 at 14:58
• $\frac{51!}{(51-7)!} = \frac{51!}{44!} = 51 50...45$ Commented Jan 21, 2017 at 15:00
• it is 8! and not 8 in my opinion Commented Jan 21, 2017 at 15:00
• why should it be 8! ? Commented Jan 21, 2017 at 15:02