# Number of 6-digit passwords, starting with even or ending with odd digit

My problem is

A password consists of six digits, each in $\{0,\ldots,9\}$ How many passwords start with an even digit or end with an odd digit?

the answer is $750,000.$

I would like to know how exactly do you get $750,000$ as the answer?

-
Hint: How many passwords do neither? –  Steve Kass Mar 8 '13 at 1:44

## 6 Answers

Your set of passwords can be decomposed into three disjoint sets:

1) $2k,*, *, *, *, 2l$

2) $2k,*, *, *, *, 2l+1$

3) $2k+1,*, *, *, *, 2l+1$

In each one of these sets, there are $$5\cdot10^4\cdot5$$ passwords.

-

First count the number of combinations that start and end with even digits. Using the fundamental theorem of combinatorics we know this is $5\times10\times10\times10\times10\times5$.

Now count the numbers which start with an odd digit and ends with an even digit. This is $5\times10\times10\times10\times10\times5$.

And finally the numbers that start with an even digit but end with an odd one. These are also $5\times10\times10\times10\times10\times5$.

Add them all up to get the answer is $3\times(5\times10\times10\times10\times10\times5)$ which is $3\times25\times10^4$ which is $750,000$.

-
I don't think the fundamental theorem of arithmetic is what is being used here. –  1015 Mar 8 '13 at 1:56
thanks, I meant the fundamental theorem of combinatorics. –  dREaM Mar 8 '13 at 2:08
Ah. I did not even know there was a fundamental theorem of combinatorics... Compared to its brothers in algebra, arithmetic and calculus, it looks pretty trivial. –  1015 Mar 8 '13 at 2:11
Well, I remember reading it in a book, I think it was cameron's, but I can't seem to find anyone calling it that now. Oh well. –  dREaM Mar 8 '13 at 2:14
Google can still find a trace: mathreference.com/cmb,intro.html. –  1015 Mar 8 '13 at 2:16

Hint: Count the total number of possible passwords (irregardless of starting/ending number), and then subtract the number of passwords that do not meet either condition: $$\text{(the total number of ALL possible passwords} = 10^6 = 1,000,000)$$ $${\Large \bf-} (\text{# of passwords with first digit odd AND last digit even} = 5\times 10^4\times 5 = 250,000)$$ $$= \text{ solution} = 750,000.$$

-

I want to say firstly that this is basically the same information as presented in the answers by Jorge and julien, and is based off of Steve Kass' comment, but I wanted to say it in a slightly different way/different details, in case someone needs this sort of explanation.

First, let's see how many possible passwords there are. Well, there are $6$ "slots," and there are $10$ possibilities for each slot. Thus, we have $10^6 = 1000000$ possible passwords.

Second, let's look at how many passwords are not acceptable. That is, they end in an even digit, and they start with an odd digit. This means there are $5$ possibilities for both the starting and ending digit; the first digit can be in $\{1, 3, 5, 7, 9\}$, and the last digit can be in $\{0, 2, 4, 6, 8\}$. The rest of the digits have $10$ possibilities. So, the number of not acceptable passwords is: $$5\cdot 10\cdot 10\cdot 10\cdot 10\cdot5=5^2\cdot 10^4 = 250000$$

Finally, we know that the number of acceptable passwords is the number of total passwords minus the number of unacceptable passwords. So, we have:

$$\text{acceptable passwords} = 1000000-250000 = 750000$$

-

I was hoping to see a simpler answer, but instead I guess I'll supply one.

There's a 50% chance of the password having an even first digit.
There's a 50% chance of the password having an odd last digit.

Therefore, there's a 25% chance of the password having neither, and a 75% chance of the password having one or the other.

So, for 6 digits, the answer is 750,000.

-

The passwords can start with an even digit or end with an odd digit. So there are three possible cases.

1. starting with an even digit & ending with an odd digit.(represented as 2i,,,*,*,2j+1)
2. starting with an even digit & ending with an even digit.(represented as 2i,,,*,*,2j)
3. starting with an odd digit & ending with a odd digit.(represented as 2i+1,,,*,*,2J+1)

for the 1st case , by the fundamental theorem , the number of possible value is 5*10*10*10*10*5=25*250000 (as the number is coming with replacement)

for the 2nd case , the answer would be same, 5*10*10*10*10*5=25*250000.

for the 3rd case , also the answer is ,in same way , 5*10*10*10*10*5=25*250000

so, the total answer is summing the 3 cases, 250000*3=750000. i.e. your answer.

-