# How many words can we build in the length of 6, while '1' and '5' appear in the same amount?

How many words in the length of 6, we can build with the digits ${1,2,3,4,5,6,7,8}$, such that digit $'1'$ and digit $'5'$ appears in the same amount? (if $'5'$ appears twice, then $'1'$ will appear twice).

What I thought: separate into groups:

1. the two digits appears $0$ times, therefore $6$ remaining digits: $6^6$
2. Each digit appears once, choose location of first digit, choose location of second digit, and multiple by the other 4: $\binom{6}{1}\cdot\binom{5}{1}\cdot2\cdot 6^4$
3. Each digit appears twice, same as before:$\binom{6}{2}\cdot\binom{4}{2}\cdot2\cdot 6^2$
4. Each digit appears three times, same as before: $\binom{6}{3}\cdot\binom{3}{3}\cdot2$

Eventually sum it all up.

What do you think?

• Where does the factor of $2$ come from? – Joffan Nov 16 '17 at 9:52
• switching between places – sheldonzy Nov 16 '17 at 9:53
• What "switching between places"? Swapping where the $1$'s are and where the $5$'s are? You already took care of that with your two binomial coefficients. – Arthur Nov 16 '17 at 10:16

I do not think you should multiply by $2$. I will try to explain this for the last case, I think you will understand it for the rest of the cases.

In the last case, what you are saying seems to be the following:

We have six places, and three ones and fives. We choose three of these places in $\binom 63$ ways, and then decide which one of $5$ or $1$ should appear in these places, in two ways. The other number would go in the remaining places(that is, there is only $\binom 33 = 1$ choice for where these numbers would go). This gives $2\binom 63$ ways.

However, I claim that multiplication by $2$, is incorrect. I shall make this clear. To do this, we will follow your procedure, and construct, in two ways counted differently by your method, the same end result.

Let us first create six places: $$\_\ \_\ \_\ \_\ \_ \ \_$$ Choose three of these, which we "raise": $$\_ - - \_\ \_ -$$ Now, we choose a number between $1$ and $5$. Say we choose $5$, then put $5$ in the raised places and $1$ in the others: $$155115$$

Now, suppose that our initial choice of which to raise was the following: $$- \_ \ \_ - - \_$$ Out of the numbers $1$ and $5$, we chose $1$ to put in the raised places, and $5$ in the others: $$155115$$

And we have the same combination again.

Therefore, overcounting, precisely by two has occurred. Removing these twos from all the steps except the first gives you the correct answer, since everything else you have written is correct.

EDIT 1 : The fact that you considered the combinatorial coefficient in the starting, actually cancelled out the need of a two in the numerator.

EDIT 2 : For completeness, I add that the answer to the question, after cancelling out all the $2$s, is $88796$.