How many 5 digit numbers contain the sequence “12”

combinatorics

Searched elsewhere to try to answer this but I'm still confused. Note that "12" can occur more than once, we just want numbers where it occurs at least once.

My best attempt (but I think I'm double counting):

$xx(10)(10)(10)$ OR $(10)xx(10)(10)$ OR $(10)(10)xx(10)$ OR $(10)(10)(10)xx$

"xx" means the two digit options are already filled (by "12"). So in total $4(10^3)$

Can someone walk me through how to think about this?

Best Answer

Guide:

Let $A$ denote the set of $5$-digit numbers of the form $12***$.

Let $B$ denote the set of $5$-digit numbers of the form $*12**$.

Let $C$ denote the set of $5$-digit numbers of the form $**12*$.

Let $D$ denote the set of $5$-digit numbers of the form $***12$.

Then to be found is $|A\cup B\cup C\cup D|$ and this can be done using the principle of inclusion/exclusion.