Skip to content
GATEiit

GATE DA · Probability and Statistics

Marginal, conditional and joint probability; Bayes' theorem

Joint and marginal probabilities from a table, conditional probability and the multiplication rule, the law of total probability, and Bayes' theorem for reversing a conditional; GATE asks table, tree and diagnostic-test numericals.

Before you start

This topic comes before: Conditional expectation and variance, Cumulative distribution function; conditional PDF, Exact inference through variable elimination, k-nearest neighbour and naive Bayes classifier, Linear discriminant analysis, Reasoning under uncertainty: conditional independence representation, Regression and classification problems

Concept notes

1. Joint and marginal probability

The joint probability P(A∩B), also written P(A,B), is the chance that both events happen. For two variables taking a few values, the joint probabilities fill a table; the whole table adds to 1.

The marginal probability of one event is found by summing the joint probabilities over the other variable: P(X=x)=∑yP(X=x,Y=y). In a table, marginals are the row and column totals (written in the margins, hence the name).

Y=0 Y=1 P(X)
X=0 0.1 0.3 0.4
X=1 0.2 0.4 0.6
P(Y) 0.3 0.7 1

X and Y are independent only if every cell equals the product of its row and column totals. Here 0.4×0.3=0.12≠0.1, so they are dependent. One failing cell is enough to show dependence.

2. Conditional probability and the multiplication rule

The conditional probability of A given B (with P(B)>0) is P(A∣B)=P(A∩B)P(B). Conditioning on B shrinks the sample space to B and rescales. In a table, divide a cell by its row (or column) total: above, P(Y=1∣X=1)=0.4/0.6=2/3.

P(⋅∣B) is itself a probability: P(Ac∣B)=1−P(A∣B). But in general P(A∣B)≠P(B∣A) and P(A∣Bc)≠1−P(A∣B).

Multiplication (chain) rule: P(A∩B)=P(B) P(A∣B),P(A1A2A3)=P(A1) P(A2∣A1) P(A3∣A1A2). This is the tool for sequential draws without replacement: two aces from a deck have probability 452⋅351.

A and B are independent exactly when P(A∣B)=P(A).

3. Law of total probability

If B1,…,Bn are mutually exclusive and together cover S (a partition), then any event A splits into the pieces A∩Bi: P(A)=∑i=1nP(A∣Bi) P(Bi).

Use it when the chance of A is easy to state within each case but not overall: which machine made the item, which urn was chosen, whether the patient has the disease.

On a probability tree, the first level shows the cases Bi with their probabilities, the second level shows A given each case. Multiply along each branch to get a joint probability, and add the branches that end in A.

Example: machines make 50%, 30% and 20% of output with defect rates 2%, 3% and 4%. Then P(defect)=0.5(0.02)+0.3(0.03)+0.2(0.04)=0.027.

4. Bayes' theorem

Bayes' theorem reverses a conditional: from P(A∣Bi) (easy to know) to P(Bi∣A) (what we want): P(Bi∣A)=P(A∣Bi) P(Bi)∑jP(A∣Bj) P(Bj).

  • P(Bi) is the prior, P(A∣Bi) the likelihood, P(Bi∣A) the posterior. The denominator is P(A) from total probability.

Diagnostic test: prevalence 1%, sensitivity P(+∣D)=0.95, false positive rate P(+∣Dc)=0.05: P(D∣+)=0.95×0.010.95×0.01+0.05×0.99=0.00950.059≈0.161. A positive result raises the chance from 1% to only about 16%, because healthy people vastly outnumber sick ones. This base-rate effect is the usual trap.

Repeated evidence: with conditionally independent tests, the posterior after one test becomes the prior for the next. This is also the idea behind the naive Bayes classifier.

Dno D0.010.990.950.050.050.95+ : 0.0095− : 0.0005+ : 0.0495− : 0.9405
Probability tree for the diagnostic test: multiply along branches; P(D | +) = 0.0095 / (0.0095 + 0.0495)

Formulas to remember

Conditional probabilityP(B)>0
P(A∣B)=P(A∩B)P(B)
Multiplication rule
P(A∩B)=P(A∣B) P(B)=P(B∣A) P(A)
Marginal from joint
P(X=x)=∑yP(X=x,Y=y)
Law of total probabilityBi a partition of S
P(A)=∑iP(A∣Bi) P(Bi)
Bayes' theorem
P(Bi∣A)=P(A∣Bi) P(Bi)∑jP(A∣Bj) P(Bj)
Independence test
P(A∣B)=P(A)  ⟺  P(A∩B)=P(A)P(B)

Common mistakes

  • Confusing P(A∣B) with P(B∣A); Bayes' theorem is exactly the bridge between them.
  • Ignoring the base rate (prior) and reporting the test's sensitivity as the chance of disease.
  • Dividing a joint cell by the grand total or the wrong margin instead of the conditioning event's total.
  • Using a set of cases in total probability that overlap or do not cover every outcome.
  • Declaring independence after checking only one cell of a table larger than 2 × 2; every cell must match the product (only for a 2 × 2 table does one matching cell force the rest).

Worked examples

Try each step yourself, then reveal the working.

Example 1: Reading a joint table

numerical

The joint probabilities of X and Y are P(0,0)=0.1, P(0,1)=0.3, P(1,0)=0.2, P(1,1)=0.4. Find the marginals, P(Y=1∣X=1), and decide whether X and Y are independent.

  1. Step 1: Add along rows and columns.

    Try it on paper first.

Example 2: Which machine made the defective item?

numerical

Machines M1,M2,M3 make 50%, 30% and 20% of the output, with defect rates 2%, 3% and 4%. An item is found defective. Find the probability that M3 made it.

  1. Step 1: Find the overall defect probability.

    Try it on paper first.

Example 3: A rare disease and a good test

numerical

A disease affects 1% of people. A test is positive for 95% of patients and for 5% of healthy people. A person tests positive. Find the probability that the person has the disease.

  1. Step 1: Draw the tree and find both positive branches.

    Try it on paper first.

Example 4: Draws without replacement

numerical

An urn has 3 red and 2 blue balls. Two are drawn one after the other without replacement. Find the probability that both are red, and the probability that the second is red.

  1. Step 1: Use the chain rule for both red.

    Try it on paper first.

Previous year questions

3 official GATE DA questions on this topic, newest first.

Practise these 3 PYQs →

Topic test

10 questions: up to 3 official PYQs and original practice questions, with GATE marking (MCQ wrong answers lose marks). Score 60% or more to pass. A new set is drawn each time.

Mark as mastered

Loading your progress…

My revision notes

Notes written by the GATEiit team against the official GATE DA syllabus; being checked by a reviewer. Updated 2026-11-21. Spotted a mistake? Use Report an issue on any question, or contact us.