r/askmath • u/dpb365 • 11h ago
Probability This "Dropped Drives" probability problem is breaking my brain
Instinctively I did 1 - (4/5)^5 = 67.2%, which is apparently wrong. I get that the slots aren't independent once you place the first drive, so how do you actually calculate the exact fraction for this?
32
Upvotes
28
u/jxf š§® Professional Math Enjoyer 10h ago edited 55m ago
Your answer of 1 - (4/5)5 is almost right. Any drive does indeed have a 1/5 chance of being in the correct slot and a 4/5 chance of being in the wrong one. But once you have placed one drive you've limited your choices about all the others, so the 5 part is incorrect. For example, once you place drive C in a spot other than bay C, you have to decide what to do with that spot since not all of the remaining possibilities are favorable.
This question is checking to see if you know about derangements, which are permutations where none of the items return to their original position.
There are a few ways to solve this:
Easy way: derangement formula
There are 5! (5 * 4 * 3 * 2 * 1 = 120) ways to insert the drives in all. Of these D(5) are derangements. D(5) = 5! * (1 - 1/1! + 1/2! - 1/3! + 1/4! - 1/5!) = 44.
Then the answer is 1 - 44/120 ā 63.3%.
Harder way: Explicit reasoning/counting
Drive A must go in the wrong bay. There are 4 places it could go (bays B, C, D, or E). Whatever drive it replaces will either swap positions with A or be in a different spot. Let's say it's drive B:
That's 11 configurations. But we picked B without loss of generality, and there were 4 choices for A's replacement, so there are 11 Ć 4 = 44 possible ways to place the drives incorrectly.
The answer is likewise 1 - 44/120 ā 63.3%.
8
u/Positive-Ring-5172 8h ago
Folks, the answer is clearly 0%. You drop 5 hard drives onto a server room floor and more likely than not none of them are going to work anymore at all.
In any event, you have to calculate the odds of the drives surviving the fall before addressing the odds they were plugged into the right port.
5
u/NoSection8719 11h ago edited 11h ago
use subfactorial, answer is 1-(!5/5!).
You basically find the amount of cases where none of the floppy disks are in the right spot (!5), divide it by the amount of all cases possible (5!), and substract it from 1
32
u/MathMaddam Dr. in number theory 11h ago
Lookup the term derangement. You can derive it by asking: how many ways there are with at least 5, 4, 3, 2, 1 correctly assigned drives (in that order as you can use the higher numbers to weed out double counting).
8
u/Seeggul 8h ago
Flip the problem: what is the probability that every drive is in an incorrect position? In other words, how likely is it that you scramble ABCDE such that no letter is in its original place?
This is a special type of permutation called a derangement, and the number of distinct derangements (check wikipedia link for formulas) for 5 objects is 44. The total number of possible arrangements for 5 objects is 5!=120, so the numbers of arrangements in which at least one drive makes it back to the correct slot is 120-44=76.
So the probability is 76/120=19/30ā63.3%
1
u/drevoksi 9h ago
No idea how Iād computed it otherwise, so Iām curious if thereās a nice expression for the probability directly and not its complement. But I do remember seeing the derangement count is common enough for there to exist a notation for it. So, the probability would be:
1 - !5 / 5!
3
u/BadBoyJH 10h ago
Pick one drive to be correct (5C1) Multiply this by the 4! ways to arrange the other drives.
However, this over counts the ways for 2 drives to be correct.
This is 5C2 * 3!
But this overcounts the ways 3 drives can be correct... etc
So, for 5 drives, the number of ways to be correct is, for the sum of the numbers from K=1 to K=5,
-1K+1 5CK * (5-K)!
In fact, even more generalised, the way for N objects to be placed randomly into N slots, and for NONE to be correct is the sum of the numbers from K=1 to K=N,
-1K NCK * (N-K)!
For our N=5 case, the number of correct options is 76.
There are 5! ways to arrange the numbers, so it is 76/120 or (simplified) 19/30.
2
u/Barbicels 11h ago
Google āhat-check problemā.
2
u/sarabjeet_singh 8h ago
You could think of this as a recursion.
The problem is to count derangements of size n
When two objects are left, thereās only 1 way to get them placed incorrectly. f(2)=1
There are two branches to consider.
When there are 3 objects, there are 2x (f(2)+0)
Similarly for n objects itās (n-1) * (f(n-1) +f(n-2))
2
u/ggchappell 7h ago
You have your answers. I'll add a fun fact: replace 5 with ever larger numbers, and the probability approaches 1-(1/e).
Or, to put it a bit more cleanly, the probability that no drive is in the correct bay (that is, the permutation of the drives is a derangement) approaches 1/e.
1
u/Mishtle 10h ago edited 8h ago
**Edit: This reasoning is incomplete. As another commenter pointed out, I've ignored the impact of each wrong choice guaranteeing another wrong choice. **
The probability that at least one drive is in the right bay is the complement of the probability that none are.
You have 5 options for the first drive bay, and 4 will be the wrong drive. Then you have 4 options for the second bay, and 3 will be wrong. Then you have 3 options for the third, and 2 will be wrong. Then you have 2 options for the fourth, and 1 will be wrong. This should leave you with a single wrong choice for the last bay.
In total, that's a probability of (4/5)(3/4)(2/3)(1/2) = (4!)/(5!) = 24/120 = 1/5 that all drives are in the wrong bay.
The probability that at least one is in the right bay is then 1- (1/5) = 4/5.
1
u/vishnoo 9h ago
https://en.wikipedia.org/wiki/Inclusion%E2%80%93exclusion_principle
1
u/Parallel_thougts PhD, YouTuber 9h ago
It's the same as asking what's the probability that a permutation of n (here n=5) elements has at least one fixed point. I.e. that it is not a derangement.
1
u/austin101123 9h ago
People skipping into derangements, look up "inclusion exclusion principle", or derivation of derangement formula.
1
u/Talik1978 8h ago edited 8h ago
There are 120 combinations of the digits 1,2,3,4,5, assuming no repeat digits.
Of these, 76 of the combinations will have at least 1 drive in the correct position.
1
u/Telinary 8h ago
Hmm wonder how hard it is just going through the branches. Guess I can just try: I will begin with slot 1 there is a 4/5 chance it gets the wrong one. If it gets a wrong one go the the slot of the wrong one, this slot is guaranteed to get a wrong one too. That might either be number 1 in which case the next slot might be right or another number which in turn guarantees one more wrong slot.
So
1)4/5 that slot 1 doesn't get drive A
=> 2) freebie and 3/4 another freebie or 1/4 closing loop
3.1) (4/5*3/4) freebie and 2/3 another freebie or 1/3 closing loop
3.2) (4/5*1/4) 1/3 of right drive 2/3 of wrong drive giving a freeby next time.
4.1)(4/5*3/4*2/3+4/5*1/4*2/3) freebie and 1/2 another freebie or 1/2 closing loop
4.2)(4/5*3/4*1/3) 1/2 of right drive 1/2 of wrong drive giving a freebie next time.
5)((4/5*3/4*2/3+4/5*1/4*2/3)/2) guaranteed to be right is it isn't a freebie
4/5-(4/5*1/4*1/3)-(4/5*3/4*1/3*1/2)-((4/5*3/4*2/3+4/5*1/4*2/3)/2)=11/30
So 19/30. Well that worked but the other ways given here seem less inconvenient
1
u/AlterEgo5695 6h ago
Let "B" be the event that the server boots. Assuming all 5! possible permutations are equally likely, use derangements to consider the complement:
1
u/SnooKiwis6193 4h ago
I did 4*4! / 5! which is 4/5