A probability question for matching socks in N bins
I thought of this problem while working on a separate problem trying to link records from two datasets. Suppose there are N bins, X red socks, and Y blue socks. Suppose we uniformly randomly throw the red socks and blue socks into the N bins. Two socks are considered a pair if they are in the same bin, one of them is red and one of them is blue. For example if there are 5 red socks and 8 blue socks in a bin, then that bin has 5 pairs of socks. What's the mean and variance of the number of pairs of socks we will find?
I ran a few simulations with N = 10 and 50, a fixed number of 100 blue socks, and varying the number of red socks from 10 to 200.
Graph with simulations
Thanks in advance for the help.
probability
New contributor
add a comment |
I thought of this problem while working on a separate problem trying to link records from two datasets. Suppose there are N bins, X red socks, and Y blue socks. Suppose we uniformly randomly throw the red socks and blue socks into the N bins. Two socks are considered a pair if they are in the same bin, one of them is red and one of them is blue. For example if there are 5 red socks and 8 blue socks in a bin, then that bin has 5 pairs of socks. What's the mean and variance of the number of pairs of socks we will find?
I ran a few simulations with N = 10 and 50, a fixed number of 100 blue socks, and varying the number of red socks from 10 to 200.
Graph with simulations
Thanks in advance for the help.
probability
New contributor
1
If a bin has $k$ red socks and $k$ blue socks, does that count as $k$ pairs or $k^2$? Your wording seems to allow a particular sock to be a member of more than one "pair."
– angryavian
Jan 4 at 21:09
Hi, that would count as k pairs. Thanks.
– user45264
Jan 4 at 21:12
add a comment |
I thought of this problem while working on a separate problem trying to link records from two datasets. Suppose there are N bins, X red socks, and Y blue socks. Suppose we uniformly randomly throw the red socks and blue socks into the N bins. Two socks are considered a pair if they are in the same bin, one of them is red and one of them is blue. For example if there are 5 red socks and 8 blue socks in a bin, then that bin has 5 pairs of socks. What's the mean and variance of the number of pairs of socks we will find?
I ran a few simulations with N = 10 and 50, a fixed number of 100 blue socks, and varying the number of red socks from 10 to 200.
Graph with simulations
Thanks in advance for the help.
probability
New contributor
I thought of this problem while working on a separate problem trying to link records from two datasets. Suppose there are N bins, X red socks, and Y blue socks. Suppose we uniformly randomly throw the red socks and blue socks into the N bins. Two socks are considered a pair if they are in the same bin, one of them is red and one of them is blue. For example if there are 5 red socks and 8 blue socks in a bin, then that bin has 5 pairs of socks. What's the mean and variance of the number of pairs of socks we will find?
I ran a few simulations with N = 10 and 50, a fixed number of 100 blue socks, and varying the number of red socks from 10 to 200.
Graph with simulations
Thanks in advance for the help.
probability
probability
New contributor
New contributor
edited Jan 4 at 21:13
user45264
New contributor
asked Jan 4 at 21:06
user45264user45264
62
62
New contributor
New contributor
1
If a bin has $k$ red socks and $k$ blue socks, does that count as $k$ pairs or $k^2$? Your wording seems to allow a particular sock to be a member of more than one "pair."
– angryavian
Jan 4 at 21:09
Hi, that would count as k pairs. Thanks.
– user45264
Jan 4 at 21:12
add a comment |
1
If a bin has $k$ red socks and $k$ blue socks, does that count as $k$ pairs or $k^2$? Your wording seems to allow a particular sock to be a member of more than one "pair."
– angryavian
Jan 4 at 21:09
Hi, that would count as k pairs. Thanks.
– user45264
Jan 4 at 21:12
1
1
If a bin has $k$ red socks and $k$ blue socks, does that count as $k$ pairs or $k^2$? Your wording seems to allow a particular sock to be a member of more than one "pair."
– angryavian
Jan 4 at 21:09
If a bin has $k$ red socks and $k$ blue socks, does that count as $k$ pairs or $k^2$? Your wording seems to allow a particular sock to be a member of more than one "pair."
– angryavian
Jan 4 at 21:09
Hi, that would count as k pairs. Thanks.
– user45264
Jan 4 at 21:12
Hi, that would count as k pairs. Thanks.
– user45264
Jan 4 at 21:12
add a comment |
1 Answer
1
active
oldest
votes
If $Z_i$ is the number of pairs in the $i$th bin then your random variable of interest is $sum_{i=1}^N Z_i$.
Then $$Eleft[sum_{i=1}^N Z_iright] = sum_{i=1}^N E [Z_i] = N E[Z_1]$$ since the $Z_i$ have the same distribution (one bin is not different from the other when throwing the socks).
The event ${Z_1 ge j}$ is equivalent to "there are at least $j$ red socks and at least $j$ blue socks in the first bin." Thus, by the tail sum formula for expectation,
$$E[Z_1] = sum_{j=1}^{min(X,Y)} P(Z_1 ge j) = sum_{j=1}^{min(X,Y)} sum_{m=j}^X binom{X}{m} frac{(N-1)^{X-m}}{N^X} sum_{l = j}^Y binom{Y}{m} frac{(N-1)^{Y-l}}{N^Y}.$$
I could not think of a way to simplify this, nor of a different route that would be simpler. Perhaps someone more savvy could help you further.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
user45264 is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3062112%2fa-probability-question-for-matching-socks-in-n-bins%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If $Z_i$ is the number of pairs in the $i$th bin then your random variable of interest is $sum_{i=1}^N Z_i$.
Then $$Eleft[sum_{i=1}^N Z_iright] = sum_{i=1}^N E [Z_i] = N E[Z_1]$$ since the $Z_i$ have the same distribution (one bin is not different from the other when throwing the socks).
The event ${Z_1 ge j}$ is equivalent to "there are at least $j$ red socks and at least $j$ blue socks in the first bin." Thus, by the tail sum formula for expectation,
$$E[Z_1] = sum_{j=1}^{min(X,Y)} P(Z_1 ge j) = sum_{j=1}^{min(X,Y)} sum_{m=j}^X binom{X}{m} frac{(N-1)^{X-m}}{N^X} sum_{l = j}^Y binom{Y}{m} frac{(N-1)^{Y-l}}{N^Y}.$$
I could not think of a way to simplify this, nor of a different route that would be simpler. Perhaps someone more savvy could help you further.
add a comment |
If $Z_i$ is the number of pairs in the $i$th bin then your random variable of interest is $sum_{i=1}^N Z_i$.
Then $$Eleft[sum_{i=1}^N Z_iright] = sum_{i=1}^N E [Z_i] = N E[Z_1]$$ since the $Z_i$ have the same distribution (one bin is not different from the other when throwing the socks).
The event ${Z_1 ge j}$ is equivalent to "there are at least $j$ red socks and at least $j$ blue socks in the first bin." Thus, by the tail sum formula for expectation,
$$E[Z_1] = sum_{j=1}^{min(X,Y)} P(Z_1 ge j) = sum_{j=1}^{min(X,Y)} sum_{m=j}^X binom{X}{m} frac{(N-1)^{X-m}}{N^X} sum_{l = j}^Y binom{Y}{m} frac{(N-1)^{Y-l}}{N^Y}.$$
I could not think of a way to simplify this, nor of a different route that would be simpler. Perhaps someone more savvy could help you further.
add a comment |
If $Z_i$ is the number of pairs in the $i$th bin then your random variable of interest is $sum_{i=1}^N Z_i$.
Then $$Eleft[sum_{i=1}^N Z_iright] = sum_{i=1}^N E [Z_i] = N E[Z_1]$$ since the $Z_i$ have the same distribution (one bin is not different from the other when throwing the socks).
The event ${Z_1 ge j}$ is equivalent to "there are at least $j$ red socks and at least $j$ blue socks in the first bin." Thus, by the tail sum formula for expectation,
$$E[Z_1] = sum_{j=1}^{min(X,Y)} P(Z_1 ge j) = sum_{j=1}^{min(X,Y)} sum_{m=j}^X binom{X}{m} frac{(N-1)^{X-m}}{N^X} sum_{l = j}^Y binom{Y}{m} frac{(N-1)^{Y-l}}{N^Y}.$$
I could not think of a way to simplify this, nor of a different route that would be simpler. Perhaps someone more savvy could help you further.
If $Z_i$ is the number of pairs in the $i$th bin then your random variable of interest is $sum_{i=1}^N Z_i$.
Then $$Eleft[sum_{i=1}^N Z_iright] = sum_{i=1}^N E [Z_i] = N E[Z_1]$$ since the $Z_i$ have the same distribution (one bin is not different from the other when throwing the socks).
The event ${Z_1 ge j}$ is equivalent to "there are at least $j$ red socks and at least $j$ blue socks in the first bin." Thus, by the tail sum formula for expectation,
$$E[Z_1] = sum_{j=1}^{min(X,Y)} P(Z_1 ge j) = sum_{j=1}^{min(X,Y)} sum_{m=j}^X binom{X}{m} frac{(N-1)^{X-m}}{N^X} sum_{l = j}^Y binom{Y}{m} frac{(N-1)^{Y-l}}{N^Y}.$$
I could not think of a way to simplify this, nor of a different route that would be simpler. Perhaps someone more savvy could help you further.
edited Jan 4 at 22:04
answered Jan 4 at 21:58
angryavianangryavian
39.4k23280
39.4k23280
add a comment |
add a comment |
user45264 is a new contributor. Be nice, and check out our Code of Conduct.
user45264 is a new contributor. Be nice, and check out our Code of Conduct.
user45264 is a new contributor. Be nice, and check out our Code of Conduct.
user45264 is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Mathematics Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3062112%2fa-probability-question-for-matching-socks-in-n-bins%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
If a bin has $k$ red socks and $k$ blue socks, does that count as $k$ pairs or $k^2$? Your wording seems to allow a particular sock to be a member of more than one "pair."
– angryavian
Jan 4 at 21:09
Hi, that would count as k pairs. Thanks.
– user45264
Jan 4 at 21:12