Probability for GATE CS

Translate the wording into events before calculating. Exact dice, Bayes and expectation examples show how to build the denominator and avoid the standard independence trap.

Prashant Jain

KnowledgeGate AI educator

Updated 14 Jul 20264 min read

Probability questions are usually lost during setup, not calculation. A solver uses the wrong sample space after seeing the word "given", reverses a conditional probability, or treats mutually exclusive events as independent. Name the events first and most of the arithmetic becomes short.

The Engineering Mathematics for GATE course provides the full learning sequence. Here, the focus is the small set of patterns that should become automatic.

Conditional probability

For events A and B with P(B) > 0,

P(A|B) = P(A intersection B) / P(B)

The condition B changes the sample space. Once B is known to have happened, outcomes outside B are no longer possible.

Worked dice example

Two fair dice are rolled. Given that their sum is 8, what is the probability that the first die shows 3?

Let:

  • B = the sum is 8.

  • A = the first die shows 3.

The ordered outcomes satisfying B are:

(2,6), (3,5), (4,4), (5,3), (6,2)

There are five equally likely outcomes in the conditional sample space. Only (3,5) also satisfies A. Therefore:

P(A|B) = 1/5

The denominator is 5, not 36, because the condition has already restricted the sample space. Using 1/36 would calculate the unconditional probability of rolling (3,5), which is not what was asked.

The same method works for cards, components and selected students. List or count only the outcomes that satisfy the condition, then count how many of those also satisfy the requested event.

Total probability and Bayes' theorem

Bayes questions become reliable with a two-step recipe:

  1. Use total probability to find the probability of the observed evidence.

  2. Divide the required joint branch by that evidence probability.

If sources A and B are mutually exclusive and exhaustive, and D is the observed event, then:

P(D) = P(A)P(D|A) + P(B)P(D|B)

and:

P(B|D) = P(B)P(D|B) / P(D)

Worked defective-item problem

A factory receives 60% of its items from machine A and 40% from machine B. Machine A produces 2% defective items; machine B produces 5% defective items. An item selected at random is defective. Find the probability that it came from machine B.

Write every percentage as a fraction:

  • P(A) = 60/100 = 3/5

  • P(B) = 40/100 = 2/5

  • P(D|A) = 2/100 = 1/50

  • P(D|B) = 5/100 = 1/20

First calculate the total defective probability:

P(D) = (3/5)(1/50) + (2/5)(1/20)

= 3/250 + 2/100

= 3/250 + 1/50

= 3/250 + 5/250

= 8/250 = 4/125

Now select the branch "machine B and defective":

P(B intersection D) = P(B)P(D|B)

= (2/5)(1/20) = 2/100 = 1/50

Apply Bayes' theorem:

P(B|D) = (1/50) / (4/125)

= (1/50)(125/4) = 125/200 = 5/8

Therefore, the required probability is 5/8.

Probability tree for the worked defective-item problem, branching first to machine A with 3/5 and machine B with 2/5, then from A to defective 1/50 and non-defective 49/50 and from B to defective 1/20 and non-defective 19/20, with defective leaf products A-and-defective 3/250 and B-and-defective 1/50, total defective probability 4/125, and posterior P(B|defective)=5/8.

Check the result another way. Among defective items, machine A contributes 3/250 and machine B contributes 1/50 = 5/250. The defective total is 8/250, so B's share is (5/250)/(8/250) = 5/8. Both routes agree.

The most common reversal is to use P(D|B) = 1/20 as the answer to P(B|D). These conditionals are different. One asks for defect rate among B items; the other asks for B's share among all defective items.

Independence versus mutual exclusivity

Events A and B are independent when:

P(A intersection B) = P(A)P(B)

Knowing one occurred does not change the probability of the other.

Events are mutually exclusive when:

P(A intersection B) = 0

They cannot happen together. If two mutually exclusive events both have positive probability, they cannot be independent because P(A)P(B) is positive while their intersection probability is zero.

For a fair die, let A be "the result is odd" and B be "the result is even". Then P(A) = 1/2, P(B) = 1/2, and P(A intersection B) = 0. But P(A)P(B) = 1/4. The events are mutually exclusive and dependent, not independent.

Also remember the conditional form of independence: if P(B) > 0 and A is independent of B, then P(A|B) = P(A).

Expectation basics

For a discrete random variable X,

E[X] = sum of x P(X=x) over all values x

The most useful property is linearity:

E[X1 + X2 + ... + Xn] = E[X1] + E[X2] + ... + E[Xn]

This does not require the variables to be independent.

Suppose a fair coin is tossed five times. Let Xi be 1 if toss i is heads and 0 otherwise. Then the total number of heads is:

X = X1 + X2 + X3 + X4 + X5

For every toss, E[Xi] = 1(1/2) + 0(1/2) = 1/2. Therefore:

E[X] = 5(1/2) = 5/2 = 2.5

An expectation need not be a possible observed value. You cannot see 2.5 heads in one experiment, but 2.5 is the long-run average count across repeated five-toss experiments.

How GATE tests probability

Expect conditional sample spaces, Bayes inversion, independence tests, expectation, or a counting problem that feeds into probability. Write the event notation before choosing a formula. If the problem says "given", rebuild the denominator from the stated condition.

About 450 published Probability questions are available in the KnowledgeGate bank. Use GATE CS Subject Weightage to place this block in revision, then use the GATE CS 6-Month Plan to schedule repeated practice. For the current syllabus and official exam-specific instructions, check the official GATE portal of the organising IIT. GATE CS Exam Preparation Courses & Test Series holds the wider route.

The short version and next step

For conditional probability, restrict the sample space first. For Bayes, compute the total evidence probability, then divide the required joint branch by that total. Test independence with the product rule, and do not confuse it with mutual exclusivity. Use linearity to split expectations into easy pieces.

Rework the Bayes tree until every branch product is clear, then use the GATE Test Series for timed mixed problems. Correct event setup matters more than speed, and speed follows once the setup is consistent.