How many possible combinations are there for a password with 10 characters? The password must have 10 characters, each of which can be a number, or an uppercase or lowercase letter, so there are 68 possibilities for any character. (I'm using the Finnish alphabet which has 29 letters)
The password must contain each of the following: at least one number, one lowercase letter and one uppercase letter. How many possibilities are there for such a password?
I have tried to solve it as per the following but I am not sure about the answer. My logic is that first I calculate the possibilities for the number and the amount of places it can be, and then do the same for the mandatory uppercase and lowercase letters and then for the remaining seven characters, just multiply the amount of character possibilities (68) seven times.
$$10\cdot\binom{10}{1}\cdot29\cdot\binom{9}{1}\cdot29\cdot\binom{8}{1}\cdot68^7=40709041893369446400\approx4{,}071\cdot10^{19}$$
 A: Have you heard of Inclusion-Exclusion?
Start with the full set.  $68^{10}$
Subtract those without numbers $58^{10}$, without lowercase $39^{10}$, and without uppercase $39^{10}$
Add back in (because you subtracted them twice) those without letters, those with neither numbers nor lowercase, and those with neither numbers nor uppercase.
A: If set of passwords that are missing lowercase is $N_L$, set of passwords that are missing uppercase is $N_U$ and set of passwords that are missing digits is $N_D$, then
$|N_L| = 39^{10} \:, \: |N_U| = 39^{10} \: , \: |N_D| = 58^{10}$
$ |N_L \cap N_U|= 10^{10} \:, \: |N_L \cap N_D|= 29^{10} \: , \: |N_U \cap N_D|= 29^{10}$
And clearly $|N_L \cap N_U \cap N_D| = 0$
Therefore number of passwords that are missing lowercase characters, uppercase characters or digits is given by,
$|N_L \cup N_U \cup N_D| = |N_L| + |N_U| + |N_D| - |N_L \cap N_U| - |N_L \cap N_D| - |N_U \cap N_D| + |N_L \cap N_U \cap N_D|$
$ = 39^{10} + 39^{10} + 58^{10} - 10^{10} - 29^{10} - 29^{10}$
Finally, the number of passwords that have at least one lower case, one uppercase and a digit is given by,
$ \ 68^{10} - |N_L \cup N_U \cup N_D|$
