5
$\begingroup$

Question: How many sequences of five elements with repetition allowed can be created from elements of the set $\{1,2,3,4,5,6\}$ in which the last digit is equal to any of the previous digits?


My Answer: Let's use the inclusion-exclusion principle. First we need to know the number of all sequences, that is: $6^5$ since we're allowing repetition. Then let's define the sets for $k\in\{1,2,3,4,5,6\}$: $$ C_k = \{ \text{sequences with last digit equal k and previous digits different than k}\} $$ Clearly the sets $C_k$ are disjoint, since there is no sequence equal to another one with the last digits being different. Therefore, the answer is: $$ 6^5 - |C_1\cup C_2 \cup C_3 \cup C_4 \cup C_5 \cup C_6| = 6^5 - 6\cdot 5^4 $$


Is my answer correct? Any help is highly appreciated! Thanks!

$\endgroup$
  • 3
    $\begingroup$ Yes, this is perfect. $\endgroup$ – Don Thousand Oct 20 '18 at 1:05
  • $\begingroup$ @Rushabh Mehta thank you! $\endgroup$ – Bruno Reis Oct 20 '18 at 2:50
1
$\begingroup$

Yes this looks correct. Another method is to directly count the sequences where the last digit is equal to any other:

$6 - - - 6 \to 6^3$

$-\ 6 - -\ 6 \to 5\cdot 6^2$

$- - 6 - 6 \to 5^2\cdot 6$

$- - -\ 6\ 6 \to 5^3$

There are $6$ of the above sequences, one for each number in the set.

$6(6^3 + 5\cdot 6^2 + 5^2\cdot 6 + 5^3) = 4026$

$\endgroup$
  • $\begingroup$ Thats the direct method of doing it! It's a nice way too... Thanks for sharing it. $\endgroup$ – Bruno Reis Oct 20 '18 at 2:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.