# Math buffs: A probability question for you.

Here goes:

You have three cabinets C1, C2, C3.

Each cabinet can hold up to 1000 widgets.

Speaking of which, you have a thousand widgets. Each widget is numbered. W1, W2, W3… etc

At any given point during the day, a cabinet can randomly lock itself to where you can not retrieve its contents for one hour.

Now, you are sitting in front of a computer screen. The computer randomly spits out widget numbers at you. When it does, you have to go to whatever cabinet that widget happens to be in and get it. If the cabinet happens to be locked, you’re screwed.

Given the information above, how best is it to distribute the widgets amongst the cabinets so that you have the least chance of getting screwed?

I’m inclined to say that it doesn’t matter. You could put them all in one cabinet and the probability of getting screwed would still be the same if you spread them out evenly.

My friend disagrees.

Can a cabinet only be locked once a day? Can only one cabinet be locked at a time?

MY WAG is the probability will be the product of:

1. Probability the widget is in that cabinet;
2. Probability that cabinet is locked.

And you’re asking us what the optimum way to manipulate 1 is; without giving us much detail about 2.

Thinking about it some more, I think you’re right, it doesn’t matter which cabinet the things are in. it only matters whether that particular cabinet is locked or not.

There is no limit as to how many times a day a cabinet can be locked. However, a cabinet is less likely to lock itself more than two or three times a day. The higher the number of locks per cabinet, the less likely it is to happen.

More than one cabinet can be locked at a time. But that is less likely too. The standard is usually just one cabinet at a time.

Interesting.

Here’s how I’m thinking about the cabinets locking:

There is a standard six-sided die in front of each cabinet. On the hour every hour, the die is rolled. If it’s a 1, then the associated cabinet is locked. If it’s anything other than a 1, the cabinet is not locked.

And it also helps me to think about it if the computer only asks for one widget per hour.

I believe you are right. Let’s say there were only three widgets. If you put them all in one cabinet, there’d be a 1 in 6 chance that they are all locked up for any particular hour. If you spread them out so that there is one in each cabinet, the odds that they are all locked up is high (i.e., 1 in 6x6x6), but there is still a 1 in 6 chance that any particular widget is locked up. Since the computer asks for a random widget, they may as well all be locked up if any of them are.

If the cabinets are equally likely to lock, then you should be indifferent between spreading the widgets out evenly and keeping them all in one cabinet. Otherwise, you should prefer to keep all the widgets in the cabinet that’s least likely to lock. You can’t make this any more precise without specifying a model.

If the “locked periods” of the three cabinets are equally long (in total over the course of a day, say), independent of each other, and independent of the times that you’re told to retrieve the widgets, then it doesn’t matter which cabinets you distribute the widgets into. The probability that you’ll be able to retrieve a given widget is just the probability that the cabinet containing that widget will be unlocked. This means that the probability that you’ll be able to retrieve all N widgets that you’re asked for will be (1 - p)[sup]N[/sup], where p is the fraction of the time that a cabinet is locked.

There are too many things you haven’t told us. In particular “you’re screwed” isn’t enough of an objective function. Does it mean that you want to minimize the probably of going a whole day with no lock-outs? Do you want to minimize the number of lock outs? How much less likely is the cabinet to lock itself two or three times in a day? How much less likely is it that two cabinets will be locked at the same time.

It’s pretty hard to do probability problems with no stated probabilities or joint distributions.

I think I’ll just put all of the widgets in a box on top of the first cabinet.

Sorry guys, one more variable I forgot to add:

There is no way the computer will go longer than an hour with out asking for a widget.

Which brings us to my friend’s point:

If I were to put ALL the widgets in one cabinet, whenever it locked there is a 100% chance that I’m going to get screwed.

I’m probably missing something but why can’t you divide all of the w’s among all of the cabinets?

Assume 10 w’s w0, w1 . . . w9

1/3 of w0 go C1, 1/3 to C2, 1/3 to C3, etc.

Doesn’t that solve the problem?

That’s what’s up for debate.

Sure we could divide them up evenly, but statistically, does that make my chances of “getting screwed” any less?

I guess it depends on how many of each you have, but I guess that’s observing the obvious so I’m not sure I understand the question.

Well, there is only one person in the equation.

Uh, OK. Since my suggestion implied that there was more than one of each type and you didn’t contradict that, my question was valid. You seem to think not. I don’t have a problem with that.

LOL wut?

I think what we have here is a failure to communicate. I have no idea what your on about sir.

I think you’re interpreting the problem to include multiples of each numbered widget. I read the OP to have only one of each numbered widget, so a set of 1000 looks like this:

w0, w1, … , w998, w999

There’s no way to split 1/3 of w0 to each cabinet since each numbered widget is unique and can be specifically requested. Under this interpretation and given that each cabinet is equally likely to be locked, I think you will be equally screwed in each situation.

Yes, this is right.

It sounds like you’re looking for the probability of getting through a day without “getting screwed” even once. If the computer will ask at least every hour, and if each cabinet will be locked at least once per day for an hour, then you are guaranteed to be screwed at least once per day if you put all the widgets in a single cabinet.

If you spread them out, you’ll have some chance of getting through a day without getting screwed. The expected number of screws per day won’t change, though.

Shakes: sorry about before. rough night. I should probably quit while I’m behind but that would be too easy.

My first response would really be to fuck the machines. Put all of the widgets in one cabinet and overide the lock. IOW, jumper it so that even when the door is open, it thinks that it’s closed. Then, when it tells you to go to another cabinet, you dutifuly go there and open the door like a good human, reach in, grab the imaginary widget close the door then get the actual widget from the other cabinet and go about your business.

When it tells you to go to the live cabinet, unjumper the lock so it thinks the door has been opened, grab the widget, re-jumper the lock, rinse, repeat as necessary. When the live cabinet happens to lock up, no big. The door is open anyway, just remember to go back at some point and pretend to “open” the door.

I’m sure you’ve thought of this already and things like rules and supervisors and what not have perhaps frowned on the idea.

I was wondering if the order of the widget requests are random. The locking of the cabinets may be random in terms of order, but duration and frequency has some loose parameters it seems.

If not, and each cabinet is equally likely to lock first each day, then doing a 1/3 split gives you 1/6th chance of being screwed first thing in the morning or 5/6ths of -(screwed). After that it will depend on the weightings I suppose.

If the same cabinet only relocks 1 time in 4, then I think you have to use Bayes theorem - which is actually pretty simple, but I’m much to fried to attempt that right now. If I’m on the right track though, someone should be along who can walk you through it in plain English with some very basic algebra.