How many passwords can we create that contain at least one capital letter, a small letter and one digit? I have a problem in combinatorics.
How many passwords can we create such as:

*

*Each password has length $n$ when $n\ge3$.

*Each password must contain at least one capital letter (there are 26 letters in English), and at least one small letter, and at least one digit (there are 10 possible digits)

I tried solving this problem like this:
There are $62^{n}$ possible passwords without any restrictions
There are $2*26^{n}$ passwords with only capital letters or small letters.
There are $10^{n}$ passwords with only digits.
There are $52^{n}$ passwords with only capital letters and small letters.
There are $36^{n}-10^{n}-26^{n}$ passwords with only capital letters and digits.
There are $36^{n}-10^{n}-26^{n}$ passwords with only small letters and digits.
So to get the "right answer" I subtracted all of them from $62^{n}$ and got $62^{n}-52^{n}-2*36^{n}+10^{n}$
Is this the right method/answer? or did I miss something silly?
I am new to combinatorics and I want to make sure, I am on the right track.
Thanks in advance guys!
 A: $52^n$ passwords with only capital letters and small letters also count where you have only small letters or capital letters. Like in other cases, you should have subtracted $2 \times 26^n$ from it. That is the miss in your solution otherwise it is correct. Here is how I would do it -
If $A, B, C$ are sets of passwords where we have capital letters, small letters and numbers missing respectively,
$|A| = |B|= 36^n, |C| = 52^n$
$|A \cap B| = 10^n, |B \cap C| = 26^n, |A \cap C| = 26^n$
$|A \cap B \cap C| = 0$
$|A \cup B \cup C|$ will give you all arrangements where one or more of the three are missing.
$|A \cup B \cup C| = |A| + |B| + |C| - |A \cap B| - |B \cap C| - |A \cap C| + |A \cap B \cap C|$
So, $|A \cup B \cup C| = 2 \times 36^n + 52^n - 2 \times 26^n - 10^n$
Answer you are interested in $ = 62^n - |A \cup B \cup C| = 62^n - 52^n - 2 \times 36^n + 2 \times 26^n + 10^n$
A: Using Inclusion-exclusion principle, the answer is $62^{n}-52^{n}-2 \times 36^{n}+10^{n} + 2 \times 26^{n}$. Consider different cases and you will simply get the answer.
More precisely, first consider the passwords with no capital letter, then with no small letter and at last with no digit. Now, add the passwords with no capital letters and small letters (equivalently with only digits), then add passwords with no capital letters and no digits (equivalently with only small letters) and at last, add passwords with no small letters and no digits (equivalently with only capital letters).
