Discrete Math Problem - Probability and Counting
I am taking a discrete math course and I have a question and I need your help. I don't know if this is the right thing for this :)
It says:
Each user on a computer system has a password that is six to eight characters long, with each character being an uppercase letter or number. Each password must contain at least one digit. How many passwords are there?
The book solves this by adding the probabilities of having a password in six, seven, and eight characters. However, when he decides for the probability of six characters, he does so
P6 = 36 6 - 26 6
and does
P7 = 36 7 - 26 7
and
P8 = 36 8 - 26 8
and then add them all.
I understand the solution, but my question is, why doesn't it calculate, P6 = 10 * 36 5 and the same for P7 and P8, works? 10 for numbers and 36 for alphanumeric characters?
Also, if anyone could give me a different solution than the one in the book.
Many thanks:)
a source to share
I understand the solution, but my question is why doesn't it calculate, P6 = 10 * 36 ^ 5 and the same for P7 and P8, work? 10 for numbers and 36 for alphanumeric?
you guarantee there is a digit using 10,
but there is nothing to stop there from being a digit in other positions (36 choices)
why you should get all the ridges that have digits and subtract all those that don't. which leads to P6 = 36 ^ 6 - 26 ^ 6
If I think if there is an alternative solution I am revisiting this post but I don’t understand yet why you are not satisfied with the one provided, knowing why yours is not working
a source to share
If you do it like 36^5 * 10
, it means "take the first five positions and put some random letters / numbers in there and fill in the sixth (and only sixth) position with a digit" - but your digit could be in every position.
Consider this: if you set 5 letter / number places, then putting a number in the sixth place gives 10 possibilities (the sixth position can hold every number from 0 to 9), and if you put a number in front of letters, it gives 10 more possibilities (then the first place could contain every digit from 0 to 9), so multiplying by 10 you will forget some possibilities.
If you want to calculate the "raw path" you can do the following (I do this with six places, you can adapt it to 7 or 8). Since the password must contain at least one digit, it can contain 1, 2, 3, 4, 5 or 6 digits, respectively 5, 4, 3, 2, 1, or 0.
If you have k
numbers in only 6 places, you can 6 over k
select those places k
. Each of these spaces k
can be filled with a number, so you have 10^k
options for numbers and 26^(6-k)
options for letters.
So for numbers k
, you have options 10^k * 26^(6-k)
. Thus, since you can distribute the numbers k
in 6 over k
ways, you have
sum(k from 1 to 5: (6 over k) * 10^k * 26^(6-k)) = 36^6-26^6
generally.
a source to share