<s>[INST] How many $4$-digit numbers can be formed using digits $0,1,...6$ such that it contains the digits $3$ and $5$? 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. 
 [/INST] 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$
</s>