Function 85 Posted March 10, 2014 (edited) Hello On a maths test, I got the following question: The game mastermind starts with forming a secret code, formed by placing 4 coloured pins in a specific order. The pins are being chosen from 6 different colours. How many codes are possible if a specific colour can't be repeated more than 2 times and open places aren't allowed? My answer: [math]N=\bar{V}^2_6\cdot\bar{V}^2_5=900[/math] I got 0/4 for this answer. Now I see it, I'd say I had to multiply it by 6 (the possibilities 2 pins can be placed), which would give 5 400 possibilities My teacher's answer: [math]N=V^4_6+C^2_6\cdot\bar{P}^{2,2}_4+C^2_6\cdot C^1_4\cdot C^1_2\cdot \bar{P}^2_4 = 2 610[/math] Don't get her last term... Why? Thanks Function Edited March 10, 2014 by Function 0 Share this post Link to post Share on other sites

md65536 370 Posted March 10, 2014 (edited) My teacher's answer: [math]N=V^4_6+C^2_6\cdot\bar{P}^{2,2}_4+C^2_6\cdot C^1_4\cdot C^1_2\cdot \bar{P}^2_4 = 2 610[/math] The teacher's answer doesn't make sense to me. If there are no restrictions on duplication, you should have a maximum of 6^4 = 1296 possible choices of pins. I get 2160 if I add: 360 the number of possibilities with 4 unique colors 1440 the number of possibilities with 2 ordered pins of the same color, with 2 others of unique color 360 the number of possibilities with 2 ordered pins of the same color, with the other 2 pins also an ordered pair. Is that what the teacher's equation represents? I think this is an error mainly because 2160 is greater than 1296. ! I think maybe the error is that the order of the 2 same-colored pins doesn't matter, so the teacher is counting a lot of cases twice. The answer I get is 1170 doing it 2 different ways: 1296 Total arrangements with no restrictions of duplicates -6 arrangements of 4 pins all the same color -120 arrangements of 3 pins of the same color. Or... something like what the teacher did except ignoring order, I won't write it out because I think I did it a convoluted way. Edited March 10, 2014 by md65536 2 Share this post Link to post Share on other sites

imatfaal 2481 Posted March 11, 2014 The teacher's answer doesn't make sense to me. If there are no restrictions on duplication, you should have a maximum of 6^4 = 1296 possible choices of pins. I get 2160 if I add: 360 the number of possibilities with 4 unique colors 1440 the number of possibilities with 2 ordered pins of the same color, with 2 others of unique color 360 the number of possibilities with 2 ordered pins of the same color, with the other 2 pins also an ordered pair. Is that what the teacher's equation represents? I think this is an error mainly because 2160 is greater than 1296. ! I think maybe the error is that the order of the 2 same-colored pins doesn't matter, so the teacher is counting a lot of cases twice. The answer I get is 1170 doing it 2 different ways: 1296 Total arrangements with no restrictions of duplicates -6 arrangements of 4 pins all the same color -120 arrangements of 3 pins of the same color. Or... something like what the teacher did except ignoring order, I won't write it out because I think I did it a convoluted way. Hmm - I get the expected answer of 1296. This is just 6^4. Longhand logic per the spreadsheet screenshot below. What arrangements regardless of colour are unique multiplied by how can you fill those spaces with different colours. But then I often seem to miss obvious points on combos/perms as evidenced by the last few threads on these issues 0 Share this post Link to post Share on other sites

md65536 370 Posted March 11, 2014 Hmm - I get the expected answer of 1296. This is just 6^4. Longhand logic per the spreadsheet screenshot below. What arrangements regardless of colour are unique multiplied by how can you fill those spaces with different colours. There is OP's caveat that a "specific colour can't be repeated more than 2 times", which if I understand means that the (4,0,0,0) and (3,1,0,0) arrangements aren't valid. 0 Share this post Link to post Share on other sites

imatfaal 2481 Posted March 11, 2014 There is OP's caveat that a "specific colour can't be repeated more than 2 times", which if I understand means that the (4,0,0,0) and (3,1,0,0) arrangements aren't valid. Yep - which means my answer when corrected by removal of 4,0,0,0 and 3,1,0,0 would collapse to 1170; which is yours! Excellent. My fault for going on the idea of mastermind rather than the OP 0 Share this post Link to post Share on other sites

