Seven balls of different weights are randomly painted red, orange, yellow, green, blue, indigo and violet, each ball being painted a distinct color.
The green ball is found to be heavier than the blue ball, and the red ball is found to be heavier than the yellow ball.
Given just this information, if the probability that the red ball is heavier than the blue ball is b a , where a , b are coprime positive integers, find a + b .
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
As ball are found to be heavier so why we are using its probability
Because, we do not know from the facts given that, for example, the red ball is lighter or heavier than the blue ball. We only know that they are different.
Letting g , b , r , y being the respective weights of the green, blue, red and yellow balls, and given that g > b and r > y , there are 6 possible sequences of g , b , r , y embedded among the rankings of the weights of the seven balls written in descending order, namely
g > b > r > y
g > r > b > y
g > r > y > b
r > g > b > y
r > g > y > b
r > y > g > b
Each of these sequences is equally likely, since they each occur in ( 4 7 ) = 3 5 possible rankings of the weights of the seven balls. In 5 of these we have r > b , so the desired probability is 6 5 , and so a + b = 5 + 6 = 1 1 .
This is, in fact, the same explanation as given elsewhere. I am making the lists explicit.
Ignoring the orange, indigo and violet ball as distractors.
Assigning the remaining balls indices in the permutations to be generated.
{ r , y , g , b } = { 1 , 2 , 3 , 4 }
Generating the 4 ! = 2 4 permutations of 4 things take 4 at a time. The numbers in each permutation are the weights of the respective balls.
perms = Permutations [ Range [ 4 ] ] ⟹ ⎝ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛ 1 1 1 1 1 1 2 2 2 2 2 2 3 3 3 3 3 3 4 4 4 4 4 4 2 2 3 3 4 4 1 1 3 3 4 4 1 1 2 2 4 4 1 1 2 2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2 1 2 1 1 ⎠ ⎟ ⎟ ⎟ ⎟ ⎞
Computing the fraction.
Length [ perms ] Length [ heavier ] ⟹ 6 5
Computing the answer.
Denominator [ fraction ] + Numerator [ fraction ] ⟹ 1 1
Just lie down the balls along a line with 1st being the largest and last the smallest. Total ways is 7!. But given that green > blue and red>yellow which makes total case to be 7!/2.2 (since now there is only one way instead of 2 to arrange green and blue among themselves and similarly for red and yellow). Now if red>blue then out of 4! cases possible to arrange B,G,Y and R among themselves only 5 cases (GRBY,GRYB,RGBY,RGYB,RYGB) are favorable. Hence total favorable ways are 5.7!/4!. Just taking the ratio gives 5/6. So the answer is 5+6=11
The orange, indigo and violet ball are just distractors and can be ignored.
Heres some ugly php that did it for me
<?php
//build all permutations of 0-6
$arr = range(0,6);
do{
$newarr = array();
foreach($arr as $a){
for($i=0;$i<=6;$i++){
if(!preg_match('@'.$i.'@',$a)){
$newarr[] = $a.$i;
}
}
}
$arr = $newarr;
} while(strlen($arr[0])<7);
//eliminate any instances where $a[3]<$a[4] or where $a[0]<$a[2]
$c = 0;
foreach($arr as $key=>$val){
$s = str_split($val);
if($s[3]<$s[4] || $s[0]<$s[2]){
unset($arr[$key]);
} elseif($s[0]>$s[4]){
$c++;
}
}
//count remaining combos, save for later (1240)
$rc = count($arr);
//treat $c as numerator, $rc as denominator, reduce fraction
$f = simplify($c,$rc);
//print answer
echo array_sum($f);
function simplify($num,$den) {
$g = gcd($num,$den);
return array($num/$g,$den/$g);
}
function gcd($a,$b) {
$a = abs($a); $b = abs($b);
if( $a < $b) list($b,$a) = array($a,$b);
if( $b == 0) return $a;
$r = $a % $b;
while($r > 0) {
$a = $b;
$b = $r;
$r = $a % $b;
}
return $b;
}
?>
5+6=11 bcuz 5/6 was the prob
Problem Loading...
Note Loading...
Set Loading...
There are 4 ! ways to permute the four colors. The probability that green is heavier than blue is 1/2, the probability that red is heavier than yellow is 1/2, and these events are independent, so 4 ! ( 1 / 2 ) ( 1 / 2 ) = 6 of the permutations satisfy the givens.
Now, if red is not heavier than blue, then the order must be green > blue > red > yellow, so there is only one such permutation out of the six.
Therefore, the probability of the complement, which is what we want, is 5/6.