How many numbers of 4 digits contains at least one "5"? How many numbers of $4$ digits contains at least one "$5$"?
My suggestion is:
First I count all the numbers of type 5xxx (where x can be a number between 0 and 9). There is 999.
Then I add all the numbers of type y5xx (where y can be 1, 2, 3, 4, 6, 7, 8, 9). There is 8*99
Then I add all the numbers of type yz5x (where z can be 0, 1, 2, 3, 4, 6, 7, 8, 9). There is 8*9*9
Then I add all the numbers of type yzz5. There is 8*9*9
Total: 999+8*99+8*9*9+8*9*9 = 3087
My problem is, I'm not sure if this is correct OR if there exist a smarter method.
 A: Hint: it's easier to count how many have no 5's.
A: HINT: Compute how many 4 digit numbers contain no 5, and subtract that from the total count of 4 digit numbers.
A: So as to give you an idea of how to do problems like this without doing your homework for you I will do a similar problem with a different answer. Maybe someone else will find it useful.
How many numbers with exactly four digits are there with at least one zero?
$9\cdot 10^3-9^4=9000-6561=2439$
Reason:
There are 9000 numbers with exactly 4 digits
(choices for each digit: 1 to 9,0 to 9,0 to 9,0 to 9)
There are 6561 numbers with 4 digits and no zeros
(choices for each digit: 1 to 9,1 to 9,1 to 9,1 to 9)
A: First I count all the numbers of type 5xxx (where x can be a number between 0 and 9). There are 10*10*10=1000. Let this be A.
Then I add all the numbers of type y5xx (where y can be 1, 2, 3, 4, 5, 6, 7, 8, 9). There are 9*10*10=900.  Let this be B.
Then I add all the numbers of type yz5x (where z can be 0, 1, 2, 3, 4, 5, 6, 7, 8, 9). There is 9*10*10.  Let this be C.
Then I add all the numbers of type yzz5. There is 9*10*10=900. Let this be D.
So P(A)=1000;
P(B)=900;
P(C)=900;
P(D)=900;
P(A ∩ B)=100; //all numbers of type 55xx (where x can be a number between 0 and 9).
P(A ∩ C)=100; //all numbers of type 5x5x(where x can be a number between 0 and 9).
P(A ∩ D)=100; //all numbers of type 5xx5(where x can be a number between 0 and 9).
P(B ∩ C)= 90; //all numbers of type y55x(where x can be a number between 0 and 9 and y can be a number between 1 and 9).
P(B ∩ D)=90; //all numbers of type y5x5(where x can be a number between 0 and 9 and y can be a number between 1 and 9).
P(C ∩ D)=90; //all numbers of type yx55(where x can be a number between 0 and 9 and y can be a number between 1 and 9).
P(A ∩ B ∩ C)=10; //all numbers of type 555x(where x can be a number between 0 and 9).
P(A ∩ B ∩ D)=10; //all numbers of type 55x5(where x can be a number between 0 and 9).
P(A ∩ C ∩ D)=10; //all numbers of type 5x55(where x can be a number between 0 and 9).
P(B ∩ C ∩ D)=9; //all numbers of type y555(where y can be a number between 1 and 9).
P(A ∩ B ∩ C ∩ D)=1; // this is 5555
so
P (A U B U C U D ) = P (A ) + P (B ) + P (C ) + P (D ) - P (A ∩ B ) - P (A ∩ C ) - P( A ∩ D )- P (B ∩ C ) - P ( B ∩ D ) - P (C ∩ D ) + P (A ∩ B ∩ C ) + P (A ∩ B ∩ D ) + P (A ∩ C ∩ D ) + P (B ∩ C ∩ D ) - P ( A ∩ B ∩ C ∩ D )
which numerically is
P (A U B U C U D ) = 1000 + 900 + 900 + 900 - 100 - 100 - 100 - 90 - 90 - 90
 + 10 + 10 + 10 + 9 - 1
=3168
A: There are totally 9000 four digit numbers(1000-9999) Out of this,let's see how many numbers have no 5's in it. There'll be 8*9*9*9=5832 such numbers.Subtract this from 9000.We get 3168.
A: Both ways:


*

*The complement of the count of numbers with no zero in the first position and no five is $9\cdot10\cdot10\cdot10-8\cdot9\cdot9\cdot9=\color{green}{3168}$.

*The count of numbers with one, two, three or four fives is


*

*either five in the first position, followed by anything: $10\cdot10\cdot10$ combinations;

*or not a five in the first position, i.e. $8$ times the count of three digits numbers containing one, two or three fives, 
$$\binom319^2+\binom329^1+\binom339^0=3\cdot81+3\cdot9+1=271.$$
$$1000+8\cdot271=\color{green}{3168}.$$
This is obtained by interleaving the fives with the other digits in all possible ways and letting the other digits take any of the remaining $9$ possibilities. ($271$ is also $10^3-9^3$.)
A: If first digit is 5 the rest can't be five
1*9*9*9
If the second digit is five the rest can't be five and the first can't be zero
8*1*9*9
If the third digit is five the rest can't be five and the first can't be zero
8*9*1*9
If the fourth digit is five the rest can't be five and the first can't be zero
8*9*9*1
So in conclusion,
(1*9*9*9) + (8*1*9*9) + (8*9*1*9) + (8*9*9*1) = 2673
