Probability and variance for digits in password

130 Views Asked by At

I have a task to calculate the probablity that in 12-character password, consisting of uppercase, lowercase letters and digits in range [0..9], exactly 4 characters are digits. I also have to find the variance of number of digits in password.

I solved first part, using formula for binomial r.v. and got $\binom{12}{4}\frac{10}{62}^4\frac{52}{62}^8 = 0.082$. Second part was solved with similar approach, using formula for variance for binomials: Var[X] = $12\frac{10}{62}\frac{52}{62} = 1.62$.

This result seems correct to me, but I decided to check how others solved it. I found that someone calculated the variance for this task using the sum of the variances of the individual characters as well as a different (I'm not sure which one) formula for the first part and now, since my answer is different from the one I saw, I am not 100% sure my solution is correct. I would be grateful for any advice or clarification on this matter.