The password is a 4-digit code. If numbers can be repeated, what is the probability of guessing correctly with one attempt.
2 Answers | Add Yours
Before I answer this question it will be worthwhile to clarify on some confusion that exists between some related terms - digits, letters or alphabets, signs, and characters. This confusion can be noticed also in the answer given above.
Digits refers to the numerals 1, 2, 3, 4, 5, 6, 7, 8, 9 and 0. Alphabets refer to letters in the alphabet. In English language these include the 26 letters in the alphabet. When it comes to passwords, there may be specific rules applicable relating to use of upper case and lower case alphabets. Signs refer to all other characters such as mathematical signs (like +, -), punctuation marks, or any other signs commonly used in writing. Characters is a word as a common name for digits, letters, and signs.
Thus when we say a four digit code, it would strictly mean that the code uses digits only. Thus this code could take any number from 0000 to 9999, This gives total of 10,000 different combinations. This is assuming that the code must contain minimum four characters. But if the code permits 1, 2, or 3 characters code also then number of different combinations possible are:
10000 + 1000 + 100 + 10 = 11,110
The probability of guessing a code correctly is equal to the inverse of the number of different possible codes. Thus if we take a four digit code (with less than 4 digits not permitted), the probability of guessing the code correctly in one attempt is
= 1/10000 = 0.0001
If we consider a code that permits use of alphabets or other characters also then the possible combination of a code having exactly 'n' characters or place is given by the formula:
Total code combination = m^n
Where m = number of different values or characters that each place in the code can assume. The values of m for some common type of codes are:
Numeric code (using only digits) - 10
Alphabetic code (using alphabets without distinguishing between upper and lower case) - 26
Alpha-numeric code (Using digits plus alphabets without distinguishing between upper and lower case) - 36
Generally there are no commonly accepted practice regarding the type and number of characters other than numbers and alphabets use in codes.
Assuming all the digits are different like a,b,c,d (where each of the alphabet could be one of the digits from 0 ,1,2,3,...9), the password has to be one of the possible ways of constructing a 4 digit number.
a) Number can be repeated:
Think of 4 consecutive blank places of a 4 digit number.
Each of the placesofthe 4 digit number could be filled in 4 ways irrespective of whether the number has already been chosen or not. Therefore, the total number of ways the 4 digit number could be constructed is 4^4. There must be one of these 4^4 nubers must be the password. So the required probability is 1/256
b) the number cannot be repeated. Of course, this isan inclusion case of (a) only.
There are 4 places in a 4 digit number.
We can chose a digit an have the choice of putting the digit at 4 places.
Having filled the first digit at a place, there are 3 places left out for the second digit.
Having filled the two digits , the remaing choice for the 3rd digit is one of the 2 remaining places.
The last and remaing digit has to be filled in the remaing one place.
Threfore, the total number ofnumber ways the digits could constructed is 4*3*2*1 = 4! = 24 ways. So the required probability in not repreating case is 1/24.
We’ve answered 333,869 questions. We can answer yours, too.Ask a question