Day 2: Compound Event Probability HackerRank Solution


Day 2: Compound Event Probability HackerRank Solution
Source : https://www.hackerrank.com/challenges/s10-mcq-3

Objective
In this challenge, we practice calculating the probability of a compound event. We recommend you review today's Probability Tutorial before attempting this challenge.

Task
There are urns labeled , , and .

  • Urn contains red balls and black balls.
  • Urn contains red balls and black balls.
  • Urn contains red balls and black balls.

One ball is drawn from each of the urns. What is the probability that, of the balls drawn, are red and is black?

10 / 63
2 / 7
17 / 42
31 / 126


Source : https://www.hackerrank.com/challenges/s10-mcq-3


Solution


github.com/RodneyShag
Answer: 17/42
Urn X has a 4/7 probability of giving a red ball
Urn Y has a 5/9 probability of giving a red ball
Urn Z has a 1/2 probability of giving a red ball
Urn X has a 3/7 probability of giving a black ball
Urn Y has a 4/9 probability of giving a black ball
Urn Z has a 1/2 probability of giving a black ball
P(2 red, 1 black) = P(Red Red Black) + P(Red Black Red) + P(Black Red Red)
= (4/7)(5/9)(1/2) + (4/7)(4/9)(1/2) + (3/7)(5/9)(1/2)
= 20/126 + 16/126 + 15/126
= 51/126
= 17/42

No comments:

Post a Comment