# Simple probability question

1. Dec 5, 2014

### izelkay

1. The problem statement, all variables and given/known data
This looks like a very simple question but I just can't seem to wrap my brain around it:

2. Relevant equations
Baye's theorem, etc.

3. The attempt at a solution
For part (a)
To calculate this probability I need to know the sample space of the programmers right? This is the main thing I'm having trouble with.

I was thinking I just need to add up how many know Java, C, and Assembly (30 + 25 + 16) for the sample space and divide that by the number of people that know Java.
The amount of people that know Java would be 30 (Java) + 15 (Java and C) + 6 (Java and Assembly) + 5 (Java and C and Assembly).

So would the probability be 56/107? I'm really not sure about it though because I feel like I'm double-counting somewhere

2. Dec 5, 2014

### haruspex

As you suspected, that's counting some people twice.
You have enough information to work out exactly how many do any given combination. Start with: how many can do J and C but not A? A Venn diagram might help. Don't assume all employees can program.

3. Dec 5, 2014

### izelkay

Would a venn diagram look like this?:

because I don't know the number of programmers that only know exclusively one language?

4. Dec 5, 2014

### haruspex

Right idea but wrong numbers. According to your diagram, how many can program Java and C (whether or not they can handle Assembler)? How does that compare with what you are told?

5. Dec 5, 2014

### izelkay

Ohhh I think I see now. According to my diagram, 20 can handle Java and C. So I essentially need to build the diagram from the inside out starting with the very middle
Is this correct?:

6. Dec 5, 2014

### izelkay

Also to find the total amount of programmers, would I do:

J + C - J∩C + A - C∩A - J∩A + J∩C∩A

If I add J and C I'd be double counting some of J so I subtract the intersection, and do the same for the other elements. And at the end I'd need to add the intersection of all 3 elements since it kept getting subtracted out.

So there would be 45.

Then the probability that a programmer knows Java is 30/45, or 2/3.

For (b) I'd use Bayes's formula:

P(C|J) = P(J∩C) / P(J) = (15/45) / (30/45) = 1/2

For (c) wouldn't this mean that the programmers make up 3/4 of the company? So the size of the company should be 60.

Last edited: Dec 5, 2014
7. Dec 5, 2014

### haruspex

I agree with all of that.

8. Dec 5, 2014

### izelkay

I'm stuck on (d) now:

I believe the sample space for this one would be (16 choose 3) = 560 since there are 16 assembly programmers and we're forming a group of 3. Then would I divide the total number of employees, 60, by 560 to get 3/28?

Last edited: Dec 5, 2014
9. Dec 6, 2014

### haruspex

No, you are only concerned with those who can program in Assembler. None of the others are relevant.
16 choose 3 is a good start - that's the number of possible sets of 3. Which of those sets of 3 need to be counted separately?

10. Dec 6, 2014

### izelkay

It says at least 1 out of the 3, so would it be (3 choose 1) + (3 choose 2) + (3 choose 3)?

11. Dec 6, 2014

### Ray Vickson

d
You have a population of N people (all the employees who know Assembly), with N1 of type I and N2 of type II. Here, N1 = number (of Assembly programmers) who know Java, and N2 = N - N1. You select three people at random from the N, and want to know the probability that at least one of the chosen is type I. The complement is that none of the three is of type I---that is, that all three are type II. Remember: you select without replacement, so once Person 1 has been picked, he/she is removed from the candidate list for subsequent choosing.

Last edited: Dec 6, 2014
12. Dec 6, 2014

### izelkay

If I go with the complement route, that means, as you said, none of the selected can program in Java. Extracting information from my Venn Diagram, there are 10 people that can program in Assembly and not in Java. So, with a team of 3, would the probability that NONE of them know Java be (10 choose 3) / (16 choose 3) ?

13. Dec 6, 2014

### haruspex

Yes.

14. Dec 6, 2014

### vela

Staff Emeritus
You might find it instructive to solve the problem with your original approach as well to see where you went astray. Start with the simpler problem of determining the number of teams from the 16 who know assembly with 1 programmer who knows Java and 2 who don't. How would you calculate that?

15. Dec 6, 2014

### izelkay

Yes thank you that's a good way to study.

At least 1 means I can either have all 3 know Java, just 2 know Java, or only 1 know Java.
Again, extracting information from my venn diagram, there are 6 people who know both Java and Assembly, and 10 people who know Assembly but not Java.

For 1 that knows Java: (6 choose 1)(10 choose 2)
For 2 that know Java: (6 choose 2)(10 choose 1)
For 3 that know Java: (6 choose 3)(10 choose 0)

So then the probability would be [(6 choose 1)(10 choose 2) + (6 choose 2)(10 choose 1) + (6 choose 3)(10 choose 0) / (16 choose 3)]

16. Dec 6, 2014

### Ray Vickson

Yes you are right; and what you are doing is evaluating a special case of the so-called hypergeometric distribution; see, eg.,
http://en.wikipedia.org/wiki/Hypergeometric_distribution or
http://mathworld.wolfram.com/HypergeometricDistribution.html

As I said already, a slightly easier way in this case is to do the complement: we start with N = 16 people (who know Assembly) and of which M = 16 - 6 = 10 do not know Java. So, to find P(all 3 do not know Java), proceed as follows.
P(first person does not know Java) = 10/16.
Now we are left with 15 people, among which 9 do not know Java, so
P(second does not know Java | first does not know Java) = 9/15.
Now we are left with 14 people, among which 8 do not know Java, so
P(third does not know Java | first two do not know Java) = 8/14.
Altogether, the answer we want is
P(all three do not know Java) = (10/16)(9/15)(8/14), and P(at least one knows Java) = 1 - (10/16)(9/15)(8/14).

The "logic" of such successive-choice probabilities is really what lies at the back of the hypergeometric distribution.

17. Dec 6, 2014

### izelkay

Ah okay that makes sense, thank you.

Also, I looked at the wiki page you linked and came to the conclusion that the answer for part (e) is:

(45 choose 3)(15 choose 2) / (60 choose 5)

Since we're picking a team of 5 out of all 60 employees, 60 choose 5 is the sample space. Exactly 3 are programmers and since there are 45 programmers, (45 choose 3). Then the remaining 2 do not know any programming. 60 - 45 = 15 employees do not know any programming, so (15 choose 2).

Is that correct?

18. Dec 6, 2014

### haruspex

Yes - well done.

19. Dec 6, 2014

### izelkay

Okay, that's all for now. Thank you all for your help, I feel I have a better understanding of problems like this now.

20. Dec 19, 2014

### izelkay

Just came by to thank y'all again for your help. The final had similar problems to the one I posted here, and I knew how to do almost all of them:

:)