Question 1189546
.
How many 9-digit codes can be formed if the code starts with 000 or ends with 1?
~~~~~~~~~~~~~~~~~~~~


<pre>
To solve the problem, we should calculate separately

    - the number of the 9-digit codes that start with 000;

    - the number of the 9-digit codes that end with 1;

    - and then calculate the number of the codes in the union of these two sub-sets.


(1)  The number of the 9-digit codes that start with 000 is {{{N[000]}}} = {{{10^6}}},

     since the first three digits are just pre-determined, and only 6 remaining positions 
     each may have any of 10 digits.


(2)  The number of the 9-digit codes that end with  is {{{N[1]}}} = {{{10^8}}},

     since the last digit is just pre-determined, and only 8 remaining positions 
     each may have any of 10 digits.


(3)  To complete the solution, apply the formula for the union

         {{{N[union]}}} = {{{N[000]}}} + {{{N[1]}}} - {{{N[intersection]}}}.


     {{{N[intersection]}}}  equals to  {{{10^5}}}, since the intersection is the set of all codes

     that have pre-determined 000 in the first 3 positions and 1 in the last position,
     having all 5 = 9-3-1 positions free for any of 10 digits.


     THEREFORE, the final formula and the final answer are

         {{{N[union]}}} = {{{10^6}}} + {{{10^8}}} - {{{10^5}}} = 1,000,000 + 100,000,000 - 100,000 = 100,900,000.


<A>ANSWER</U>.  There are  100,900,000  such codes.
</pre>

Solved.


----------------


In short form and for your better understanding: 


&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;add the numbers of codes of each type; then subtract the number of codes 

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;in the intersection, because otherwise you count them twice.