Function 85 Posted March 11, 2014 (edited) Yep - which means my answer when corrected by removal of 4,0,0,0 and 3,1,0,0 would collapse to 1170; which is yours! Excellent. My fault for going on the idea of mastermind rather than the OP rather than my teacher Does my teacher's answer make sense anyhow? If so, can someone explain it to me? The restriction just means that e.g. yellow-blue-green-red, yellow-red-yellow-red, blue-blue-red-green are allowed, whereas purple-purple-green-purple, for instance, is not allowed. The teacher's answer doesn't make sense to me. If there are no restrictions on duplication, you should have a maximum of 6^4 = 1296 possible choices of pins. I get 2160 if I add: 360 the number of possibilities with 4 unique colors 1440 the number of possibilities with 2 ordered pins of the same color, with 2 others of unique color 360 the number of possibilities with 2 ordered pins of the same color, with the other 2 pins also an ordered pair. Is that what the teacher's equation represents? That would be it, I presume. Thanks. As a matter of fact, I'm afraid my notations aren't very clear? [math]\bar{P}^{a,b,c,...}_n[/math] is a repetitive permutation of n elements, to be chosen out of n elements, of which one element repeats a times, another b times, another c times, ... = [math]\frac{n!}{a!b!c!...}[/math]; sequence is important [math]C^p_n[/math] is a combination of p elements to be chosen out of n elements; sequence of the elements is not important, and repetition is not allowed. [math]\bar{V}^p_n[/math] repetitive variation of p elements to be chosen out of n; sequence is important, repitition is allowed [math]V^p_n[/math] variation (same as above, but with repitition not allowed) I think this is an error mainly because 2160 is greater than 1296. ! I think maybe the error is that the order of the 2 same-colored pins doesn't matter, so the teacher is counting a lot of cases twice. She's not (see my explanation of the symbols above) Edited March 11, 2014 by Function 0 Share this post Link to post Share on other sites

imatfaal 2481 Posted March 11, 2014 rather than my teacher Does my teacher's answer make sense anyhow? If so, can someone explain it to me? The restriction just means that e.g. yellow-blue-green-red, yellow-red-yellow-red, blue-blue-red-green are allowed, whereas purple-purple-green-purple, for instance, is not allowed. Yeah the restriction makes sense. The fact that MD65536 and I come to the same answer (once I have read the question properly) makes me feel that 1170 is the correct answer. As a matter of fact, I'm afraid my notations aren't very clear? [math]\bar{P}^{a,b,c,...}_n[/math] is a repetitive permutation of n elements, to be chosen out of n elements, of which one element repeats a times, another b times, another c times, ... = [math]\frac{n!}{a!b!c!...}[/math]; sequence is important [math]C^p_n[/math] is a combination of p elements to be chosen out of n elements; sequence of the elements is not important, and repetition is not allowed. [math]\bar{V}^p_n[/math] repetitive variation of p elements to be chosen out of n; sequence is important, repitition is allowed [math]V^p_n[/math] variation (same as above, but with repitition not allowed) She's not (see my explanation of the symbols above) I think that MD65536 explanation in his first response matches your teachers I get 2160 if I add: 360 the number of possibilities with 4 unique colors 1440 the number of possibilities with 2 ordered pins of the same color, with 2 others of unique color 360 the number of possibilities with 2 ordered pins of the same color, with the other 2 pins also an ordered pair. Is that what the teacher's equation represents? [latex] N=V^4_6+C^2_6\cdot\bar{P}^{2,2}_4+C^2_6\cdot C^1_4\cdot C^1_2\cdot \bar{P}^2_4 = 2 610 [/latex] 360 is the first term and is 6.5.4.3 and matches MD65535 first part 1440 is third term your teacher has given ie 15.4.2.12 and matches MD65536's second term 360 I guess is the second term of your teacher ie 15.24 -I don't fully understand the notation yet but 24 does not equal 4!/(2!*2!) 2 Share this post Link to post Share on other sites

