How many $4$-digit lock combinations are possible if each digit in the code may appear at most twice?
$begingroup$
Question
A lock combination code is made up of $4$ numbers ($0-9$). Each number can occur at most twice, e.g. $4764$ would be allowed but not $4464$ as the number $4$ has occurred more than $2$ times.Therefore, how many possible combination codes are there?
I know that there are $10,000$ possible combinations if repetitions are allowed. However I'm unsure as to how to answer the question. Any help is greatly appreciated, thanks!
combinatorics discrete-mathematics permutations
$endgroup$
add a comment |
$begingroup$
Question
A lock combination code is made up of $4$ numbers ($0-9$). Each number can occur at most twice, e.g. $4764$ would be allowed but not $4464$ as the number $4$ has occurred more than $2$ times.Therefore, how many possible combination codes are there?
I know that there are $10,000$ possible combinations if repetitions are allowed. However I'm unsure as to how to answer the question. Any help is greatly appreciated, thanks!
combinatorics discrete-mathematics permutations
$endgroup$
$begingroup$
What does "Each number can occur two times mostly." mean? Do you mean a number can occur $0,1$ or $2$ times?
$endgroup$
– lulu
Dec 14 '18 at 0:27
$begingroup$
@lulu For example '4764' would be allowed but not '4464' as the number '4' has occurred more than 2 times.
$endgroup$
– Jasmine078
Dec 14 '18 at 0:31
$begingroup$
Got it. I think, then, you meant to say "Each number can occur at most two times."
$endgroup$
– lulu
Dec 14 '18 at 0:32
2
$begingroup$
As a hint: break it into three cases. Case I: no number repeats. Case 2: exactly one number repeats. Case 3: two numbers repeat (as in $3443$).
$endgroup$
– lulu
Dec 14 '18 at 0:32
2
$begingroup$
The complement method may be quicker than finding it straight up: find the number of ways you have $3$ digits the same and $4$ digits the same and subtract from $10000$
$endgroup$
– WaveX
Dec 14 '18 at 0:33
add a comment |
$begingroup$
Question
A lock combination code is made up of $4$ numbers ($0-9$). Each number can occur at most twice, e.g. $4764$ would be allowed but not $4464$ as the number $4$ has occurred more than $2$ times.Therefore, how many possible combination codes are there?
I know that there are $10,000$ possible combinations if repetitions are allowed. However I'm unsure as to how to answer the question. Any help is greatly appreciated, thanks!
combinatorics discrete-mathematics permutations
$endgroup$
Question
A lock combination code is made up of $4$ numbers ($0-9$). Each number can occur at most twice, e.g. $4764$ would be allowed but not $4464$ as the number $4$ has occurred more than $2$ times.Therefore, how many possible combination codes are there?
I know that there are $10,000$ possible combinations if repetitions are allowed. However I'm unsure as to how to answer the question. Any help is greatly appreciated, thanks!
combinatorics discrete-mathematics permutations
combinatorics discrete-mathematics permutations
edited Dec 14 '18 at 9:22
N. F. Taussig
43.7k93355
43.7k93355
asked Dec 14 '18 at 0:26
Jasmine078Jasmine078
123
123
$begingroup$
What does "Each number can occur two times mostly." mean? Do you mean a number can occur $0,1$ or $2$ times?
$endgroup$
– lulu
Dec 14 '18 at 0:27
$begingroup$
@lulu For example '4764' would be allowed but not '4464' as the number '4' has occurred more than 2 times.
$endgroup$
– Jasmine078
Dec 14 '18 at 0:31
$begingroup$
Got it. I think, then, you meant to say "Each number can occur at most two times."
$endgroup$
– lulu
Dec 14 '18 at 0:32
2
$begingroup$
As a hint: break it into three cases. Case I: no number repeats. Case 2: exactly one number repeats. Case 3: two numbers repeat (as in $3443$).
$endgroup$
– lulu
Dec 14 '18 at 0:32
2
$begingroup$
The complement method may be quicker than finding it straight up: find the number of ways you have $3$ digits the same and $4$ digits the same and subtract from $10000$
$endgroup$
– WaveX
Dec 14 '18 at 0:33
add a comment |
$begingroup$
What does "Each number can occur two times mostly." mean? Do you mean a number can occur $0,1$ or $2$ times?
$endgroup$
– lulu
Dec 14 '18 at 0:27
$begingroup$
@lulu For example '4764' would be allowed but not '4464' as the number '4' has occurred more than 2 times.
$endgroup$
– Jasmine078
Dec 14 '18 at 0:31
$begingroup$
Got it. I think, then, you meant to say "Each number can occur at most two times."
$endgroup$
– lulu
Dec 14 '18 at 0:32
2
$begingroup$
As a hint: break it into three cases. Case I: no number repeats. Case 2: exactly one number repeats. Case 3: two numbers repeat (as in $3443$).
$endgroup$
– lulu
Dec 14 '18 at 0:32
2
$begingroup$
The complement method may be quicker than finding it straight up: find the number of ways you have $3$ digits the same and $4$ digits the same and subtract from $10000$
$endgroup$
– WaveX
Dec 14 '18 at 0:33
$begingroup$
What does "Each number can occur two times mostly." mean? Do you mean a number can occur $0,1$ or $2$ times?
$endgroup$
– lulu
Dec 14 '18 at 0:27
$begingroup$
What does "Each number can occur two times mostly." mean? Do you mean a number can occur $0,1$ or $2$ times?
$endgroup$
– lulu
Dec 14 '18 at 0:27
$begingroup$
@lulu For example '4764' would be allowed but not '4464' as the number '4' has occurred more than 2 times.
$endgroup$
– Jasmine078
Dec 14 '18 at 0:31
$begingroup$
@lulu For example '4764' would be allowed but not '4464' as the number '4' has occurred more than 2 times.
$endgroup$
– Jasmine078
Dec 14 '18 at 0:31
$begingroup$
Got it. I think, then, you meant to say "Each number can occur at most two times."
$endgroup$
– lulu
Dec 14 '18 at 0:32
$begingroup$
Got it. I think, then, you meant to say "Each number can occur at most two times."
$endgroup$
– lulu
Dec 14 '18 at 0:32
2
2
$begingroup$
As a hint: break it into three cases. Case I: no number repeats. Case 2: exactly one number repeats. Case 3: two numbers repeat (as in $3443$).
$endgroup$
– lulu
Dec 14 '18 at 0:32
$begingroup$
As a hint: break it into three cases. Case I: no number repeats. Case 2: exactly one number repeats. Case 3: two numbers repeat (as in $3443$).
$endgroup$
– lulu
Dec 14 '18 at 0:32
2
2
$begingroup$
The complement method may be quicker than finding it straight up: find the number of ways you have $3$ digits the same and $4$ digits the same and subtract from $10000$
$endgroup$
– WaveX
Dec 14 '18 at 0:33
$begingroup$
The complement method may be quicker than finding it straight up: find the number of ways you have $3$ digits the same and $4$ digits the same and subtract from $10000$
$endgroup$
– WaveX
Dec 14 '18 at 0:33
add a comment |
2 Answers
2
active
oldest
votes
$begingroup$
Here is a possible solution using the Principle of Inclusion/Exclusion:
$textbf{Case 1}$ (digit is repeated $3$ times):
Choose the repeated digit in $10 choose 1$ ways.
Choose the remaining digit in $9 choose 1$ ways.
Order the digits in $frac{4!}{3!} = 4$ ways.
$textbf{Case 2}$ (digit is repeated $4$ times):
Choose the repeated digit in $10 choose 1$ ways.
Order the digits in $frac{4!}{4!} = 1$ way.
So the number of combinations that don't satisfy your constraint is $(10 * 9 * 4) + (10 * 1) = 370$. Subtracting these from the $10,000$ total combinations yields $textbf{9,630}$ ways.
$endgroup$
add a comment |
$begingroup$
Solution without using the Principle of Inclusion/Exclusion:
Add by number of pairs of numbers: $0$ pairs $+$ $1$ pair $+$ $2$ pairs
$=$ (pick $4$ of the $10$ order matters) $+$
(pick which will be repeated and where and the other $2$ numbers order matters) $+$
(pick number for each pair and location of first and second pair)
$=P(10,4) + 10*{{4}choose{2}}*P(9,2) + {{10}choose{2}}*{{4}choose{2}}*1$
$=5040$ $+$ $4320$ $+$ $290$
$= 9630$
$endgroup$
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
});
}
});
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%2f3038773%2fhow-many-4-digit-lock-combinations-are-possible-if-each-digit-in-the-code-may%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Here is a possible solution using the Principle of Inclusion/Exclusion:
$textbf{Case 1}$ (digit is repeated $3$ times):
Choose the repeated digit in $10 choose 1$ ways.
Choose the remaining digit in $9 choose 1$ ways.
Order the digits in $frac{4!}{3!} = 4$ ways.
$textbf{Case 2}$ (digit is repeated $4$ times):
Choose the repeated digit in $10 choose 1$ ways.
Order the digits in $frac{4!}{4!} = 1$ way.
So the number of combinations that don't satisfy your constraint is $(10 * 9 * 4) + (10 * 1) = 370$. Subtracting these from the $10,000$ total combinations yields $textbf{9,630}$ ways.
$endgroup$
add a comment |
$begingroup$
Here is a possible solution using the Principle of Inclusion/Exclusion:
$textbf{Case 1}$ (digit is repeated $3$ times):
Choose the repeated digit in $10 choose 1$ ways.
Choose the remaining digit in $9 choose 1$ ways.
Order the digits in $frac{4!}{3!} = 4$ ways.
$textbf{Case 2}$ (digit is repeated $4$ times):
Choose the repeated digit in $10 choose 1$ ways.
Order the digits in $frac{4!}{4!} = 1$ way.
So the number of combinations that don't satisfy your constraint is $(10 * 9 * 4) + (10 * 1) = 370$. Subtracting these from the $10,000$ total combinations yields $textbf{9,630}$ ways.
$endgroup$
add a comment |
$begingroup$
Here is a possible solution using the Principle of Inclusion/Exclusion:
$textbf{Case 1}$ (digit is repeated $3$ times):
Choose the repeated digit in $10 choose 1$ ways.
Choose the remaining digit in $9 choose 1$ ways.
Order the digits in $frac{4!}{3!} = 4$ ways.
$textbf{Case 2}$ (digit is repeated $4$ times):
Choose the repeated digit in $10 choose 1$ ways.
Order the digits in $frac{4!}{4!} = 1$ way.
So the number of combinations that don't satisfy your constraint is $(10 * 9 * 4) + (10 * 1) = 370$. Subtracting these from the $10,000$ total combinations yields $textbf{9,630}$ ways.
$endgroup$
Here is a possible solution using the Principle of Inclusion/Exclusion:
$textbf{Case 1}$ (digit is repeated $3$ times):
Choose the repeated digit in $10 choose 1$ ways.
Choose the remaining digit in $9 choose 1$ ways.
Order the digits in $frac{4!}{3!} = 4$ ways.
$textbf{Case 2}$ (digit is repeated $4$ times):
Choose the repeated digit in $10 choose 1$ ways.
Order the digits in $frac{4!}{4!} = 1$ way.
So the number of combinations that don't satisfy your constraint is $(10 * 9 * 4) + (10 * 1) = 370$. Subtracting these from the $10,000$ total combinations yields $textbf{9,630}$ ways.
edited Dec 14 '18 at 1:19
answered Dec 14 '18 at 0:51
wjmcalliwjmcalli
5115
5115
add a comment |
add a comment |
$begingroup$
Solution without using the Principle of Inclusion/Exclusion:
Add by number of pairs of numbers: $0$ pairs $+$ $1$ pair $+$ $2$ pairs
$=$ (pick $4$ of the $10$ order matters) $+$
(pick which will be repeated and where and the other $2$ numbers order matters) $+$
(pick number for each pair and location of first and second pair)
$=P(10,4) + 10*{{4}choose{2}}*P(9,2) + {{10}choose{2}}*{{4}choose{2}}*1$
$=5040$ $+$ $4320$ $+$ $290$
$= 9630$
$endgroup$
add a comment |
$begingroup$
Solution without using the Principle of Inclusion/Exclusion:
Add by number of pairs of numbers: $0$ pairs $+$ $1$ pair $+$ $2$ pairs
$=$ (pick $4$ of the $10$ order matters) $+$
(pick which will be repeated and where and the other $2$ numbers order matters) $+$
(pick number for each pair and location of first and second pair)
$=P(10,4) + 10*{{4}choose{2}}*P(9,2) + {{10}choose{2}}*{{4}choose{2}}*1$
$=5040$ $+$ $4320$ $+$ $290$
$= 9630$
$endgroup$
add a comment |
$begingroup$
Solution without using the Principle of Inclusion/Exclusion:
Add by number of pairs of numbers: $0$ pairs $+$ $1$ pair $+$ $2$ pairs
$=$ (pick $4$ of the $10$ order matters) $+$
(pick which will be repeated and where and the other $2$ numbers order matters) $+$
(pick number for each pair and location of first and second pair)
$=P(10,4) + 10*{{4}choose{2}}*P(9,2) + {{10}choose{2}}*{{4}choose{2}}*1$
$=5040$ $+$ $4320$ $+$ $290$
$= 9630$
$endgroup$
Solution without using the Principle of Inclusion/Exclusion:
Add by number of pairs of numbers: $0$ pairs $+$ $1$ pair $+$ $2$ pairs
$=$ (pick $4$ of the $10$ order matters) $+$
(pick which will be repeated and where and the other $2$ numbers order matters) $+$
(pick number for each pair and location of first and second pair)
$=P(10,4) + 10*{{4}choose{2}}*P(9,2) + {{10}choose{2}}*{{4}choose{2}}*1$
$=5040$ $+$ $4320$ $+$ $290$
$= 9630$
answered Dec 15 '18 at 17:37
miniparserminiparser
7671616
7671616
add a comment |
add a comment |
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%2f3038773%2fhow-many-4-digit-lock-combinations-are-possible-if-each-digit-in-the-code-may%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
$begingroup$
What does "Each number can occur two times mostly." mean? Do you mean a number can occur $0,1$ or $2$ times?
$endgroup$
– lulu
Dec 14 '18 at 0:27
$begingroup$
@lulu For example '4764' would be allowed but not '4464' as the number '4' has occurred more than 2 times.
$endgroup$
– Jasmine078
Dec 14 '18 at 0:31
$begingroup$
Got it. I think, then, you meant to say "Each number can occur at most two times."
$endgroup$
– lulu
Dec 14 '18 at 0:32
2
$begingroup$
As a hint: break it into three cases. Case I: no number repeats. Case 2: exactly one number repeats. Case 3: two numbers repeat (as in $3443$).
$endgroup$
– lulu
Dec 14 '18 at 0:32
2
$begingroup$
The complement method may be quicker than finding it straight up: find the number of ways you have $3$ digits the same and $4$ digits the same and subtract from $10000$
$endgroup$
– WaveX
Dec 14 '18 at 0:33