## Facebook Interview Question

Software Engineer / Developers**Country:**United States

**Interview Type:**Phone Interview

@autoboli is correct and has the shortest solution possible, but if you want to go the longer way we can also do this:

Proability of getting no sixes is 1 - P_getting_1_six - P_getting_two_sixes, where P_getting_1_six = 2 * (1/6 * 5/6) = 10/36 and P_getting_two_sixes = 1/6 * 1/6 = 1/36. 1 - 10/36 - 1/36 = 1 - 11/36 = 25/36 = 0.69. I know it's a long way but just showing another way to do it :)

For the math gurus here, I have one question. I went about this in a different way....and the answer ofcourse is different...as with most probability problems...can you please help me understand the mistake in my thinking? Thanks....

1.

What is the set of all possible outcomes when I roll a dice?

```
d1 = dice 1.
If dice 1 has the value in column 1, then what are the possible sums of both dices?
d1 Outcomes possible
1 2 3 4 5 6 7
2 3 4 5 6 7 8
3 4 5 6 7 8 9
4 5 6 7 8 9 10
5 6 7 8 9 10 11
6 7 8 9 10 11 12
```

2.

Total outcomes = 36

Prob of getting 6 = 5/36

Prob of not getting 6 = 31/36.

This is not the same as the others...so, any help is appreciated. Thanks!

I see what you're trying to do here, and there is a way to make it work out. Essentially, using your setup, the way you would remove all rolls that include a 6 would be to remove the bottom row *and* the rightmost column, as each of those represent any pair of rolls that contain a 6. What you're then left with is a 5x5 matrix, which is 25 possibilities out of your original 36.

```
+ 1 2 3 4 5 | 6
1 2 3 4 5 6 | 7
2 3 4 5 6 7 | 8
3 4 5 6 7 8 | 9
4 5 6 7 8 9 | 10
5 6 7 8 9 10 | 11
--------------------
6 7 8 9 10 11 | 12
```

25 / 36 = ~0.69

The more straightforward way to think of it is to consider the dice entirely independent of each other, because the second roll does not depend on the first. So you need only consider the probabilities of each, multiplied together. That is, the probability of not rolling a 6 with each die is 5/6. Then you have:

5/6 * 5/6 = 25/36 = ~.69

Events that should happen are (i) dice A is not 6, (ii) dice B is not six, both at the same time, both events are independent. Hence P = P_A*P_B = 5/6*5/6=25/36~= 0.69

- autoboli January 12, 2015