md65536 370 Posted March 12, 2014 She's not (see my explanation of the symbols above)I say again your teacher is in error calculating the result. I know this sounds rather incredible but this conclusion is based on results from multiple calculations. At least one of the places where you say "sequence is important" is suspicious. I think that for example your teacher is counting "First blue peg in slot A, second blue peg in slot B, red in C, yellow in D" and "Second blue peg in slot A, first blue peg in slot B, red in C, yellow in D" as two separate possibilities. When I counted such things separately, I got 2160. I think 2160 might be what you get if there were two numbered pegs of each color (and you made sure to always select a color's peg-1 before peg-2). This sort of thing has cropped up before and it has always been due to human error. 0 Share this post Link to post Share on other sites

imatfaal 2481 Posted March 12, 2014 Teachers are only human and do make mistakes - although because they are human they might prefer it if you are polite and respectful when point those mistakes out. 1. Your question is a subset of potential mastermind solutions ie those without any colour repeated more than 2 times 2. As a subset it must be less than or equal to the set of mastermind solutions 3. The set of mastermind solutions is 6^4 =1296. This is simply 6 ways of filling first place times 6 ways of filing second times 6 ways thirds times 6 way fourth. This can be explicitly confirmed in the academic literature http://www.dcc.fc.up.pt/~sssousa/RM09101.pdf 4. Your answer can be arrived at in two ways removing the invalid plays from a total of 1296 OR adding the valid plays together. Both of these arrive at the value 1170. It is impossible that either of these are more than the total number of valid mastermind plays at 1296 I will finish explaining what I think went wrong after a coffee 0 Share this post Link to post Share on other sites

rktpro 106 Posted March 12, 2014 Let us denote the cases as ABCD(all colours differ) AABC and AABB.I don't know how to input math. My calculation is 6p4+6(5c2)(4!/2!) +6c2[4!/(2!)^2]. I get 1170. 0 Share this post Link to post Share on other sites

imatfaal 2481 Posted March 12, 2014 (edited) Rktpro Yep - agree. Here in latex - it is not hard to use, the forum has a tutorial, and it is practically obligatory for science students [latex] N=P^6_4+6 \cdot C^5_2\cdot\frac{4!}{2!}+ C^6_2\cdot \frac{4!}{2!^2} = 1170 [/latex]http://www.wolframalpha.com/input/?i=6permute4%2B6%285choose2%29*%284!%2F2!%29+%2B+%286choose2%29+*+%284!%2F%282!%29^2%29Function - please note that in UK and USA we tend to notate in this manner - for a set of n choosing k as[latex]C^n_k[/latex] or [latex]{n\choose k}[/latex] I believe France use it the other way around - it should always be obvious which is which biut just so you realise Edited March 12, 2014 by imatfaal Correction per Rktpro's message below 0 Share this post Link to post Share on other sites

rktpro 106 Posted March 12, 2014 Imatfaal-I use mobile device and it is very difficult to handle, its touch screen and to input a parenthesis I have to touch thrice. You made a mistake in the second term of my calculation though. Forgot to include the arrangement term. 0 Share this post Link to post Share on other sites

imatfaal 2481 Posted March 12, 2014 Imatfaal-I use mobile device and it is very difficult to handle, its touch screen and to input a parenthesis I have to touch thrice. You made a mistake in the second term of my calculation though. Forgot to include the arrangement term. Sorted. Ah yes wouldnt be easy. You can always try some of the online latex editors/compilers - but would still be a strain on a mobile device. 0 Share this post Link to post Share on other sites

Function 85 Posted March 15, 2014 Rktpro Yep - agree. Here in latex - it is not hard to use, the forum has a tutorial, and it is practically obligatory for science students [latex] N=P^6_4+6 \cdot C^5_2\cdot\frac{4!}{2!}+ C^6_2\cdot \frac{4!}{2!^2} = 1170 [/latex] http://www.wolframalpha.com/input/?i=6permute4%2B6%285choose2%29*%284!%2F2!%29+%2B+%286choose2%29+*+%284!%2F%282!%29^2%29 Function - please note that in UK and USA we tend to notate in this manner - for a set of n choosing k as [latex]C^n_k[/latex] or [latex]{n\choose k}[/latex] I believe France Belgium use it the other way around - it should always be obvious which is which biut just so you realise Ah yes, I'll keep that in mind. Thanks. Thanks to everyone for their attribution 0 Share this post Link to post Share on other sites