# Khan/khan-exercises

Replaced probability_1 with new probability of one event exercise

Reviewers: eater, emily

Reviewed By: eater

Differential Revision: http://phabricator.khanacademy.org/D446
1 parent f0e8e5a commit a8d7eb110e3e724f5d30441c2024a41b984b0afc mwittels committed Jul 24, 2012
Showing with 64 additions and 107 deletions.
1. +56 −107 exercises/probability_1.html
2. +8 −0 utils/math.js
163 exercises/probability_1.html
 @@ -2,44 +2,44 @@ - Probability 1 + Probability of One Event
-
+
- randFromArray(["bag", "jar", "box", "cup"]) + randFromArray(["bag", "jar", "box", "goblet"]) randFromArray(["marble", "ball", "jelly bean"]) - randRange(3, 11) - randRange(3, 11) - randRange(3, 11) - RED + GREEN + BLUE + randRange(3, 11) + randRange(3, 11) + randRange(3, 11) + REDMAR + GREENMAR + BLUEMAR rand(2) === 0 - randFromArray([["red", RED], ["green", GREEN], ["blue", BLUE]]) + randFromArray([["red", REDMAR], ["green", GREENMAR], ["blue", BLUEMAR]]) NOT ? TOTAL - CHOSEN_NUMBER : CHOSEN_NUMBER
-

A CONTAINER contains RED red MARBLEs, - GREEN green MARBLEs, and BLUE blue MARBLEs.

+

A CONTAINER contains REDMAR red MARBLEs, + GREENMAR green MARBLEs, and BLUEMAR blue MARBLEs.

If a MARBLE is randomly chosen, what is the probability that it is not CHOSEN_COLOR? Write your answer as a simplified fraction.

NUMBER / TOTAL
-

There are RED + GREEN + BLUE = TOTAL MARBLEs in the CONTAINER.

+

There are REDMAR + GREENMAR + BLUEMAR = TOTAL MARBLEs in the CONTAINER.

There are CHOSEN_NUMBER CHOSEN_COLOR MARBLEs. That means TOTAL - CHOSEN_NUMBER = NUMBER are not CHOSEN_COLOR.

The probability is \displaystyle fractionSimplification(NUMBER, TOTAL).

