# matching pair of socks problem

###### Blog Post Title
April 5, 2017

Staff www.solving-math-problems.com That should be what you do first with an easy assignment as this. Thank you!). Answer: 3. |Contents| Logging in registers your "vote" with Google. (If you are not logged into your Google account (ex., gMail, Docs), a login window opens when you click on +1. Tom is off to a school Annual Day and is searching for a matching pair of socks. His drawer is filled with socks, each pair of a different color. Hence, 3. The same result as before, and, similarly for the other colors. Do not try solving the whole problem at once but try to think of more manageable subproblems. The probability of getting one sock red is $\displaystyle\frac{r}{r+b+g}.$ Assuming that the first sock is red, the probability of getting the second red sock is $\displaystyle\frac{r-1}{r+b+g-1}.$, When it comes to calculating probabilities, colors do not make much difference: analogous argument applies to blue and green socks, implying that the probability of getting two blue socks is $\displaystyle\frac{b(b-1)}{(r+b+g)(r+b+g-1)}$ and that of getting green socks is $\displaystyle\frac{g(g-1)}{(r+b+g)(r+b+g-1)}.$ The answer to the question is then, $\displaystyle\frac{r(r-1)+b(b-1)+g(g-1)}{(r+b+g)(r+b+g-1)}.$. Two drawn at random. The first and the second draw might result in 2 socks of different color. The 3rd sock picked will definitely match one of previously picked socks. by Clarence Case 1 : A pair of socks are present, hence exactly 2 draws for the socks to match. &=\frac{r(r-1)}{(r+b+g)(r+b+g-1)}. In a drawer $r$ red, $b$ blue, and $g$ green socks. Hence, 3. So, the task is to find the minimum number of socks to be drawn at random to be sure that he/she gets the pair of socks of the same color? When two socks are drawn at random, the probability that both are red is 1/2. Note: Not all browsers show the +1 button. Let's say the socks are three different colors, numbered 1, 2, 3. The answer to this is, $\displaystyle\frac{4\cdot 3+5\cdot 4+2\cdot 1}{11\cdot 10} = \frac{17}{55}.$, |Contact| Case 1 : A pair of socks are present, hence exactly 2 draws for the socks to match. A password reset link will be sent to the following email id, HackerEarth’s Privacy Policy and Terms of Service. Signup and start solving problems. Explanation: Case 1: Same sock color come out in 1st and 2nd attempt- This is too complicated. As you can see, there are 7 combinations of matching socks out of 15 possible combinations. There are $\displaystyle C^{r+b+g}_{2}$ ways to select $2$ socks out of the total of $r+b+g.$ There are $\displaystyle C^{r}_{2}$ ways to select $2$ out $r$ red socks. It's easy to do. }\\ Start Now. To start with, instead of looking for a matching pair, let's find the probability that both socks are red. If you like this Site about Solving Math Problems, please let Google know by clicking the +1 button. &=\frac{r!}{2!(r-2)!}\cdot\frac{2!(r+b+g-2)!}{(r+b+g)! Simply click here to return to Math Questions & Comments - 01. Next T lines contains an integer N which indicates the total pairs of socks present in the drawer. The Sock Drawer: Probability and Statistics Problem A drawer contains red socks and black socks. Solution: Ways to pick any 2 socks from 24 socks = 24C2 Ways to pick 2 BLACK socks from 12 BLACK socks = 12C2 . We care about your data privacy. Solution 1 To start with, instead of looking for a matching pair, let's find the probability that both socks are red. The formula is eminently reasonable, for if any of the three numbers is $1,$ the effect of having an unmatched sock in a drawer is to increase the denominator without adding anything to the numerator. Note: If a +1 button is dark blue, you have already +1'd it. |Front page| This question was asked in Aamaon. It's easy to do. Join in and write your own page! Do not try solving the whole problem at once but try to think of more manageable subproblems. (Deatsville, AL, USA). The 3rd sock picked will definitely match one of previously picked socks. If you like this Page, please click that +1 button, too. Socks of the same color are identical but not allowed to look into the drawer while taking out socks. What is the probability of getting a matching pair? He wants to sell as many socks as possible, but his customers will only buy them in matching pairs. How? Answer To Amazon’s Pair Of Socks Puzzle The tempting answer is 50 percent. It would seem you can either make a pair or have a mismatched pair, and that both of those events would have equal chances, making for a 50 percent probability. |Probability|, Importance of Having Sample Space Defined, Probability of Two Integers Being Comprime, Conditional Probability and Independent Events, Independent Events and Independent Experiments, Probability of Two Integers Being Coprime. If you simply break it down and separate it, they can get it. But this is wrong! HackerEarth uses the information that you provide to contact you about relevant content, products, and services. The following solution uses the Principle of Inclusion / Exclusion, abbreviated PIE. Thank you for your support! Sock Merchant: hackerrank problem easy solution in java,C++ Get link; Facebook; Twitter; Pinterest; Email; Other Apps ; February 17, 2017 John's clothing store has a pile of loose socks where each sock is labeled with an integer, , denoting its color. Case 2 : 2 pair of socks are present in the drawer. How? Print the number of Draws (x) Tom makes in the worst case scenario. My interpretation of the problem statement is that we are asked to find the probability that at least one of the three pairs of socks drawn is a match. |Algebra| The question was posted at the Probability problems page, with 4 red, 5 blue, 2 green socks. The first line contains the number of test cases T. Problem: There are 6 pairs of black socks and 6 pairs of white socks.What is the probability to pick a pair of black or white socks when 2 socks are selected randomly in darkness. Simply click here to return to. The students get confused. In its worst case scenario, how many socks (x) should Tom remove from his drawer until he finds a matching pair? P(2\mbox{ red socks})&=C^{r}_{2}/C^{r+b+g}_{2}\\ So the probability of selecting two red socks is, \begin{align}\displaystyle Case 2 : 2 pair of socks are present in the drawer. The first and the second draw might result in 2 socks of different color. \end{align}. The chance of getting a matching pair of socks is 7 out of 15 >>> the final answer to your question is: 7/15 Thanks for writing. Comparing Two Fractions Without Using a Number Line, Comparing Two Different Units of Measurement, Comparing Numbers which have a Margin of Error, Comparing Numbers which have Rounding Errors, Comparing Numbers from Different Time Periods, Comparing Numbers computed with Different Methodologies, Exponents and Roots Properties of Inequality, Calculate Square Root Without Using a Calculator, Example 4 - Rationalize Denominator with Complex Numbers, Example 5 - Representing Ratio and Proportion, Example 5 - Permutations and combinations, Example 6 - Binomial Distribution - Test Error Rate, Join in and write your own page! If you write up a matrix 6*6 with four reds and two blues on each dimension, you can easily count the probability.