Practice
Resources
Contests
Online IDE
New
Free Mock
Scaler
Practice
Improve your coding skills with our resources
Contests
Compete in popular contests with top coders
Scaler
Explore Offerings by SCALER

Probability

Go to Problems

Conditional Probability

The conditional probability of event B is the probability that the event will occur given the knowledge that event A has already occurred. 

 

This probability is written P(B|A), notation for the probability of B given A. In the case where events A and B are independent (where event A has no effect on the probability of event B), the conditional probability of event B given event A is simply the probability of event B, that is P(B).

From this definition, the conditional probability P(B|A) is easily obtained by dividing by P(A):

Given when P(A) is greater than 0.

 

Example-1:

 

In a card game, suppose a player needs to draw two cards of the same suit in order to win. Of the 52 cards, there are 13 cards in each suit. Suppose first the player draws a heart. Now the player wishes to draw a second heart. Since one heart has already been chosen, there are now 12 hearts remaining in a deck of 51 cards. 

 

So the conditional probability:  P(Draw second heart|First card a heart) = 12/51



Example-2 :

 

 Your neighbor has 2 children. You learn that he has a son, Joe. What is the probability that Joe’s sibling is a brother?

 

 The “obvious” answer that Joe’s sibling is equally likely to have been born male or female suggests that the probability the other child is a boy is 1/2. 

 

This is not correct! Consider the experiment of selecting a random family having two children and recording whether they are boys or girls. Then, the sample space is S = {BB,BG,GB,GG}, where, e.g., outcome “BG” means that the first-born child is a boy and the second-born is a girl. 

 

Assuming boys and girls are equally likely to be born, the 4 elements of S are equally likely. The event, E, that the neighbor has a son is the set E = {BB,BG,GB}. The event, F, that the neighbor has two boys (i.e., Joe has a brother) is the set F = {BB}. 

We want to compute P(F|E) = P(F ∩ E) P(E) = P({BB}) P({BB,BG,GB}) = 1/4 / 3/4 = 1 / 3



Serious about Learning Data Science and Machine Learning ?

Learn this and a lot more with Scaler's Data Science industry vetted curriculum.
Conditional probability
Problem Score Companies Time Status
Probability of Raining 30
9:42
How can he win? 30
BCG
7:28
White Marble Probability 30 3:16
Boy or girl paradox 30
5:00
Is it a queen? 30
4:23
Bayes theorem
Normal and continuous distribution
Problem Score Companies Time Status
Distribution Percentage 30 5:02
Random variables
Problem Score Companies Time Status
Product probability 30
10:17
Random variable's probability 30
5:53
New variance 30
6:39
Toss random variable 30
1:52
Probability distributions
Problem Score Companies Time Status
Standard deviation 30
2:35
Probability Distribution 50
20:37
Free Mock Assessment
Fill up the details for personalised experience.
All fields are mandatory
Current Employer *
Enter company name *
Graduation Year *
Select an option *
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
Phone Number *
OTP will be sent to this number for verification
+1 *
+1
Change Number
Phone Number *
OTP will be sent to this number for verification
+1 *
+1
Change Number
Graduation Year *
Graduation Year *
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
*Enter the expected year of graduation if you're student
Current Employer *
Company Name *
Please verify your phone number
Edit
Resend OTP
By clicking on Start Test, I agree to be contacted by Scaler in the future.
Already have an account? Log in
Free Mock Assessment
Instructions from Interviewbit
Start Test