Practice
Resources
Contests
Online IDE
New
Free Mock
Events New Scaler
Practice
Improve your coding skills with our resources
Contests
Compete in popular contests with top coders
logo
Events
Attend free live masterclass hosted by top tech professionals
New
Scaler
Explore Offerings by SCALER

Probability

Last Updated: Jan 10, 2022
Go to Problems
Contents

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



Video Courses
By

View All Courses
Excel at your interview with Masterclasses Know More
Certificate included
What will you Learn?
Free Mock Assessment
Fill up the details for personalised experience.
Phone Number *
OTP will be sent to this number for verification
+91 *
+91
Change Number
Graduation Year *
Graduation Year *
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
2028
2029
*Enter the expected year of graduation if you're student
Current Employer
Company Name
College you graduated from
College/University Name
Job Title
Job Title
Engineering Leadership
Software Development Engineer (Backend)
Software Development Engineer (Frontend)
Software Development Engineer (Full Stack)
Data Scientist
Android Engineer
iOS Engineer
Devops Engineer
Support Engineer
Research Engineer
Engineering Intern
QA Engineer
Co-founder
SDET
Product Manager
Product Designer
Backend Architect
Program Manager
Release Engineer
Security Leadership
Database Administrator
Data Analyst
Data Engineer
Non Coder
Other
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