-
+
randFromArray([ ["a 1", [1]], @@ -81,105 +81,54 @@
-
+
- randFromArray([ - [3, "no heads", [0]], - [3, "heads exactly once", [1]], - [3, "heads exactly twice", [2]], - [3, "heads at least once", [1, 2, 3]], - [3, "heads at least twice", [2, 3]], - [3, "heads every time", [3]], - [4, "no heads", [0]], - [4, "heads exactly once", [1]], - [4, "heads exactly twice", [2]], - [4, "exactly three heads", [3]], - [4, "heads at least once", [1, 2, 3, 4]], - [4, "heads at least twice", [2, 3, 4]], - [4, "at least three heads", [3, 4]], - [4, "heads every time", [4]], - - [3, "no tails", [3]], - [3, "tails exactly once", [2]], - [3, "tails exactly twice", [1]], - [3, "tails at least once", [0, 1, 2]], - [3, "tails at least twice", [0, 1]], - [3, "tails every time", [0]], - [4, "no tails", [4]], - [4, "tails exactly once", [3]], - [4, "tails exactly twice", [2]], - [4, "exactly three tails", [1]], - [4, "tails at least once", [0, 1, 2, 3]], - [4, "tails at least twice", [0, 1, 2]], - [4, "at least three tails", [0, 1]], - [4, "tails every time", [0]] - ]) - - coinFlips(REPS) - (function() { - return $.map(ALL, function( el, i ) { - return el[0]; - }); - })() - (function() { - return$.map($.grep(ALL, function( el, i ) { - return WANTED.indexOf(el[1]) !== -1; - }), function( el, i ) { - return el[0]; - }); - })() - choose(REPS, WANTED) - pow(2, REPS) - - - - A fair coin is flipped REPS === 3 ? "three" : "four" times. What is the - probability of getting DESC? Write your answer as a simplified fraction. + randRange(7,12) + randRange(3,6) + randFromArray(["radius","diameter","circumference"]) + randFromArray(["radius","diameter","circumference"]) + BIG_GIVEN === "radius" ? BIG_RAD : BIG_RAD*2 + SMALL_GIVEN === "radius" ? SMALL_RAD : SMALL_RAD*2 + getGCD(Math.pow(SMALL_RAD,2),Math.pow(BIG_RAD,2)) - - WANTED_COUNT / TWO_TO_REPS - - - There are (new Array(REPS)).join("2 \\cdot ")2 = 2^{REPS} = TWO_TO_REPS possibilities for the sequence of flips. - The possibilities are toSentence(ALL_SEQS). - There WANTED_COUNT === 1 ? "is only" : "are" plural(WANTED_COUNT, "favorable outcome"): toSentence(WANTED_LIST). - The probability is \displaystyle fractionSimplification(WANTED_COUNT, TWO_TO_REPS). - - - - - - randFromArray([ [1, 10], [11, 20], [21, 30], [31, 40], [41, 50], [51, 60], [61, 70], [71, 80], [81, 90], [91, 100] ]) - (function() { - var list = []; - for (var i = LOW; i <= HIGH; i++) { - list.push(i); - } - return list; - })() - - randFromArray([ - ["prime", KhanUtil.isPrime], - ["divisible by both 2 and 3", function(n) { return n % 6 <= 0.5; }], - ["divisible by either 3 or 5", function(n) { return n % 3 <= 0.5 || n % 5 <= 0.5; }], - ["divisible by either 4 or 7", function(n) { return n % 4 <= 0.5 || n % 7 <= 0.5; }] - ]) - -$.grep(POSSIBLE, COND_FN) - WANTED_LIST.length -
- -
-

A positive integer is picked randomly from LOW to HIGH, inclusive.

-

What is the probability that it is COND_DESC? Write your answer as a simplified fraction.

-
- -
WANTED_COUNT / POSSIBLE.length
+

+ You throw a dart at a circular dartboard with BIG_GIVEN BIG_INFO + BIG_GIVEN === "circumference" ? "\\pi" : "". Inside the dartboard is a circular target with + SMALL_GIVEN SMALL_INFO SMALL_GIVEN === "circumference" ? "\\pi" : "". + Assume you're good enough to hit the dartboard every time, and you'll hit every point on the dartboard with equal probability. +

+

+ What is the probability that you will hit the target? +

+ +
-

There are POSSIBLE.length possibilities for the chosen number.
The possibilities are toSentence(POSSIBLE).

-

There WANTED_COUNT === 1 ? "is only" : "are" plural(WANTED_COUNT, "favorable outcome"): toSentence(WANTED_LIST).

-

The probability is \displaystyle fractionSimplification(WANTED_COUNT, POSSIBLE.length).

+

+ Since you're equally likely to hit every point on the dartboard, the probability that you hit the target is basically + the size of the target divided by the size of the dartboard. +

+

+ To figure out these sizes, we need to figure out the areas of the target and the dartboard. +

+

+ The area of the dartboard is \pi r^2, so since BIG_GIVEN === "radius" ? "radius =" + BIG_INFO : + (BIG_GIVEN === "diameter" ? "radius = \\frac{diameter}{2}" : "radius = \\frac{circumference}{2 \\pi}"), + the area of the dartboard is BIG_RAD^2 \pi. +

+

+ The area of the target is \pi r^2, so since SMALL_GIVEN === "radius" ? "radius =" + SMALL_INFO : + (SMALL_GIVEN === "diameter" ? "radius = \\frac{diameter}{2}" : "radius = \\frac{circumference}{2 \\pi}"), + the area of the target is SMALL_RAD^2 \pi. +

+