I am trying to learn the maths I need for data science, but I left formal maths education so long ago that my maths intuition is incredibly weak. I am confronted with the following explanation, and I just don't see it as obvious in the way that the author expects me to:

"If A and B are not independent, the equation (1.6) generalizes to

 P(A and B) = P(A) P(B|A) 

This should make sense to you. Suppose 30% of all UC Davis students are in engineering, and 20% of all engineering majors are female. That would imply that 0.30 x 0.20 = 0.06, i.e., 6% of all UCD students are female engineers."

Why are we multiplying P(A) and P(B|A)? Of course, I know that


and so rearranging we get the above formula, but that doesn't help explain why (for me). I've worked through his explanation of the female engineering students assuming that the overall number of students is 100, but I'm not seeing how this connects to the formula.

Clarification: equation (1.6) is:

P(A and B) = P(A) ยท P(B)

when A and B are independent.

  • 1
    $\begingroup$ Maybe another example could help. Suppose that a ball contains exactly $5$ balls of wich exactly $3$ are red. If we pick two balls one by one (without replacement) then what is the probability that both are red? Let $A$ denote the event that the first ball is red and let $B$ denote the event that the second ball is red. Then $P(A\cap B)=P(A)P(B|A)=\frac35\frac24$. Here $P(A)=\frac35$ is evident (we pick from a bag containing $5$ balls of which $3$ are red). Then under condition that $A$ occurs our second pick if from a bag containing $4$ balls of which $2$ are red. $\endgroup$
    – drhab
    Commented Apr 19, 2022 at 9:46

2 Answers 2


We get to multiply the probabilities of individual events in a compound event when the outcome of the second doesn't depend on the first. So if I want to choose between the numbers 1-3 on the first number and 1-5 on the second and repeats are allowed, I get to just multiply $\frac 1 3$ by $\frac 1 5$.

We can view $A \cap B$ sort of the same, except for that pesky "they aren't independent". However, we can force independence! For my first probability, I just need $A$ to be true. Now, we want to shrink our universe of possibilities to only those in which $A$ is true. From that pool, we then can look at the probability of $B$ happening "Next" as independent. But that probability is exactly $P(B|A)$.

Rather than the formula viewpoint of $P(B|A)$, I prefer the "restricted universe" viewpoint. $P(B)$ is the probability of $B$ happening in the big universe. $P(B|A)$ looks at what happens if we restrict our viewpoint to only the parts in which $A$ happened, then rerun the problem of the chances of $B$ happening in our sub-universe.

  • $\begingroup$ +1 Excellent. And in our restricted universe we have the measure $B\mapsto P(A\cap B)$. Unfortunately though it cannot be recognized as a probability measure because for that we need $\Omega\mapsto1$. That can however be easily repaired by means of dividing it with $P(A\cap\Omega)=P(A)$. $\endgroup$
    – drhab
    Commented Apr 19, 2022 at 12:11
  • $\begingroup$ Thank you, I'm with you now โ€“ I think. One question: does the formula assume that it is B that is dependent on A? It would make sense to me that if B is dependent on A (and not vice versa), then we follow the formula above, whereas if A is dependent on B (and not vice versa), then we have: P(A and B) = P(B) P(A|B). Is this correct? I am assuming that two events, A and B, are independent just when P(A|B) = P(A) and P(B|A) = P(B). $\endgroup$
    – Dan Öz
    Commented Apr 19, 2022 at 13:26

Probability can be defined as the size of the set of favourable outcomes over the size of the set of outcomes.


In your example the sets involved are:

  • $\Omega$: The set of all students at UCD
  • $A$: The set of engineers at UCD
  • $B$: The set of females at UCD
  • $A\cap B=A|B=B|A$: The set of female engineers at UCD

However the probabilities are different, depending on the sample space.

  • $P(\Omega)=1$
  • $P(A)=\frac{|A|}{|\Omega|}$
  • $P(B)=\frac{|B|}{|\Omega|}$

as expected. But $A\cap B$ and $B|A$ have different sample spaces, namely $\Omega$ and $A$ respectively.

  • $P(A\cap B)=\frac{|A\cap B|}{|\Omega|}$
  • $P(B|A)=\frac{|A\cap B|}{|A|}$

and the formula becomes

$$\frac{|A\cap B|}{|\Omega|}=\frac{|A|}{|\Omega|}\frac{|A\cap B|}{|A|}$$


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .