How many $4$-digit numbers can be formed using digits $0,1,...6$ such that it contains the digits $3$ and $5$?

188 Views Asked by At

How many $4$-digit numbers can be formed using digits $0,1,...6$ such that it contains the digits $3$ and $5$?

My try:

All possible $4$-digit numbers $= 7 \cdot 7 \cdot 7 \cdot 6$

$4$-digits numbers NOT containing $3, 5 = 5 \cdot 5 \cdot 5 \cdot 4$

Answer= $7 \cdot 7 \cdot 7 \cdot 6-5 \cdot 5 \cdot 5 \cdot 4 =1558$

Is that OK ? If not, please explain my mistake.

Thank you.

3

There are 3 best solutions below

1
On BEST ANSWER

Your answer is incorrect, because the negation of the statement that the positive integers includes the digits $3$ and $5$ is that it does not contain the digit $3$ or does not contain the digit $5$. What you subtracted is the number of $4$-digit positive integers that contain neither the digit $3$ nor the digit $5$. However, numbers such as $3460$ and $2145$ are also inadmissible.

How many $4$-digit positive integers can be formed using the digits $0, 1, 2, 3, 4, 5, 6$ with repetition contain the digits $3$ and $5$?

If there were no restrictions, the thousands place could be filled in six ways (since $0$ is excluded) and each of the three remaining places could be filled in seven ways (assuming repetition of digits is permitted). Hence, there are a total of $$6 \cdot 7 \cdot 7 \cdot 7$$ four-digit positive integers that can be formed using the digits $0, 1, 2, 3, 4, 5, 6$ with repetition.

From these, we must subtract those that do not contain the digits $3$ and $5$. Numbers that do not contain the digits $3$ and $5$ do not contain the digit $3$ or do not contain the digit $5$.

How many four-digit postive integers formed from the digits $0, 1, 2, 3, 4, 5, 6$ with repetition do not contain the digit $3$?

There are five ways to fill the thousands place (since neither $0$ nor $3$ is permitted) and six ways to fill each of the remaining places (since $3$ is not permitted). Hence, there are $$5 \cdot 6 \cdot 6 \cdot 6$$ such numbers.

By symmetry, there are also $$5 \cdot 6 \cdot 6 \cdot 6$$ four-digit positive integers formed from the digits $0, 1, 2, 3, 4, 5, 6$ with repetition that do not contain the digit $5$.

However, if we subtract those numbers that do not contain the digit $3$ and those numbers that do not contain the digit $5$ from the total, we will have subtracted those numbers that contain neither the digit $3$ nor the digit $5$ twice. We only want to subtract them once, so we must add them to the total.

How many four-digit positive integers formed from the digits $0, 1, 2, 3, 4, 5, 6$ with repetition contain neither the digit $3$ nor the digit $5$?

There are four ways to fill the thousands place (since neither $0$ nor $3$ nor $5$ is permitted) and five ways to fill each of the remaining three places (since neither $3$ nor $5$ is permitted). Hence, there are $$4 \cdot 5 \cdot 5 \cdot 5$$ such numbers.

By the Inclusion-Exclusion Principle, the number of positive four-digit positive integers formed from the digits $0, 1, 2, 3, 4, 5, 6$ with repetition that contain the digits $3$ and $5$ is $$6 \cdot 7 \cdot 7 \cdot 7 - 2 \cdot 5 \cdot 6 \cdot 6 \cdot + 4 \cdot 5 \cdot 5 \cdot 5$$

More formally, let's follow the suggestion of Nicolas FRANCOIS made in the comments. Let the universal set, $U$, be the set of four-digit positive integers that may be formed from the digits $0, 1, 2, 3, 4, 5, 6$ with repetition; let $A$ be the event that such a four-digit positive integer includes the digit $3$; let $B$ be the event that such a four-digit positive integer includes the digit $5$. What we wish to calculate is $$|A \cap B| = |U| - |(A \cap B)^C| = |U| - |A^C \cup B^C| = |U| - (|A^C| + |B^C| - |A^C \cap B^C|)$$ What we showed above is that \begin{align*} |U| & = 6 \cdot 7 \cdot 7 \cdot 7\\ |A^C| & = 5 \cdot 6 \cdot 6 \cdot 6\\ |B^C| & = 5 \cdot 6 \cdot 6 \cdot 6\\ |A^C \cap B^C| & = 4 \cdot 5 \cdot 5 \cdot 5 \end{align*} which gives \begin{align*} |A \cap B| & = |U| - |(A \cap B)^C|\\ & = |U| - |A^C \cup B^C|\\ & = |U| - (|A^C| + |B^C| - |A^C \cap B^C|)\\ & = |U| - |A^C| - |B^C| + |A^C \cap B^C|\\ & = 6 \cdot 7 \cdot 7 \cdot 7 - 5 \cdot 6 \cdot 6 \cdot 6 - 5 \cdot 6 \cdot 6 \cdot 6 + 4 \cdot 5 \cdot 5 \cdot 5\\ & = 6 \cdot 7 \cdot 7 \cdot 7 - 2 \cdot 5 \cdot 6 \cdot 6\cdot 6 + 4 \cdot 5 \cdot 5 \cdot 5 \end{align*}

How many $4$-digit positive integers can be formed using the digits $0, 1, 2, 3, 4, 5, 6$ without repetition contain the digits $3$ and $5$?

In this problem, either $3$ or $5$ is the leading digit or neither is.

$3$ or $5$ is the leading digit:

  1. Choose which of them is the leading digit.
  2. Choose the place occupied by whichever number in the set $\{3, 5\}$ that has not been used as the leading digit.
  3. Now that $3$ and $5$ have been placed, choose which of the remaining numbers occupies the first open place.
  4. Choose which of the remaining numbers fills the final open place.

There are $$2 \cdot 3 \cdot 5 \cdot 4$$ such numbers.

Neither $3$ nor $5$ is the leading digit:

  1. Choose which of the other non-zero digits occupies the thousands place.
  2. Choose which of the remaining places is occupied by the digit $3$.
  3. Choose which of the remaining places is occupied by the digit $5$.
  4. Choose which of the remaining digits fills the remaining place.

There are $$4 \cdot 3 \cdot 2 \cdot 4$$ such numbers.

Since these cases are mutually exclusive and exhaustive, the answer is found by adding the results for the two cases.

0
On

You also need to subtract out the number of numbers that contain one or more $5$s but no $3$, as well as the number of numbers that contain one or more $3$s but no $5$.

Or, you can also just count directly:

  1. One $3$, one $5$, two something else
  2. One $3$, two $5$s, one something else
  3. Two $3$s, one $5$, one something else
  4. Three $3$s, one $5$
  5. Two $3$s, two $5$s
  6. One $3$, three $5$s
2
On

Since you only care about 4 states: contains neither, contains 3 not 5, contains 5 not 3, contains both; you can use a transition matrix:

$$\begin{bmatrix} 4 & 1 & 1 & 0 \end{bmatrix} \begin{bmatrix} 5 & 1 & 1 & 0 \\ 0 & 6 & 0 & 1 \\ 0 & 0 & 6 & 1 \\ 0 & 0 & 0 & 7 \end{bmatrix}^3 \begin{bmatrix} 0 \\ 0 \\ 0 \\ 1 \end{bmatrix}$$

This way, if you wanted to change it to "how many 55 digit numbers..." all you have to do is change the $3$ in the exponent to a $54$.

Interesting that if you diagonalize the matrix you the same expression as N.G.Taussig's answer: $6 \times 7^3 - 2 \times 5 \times 6^3 + 4 \times 5^3$