Your number must be odd, so the last digit must be one of $\{1, 3, 5, 7\}$ Now that we've got that dealt with, we can just consider the first three digits.
Our three digit number will be of three possible forms: $4 ? ?, ? 4 ?, ? ? 4$
Case 1: $4??$ - We have now used two digits (the four and whatever odd number we pick to be the last digit), so there are $6 * 5$ ways to pick the next two digits without replacement.
Case 2: $?4?$ - It's similar to the last case except for one fact: The leading digit cannot be $0$ (or else it would be a three digit number). So, there are $6 - 1 = 5$ ways to pick the first digit, and $5$ ways to pick the third. The same holds for $??4$, so that's $2 * 5 * 5$ counting both.
Finally, we have four possibilities for our last digit. To recap, in total we have $4(6*5 + 2*5*5) = 320$ ways to do this.
Problem to apply what you've learned from this post
How many even $5$ digit numbers can be formed from the digits $1$ through $9$ given that there must be a $7$? Note that the digits need not be distinct.
Suppose for example that you choose
last digit $4$, second-last digit $0$.
Then there are $6$ possible choices for the first digit, not $5$ as you claimed.
To solve the problem it's probably best to split into two cases:
- if the last digit is zero then there are $7$ possibilities for the first digit and $6$ for the second, total $42$;
- if the last digit is not zero then there are $3$ choices for the last digit, $6$ for the first and $6$ for the secong, total $108$.
Final total, $150$.
Best Answer
I would fill in the last number first and consider two cases: the last number is a $5$, and the last number is not a $5$.
Case 1: Last number is five.
This is the easy case, the remaining digits can be any distinct digits that are not $5$ (and do not begin with zero). This gives $8$ choices for the first number (not 5 and not 0), $8$ choices for the second number (not the first number, and not $5$) and $7$ choices for the third number (not the first two, and not $5$--the last). This gives $8\cdot 8\cdot 7=448 options.
Case 2: The last number is not five.
First, we will make sure the number is odd. To do that, the last digit must be either $1, 3, 5, 7,$ or $9$. Since it is not $5$, we have $4$ choices for the last digit. Now, let us fill in the first digit (since it cannot be zero). There are again $8$ choices for the first digit (not the last digit and not zero). There are again, $8$ choices for the second number and $7$ for the third (for exactly the same reasons as mentioned before). We now have $4\cdot 8\cdot 8\cdot 7=1792$ numbers. However some of these numbers didn't use a $5$. How many didn't use $5$? Let's count that and subtract. There are again $4$ choices for the last number (since $5$ wasn't an option there). Now there are only $7$ choices for the first number: not $5$, not $0$, and not the last digit. Similarly, there are $7$ choices for the second digit and $6$ choices for the third digit. Thus, there are $7\cdot 7\cdot 6\cdot 4=1176$ numbers that don't use $5$ at all. Thus we have $1792-1162=616$ good numbers.
Combining case 1 and case 2 gives us $448+616=1064$ four-digit, odd numbers with distinct digits and a $5$ occurring exactly once.