SOLUTION: How many 9-digit codes can be formed if the code starts with 000 or ends with 1?

Algebra ->  Permutations -> SOLUTION: How many 9-digit codes can be formed if the code starts with 000 or ends with 1?      Log On


   



Question 1189546: How many 9-digit codes can be formed if the code starts with 000 or ends with 1?
Answer by ikleyn(52787) About Me  (Show Source):
You can put this solution on YOUR website!
.
How many 9-digit codes can be formed if the code starts with 000 or ends with 1?
~~~~~~~~~~~~~~~~~~~~

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%5B000%5D = 10%5E6,

     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%5B1%5D = 10%5E8,

     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%5Bunion%5D = N%5B000%5D + N%5B1%5D - N%5Bintersection%5D.


     N%5Bintersection%5D  equals to  10%5E5, 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%5Bunion%5D = 10%5E6 + 10%5E8 - 10%5E5 = 1,000,000 + 100,000,000 - 100,000 = 100,900,000.


ANSWER.  There are  100,900,000  such codes.

Solved.

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

In short form and for your better understanding:

        add the numbers of codes of each type; then subtract the number of codes
        in the intersection, because otherwise you count them twice.