Bayes Theorem and Random Variable Distribution: JEE Main
Reviewed Last updated 2026-11-20. Syllabus topic: Bayes theorem and probability distribution of a random variable.
In short. Bayes theorem gives the probability of a cause after an effect is seen: P(Ei | A) = P(Ei) P(A | Ei)/P(A), with P(A) from total probability. A probability distribution lists values with probabilities adding to 1; its mean is sum of x p and variance E(X²) - E(X)².
- Total probability: P(A) = sum of P(Ej) P(A | Ej) over mutually exclusive, exhaustive events Ej.
- Bayes theorem: P(Ei | A) = P(Ei) P(A | Ei)/P(A); the posterior probabilities of all causes add to 1.
- A distribution needs every p_i between 0 and 1 and sum of p_i equal to 1, which fixes an unknown constant.
- Mean E(X) = sum of x p; variance = sum of x² p - (mean)²; E(aX + b) = a E(X) + b and Var(aX + b) = a² Var(X).
- For multi-stage problems draw a tree, multiply along branches and add the branches that end in the observed effect.
Syllabus line: STATISTICS AND PROBABILITY : Measures of dispersion; calculation of mean, median, mode of grouped and ungrouped data, calculation of standard deviation, variance and mean deviation for grouped and ungrouped data. Probability: Probability of an event, addition and multiplication theorems of probability, Baye's theorem, probability distribution of a random variable. (NTA JEE (Main) 2026 syllabus, Mathematics, Unit 13 (https://jeemain.nta.nic.in/document/syllabus-2026/))
Before you start
Prerequisites
- Probability, addition and multiplication theorems: Bayes theorem is built from conditional probability and the multiplication theorem. Read this first if P(A | B) is not clear.
- Mean, median, mode and measures of dispersion: The mean and variance of a random variable are the same formulae with probabilities as the weights. Read this first if variance as mean of squares minus square of the mean is new.
Related topics
- Statistics and Probability (lesson planned)
- Probability, addition and multiplication theorems
- Mean, median, mode and measures of dispersion
The concept step by step
Partition of the sample space and total probability
Events E1, E2, ..., En form a partition if they are mutually exclusive and exactly one of them must occur, so that their probabilities add to 1. For any event A, A can occur through any one of the E_j, and P(A) = sum of P(E_j) P(A | E_j). This is the law of total probability. Draw it as a tree: first the choice of E_j, then A or not A on each branch.
Bayes theorem as reversed conditioning
The multiplication theorem gives P(E_i and A) = P(E_i) P(A | E_i) = P(A) P(E_i | A). Dividing by P(A) and using total probability gives Bayes theorem: P(E_i | A) = P(E_i) P(A | E_i)/(sum of P(E_j) P(A | E_j)). P(E_i) is the prior, P(E_i | A) the posterior. The posteriors of all E_i add to 1 because the denominator is their common total.
Using a tree and a table of counts
To avoid slips, imagine a large number of trials, for example 1000, and compute the number of cases at the end of each branch. The posterior is then the share of the observed effect that came through the branch of interest. A multi-stage experiment, such as choosing an urn and then drawing two balls, is handled by multiplying along the branch and keeping every stage that is informed by the observation.
Random variable and probability distribution
A random variable X assigns a number to each outcome. Its distribution lists the values x₁, x₂, ..., x_n and the probabilities p_i = P(X = x_i), each between 0 and 1 with sum equal to 1. If the distribution contains a constant, such as P(X = x) = k x, use the sum rule to find the constant first. Tables are built by counting outcomes: for the larger of two dice, P(X = k) = (2k - 1)/36.
Mean and variance of a random variable
The mean (expected value) is E(X) = sum of x_i p_i, a probability-weighted average that need not be a possible value. The variance is E(X²) - (E(X))², with E(X²) = sum of x_i² p_i, and the standard deviation is its square root. For Y = a X + b: E(Y) = a E(X) + b and Var(Y) = a² Var(X). A game with gain g_i and probability p_i has expected gain sum of g_i p_i, and is fair when this is zero.
Worked examples
Each solution shows the marks every step would earn. The sanity check tests units and size of the answer.
Example 1 (easy)
A random variable X takes the values 0, 1, 2 and 3 with P(X = x) = c (x + 1). Find the mean of X.
| Step | Marks |
|---|---|
| The probabilities add to 1: c (1 + 2 + 3 + 4) = 10 c = 1, so c = 0.1. | 1 |
| Probabilities are 0.1, 0.2, 0.3, 0.4 for x = 0, 1, 2, 3. | 1 |
| E(X) = 0(0.1) + 1(0.2) + 2(0.3) + 3(0.4) = 0.2 + 0.6 + 1.2 = 2.0. | 1 |
| Total: 3 marks | 3 |
Answer: 2.0
Fast method: E(X) = sum of x (x + 1)/10 = (0 + 2 + 6 + 12)/10 = 2.
Sanity check: The mean 2.0 lies between 0 and 3 and above the midpoint 1.5, as expected because larger values are more likely.
Example 2 (easy)
Two fair coins are tossed and X is the number of heads. Find the variance of X.
| Step | Marks |
|---|---|
| P(X = 0, 1, 2) = 1/4, 1/2, 1/4. | 1 |
| E(X) = 0 + 1/2 + 2/4 = 1 and E(X²) = 0 + 1/2 + 4/4 = 1.5. | 1 |
| Variance = E(X²) - (E(X))² = 1.5 - 1 = 0.5. | 1 |
| Total: 3 marks | 3 |
Answer: 0.5
Fast method: Each coin has variance 1/4 and the two are independent, so the variance is 1/4 + 1/4 = 1/2.
Sanity check: The variance is non-negative and the SD 0.71 is less than the range 2; the symmetric distribution has mean 1, the middle value.
Example 3 (medium)
Bag 1 has 3 white and 2 black balls; Bag 2 has 2 white and 4 black balls. A fair coin decides which bag is used and one ball is drawn. It is white. Find the probability that it came from Bag 1.
| Step | Marks |
|---|---|
| P(Bag 1) = P(Bag 2) = 1/2; P(white | Bag 1) = 3/5 and P(white | Bag 2) = 2/6 = 1/3. | 1 |
| P(white) = (1/2)(3/5) + (1/2)(1/3) = 3/10 + 1/6 = 14/30. | 1 |
| P(Bag 1 | white) = (3/10)/(14/30) = 9/14, about 0.643. | 1 |
| Total: 3 marks | 3 |
Answer: 9/14
Fast method: Scale the branches by 30: Bag 1 contributes 9 and Bag 2 contributes 5, so the answer is 9/(9 + 5) = 9/14.
Sanity check: The posterior 0.643 exceeds the prior 0.5 because Bag 1 has the higher fraction of white balls (0.6 against 0.33), and the two posteriors, 9/14 and 5/14, add to 1.
Example 4 (medium)
Suppose a checking device flags 95 percent of faulty items and wrongly flags 4 percent of good items, and 2 percent of the items in a lot are faulty. (These numbers are made up for the exercise.) An item is flagged. Find the probability that it is faulty.
| Step | Marks |
|---|---|
| P(faulty and flagged) = 0.02 x 0.95 = 0.019. | 1 |
| P(good and flagged) = 0.98 x 0.04 = 0.0392. | 1 |
| P(flagged) = 0.019 + 0.0392 = 0.0582. | 1 |
| P(faulty | flagged) = 0.019/0.0582 = 0.326. | 1 |
| Total: 4 marks | 4 |
Answer: about 0.33
Fast method: In 10000 items: 200 faulty, of which 190 are flagged; 9800 good, of which 392 are flagged. The answer is 190/(190 + 392) = 0.326.
Sanity check: The value 0.33 is far below the prior-free likelihood 0.95 because the good items outnumber the faulty ones fifty to one; if the lot were half faulty the posterior would rise above 0.95.
Example 5 (medium)
A game costs nothing to join. A fair die is thrown once: the player wins Rs 12 if the number is 6 and loses Rs 2 otherwise. Find the expected gain of the player in rupees.
| Step | Marks |
|---|---|
| Gain is +12 with probability 1/6 and -2 with probability 5/6. | 1 |
| E(G) = 12 x 1/6 - 2 x 5/6 = 2 - 10/6. | 1 |
| E(G) = 2 - 1.667 = Rs 0.33 per game. | 1 |
| Total: 3 marks | 3 |
Answer: Rs 1/3 per game (about Rs 0.33)
Fast method: E(G) = (12 - 2 x 5)/6 = 2/6 = 1/3.
Sanity check: The unit is rupees per game. Over six games the player expects one win (+12) and five losses (-10), a net Rs 2, which is Rs 0.33 per game; the game slightly favours the player.
Example 6 (hard, multi-step)
Two cards are drawn without replacement from a pack of 52. Let X be the number of aces drawn. Find the variance of X.
| Step | Marks |
|---|---|
| P(X = 0) = 1128/1326, P(X = 1) = 192/1326, P(X = 2) = 6/1326. | 2 |
| E(X) = (192 + 12)/1326 = 204/1326 = 2/13, about 0.1538. | 1 |
| E(X²) = (192 + 24)/1326 = 216/1326 = 0.1629. | 1 |
| Variance = 0.1629 - (0.1538)² = 0.1629 - 0.0237 = 0.139. | 1 |
| Total: 5 marks | 5 |
Answer: about 0.139
Fast method: Counting-based: E(X) = 2 x 4/52 = 2/13; E(X²) = E(X) + 2 P(both aces) = 2/13 + 2 x 6/1326, giving 0.1629.
Sanity check: The mean 0.154 and variance 0.139 are of similar size, typical for a rare count; the three probabilities add to 1326/1326 = 1.
Example 7 (hard)
Three drawers hold two coins each: one has two gold coins, one has a gold and a silver coin and one has two silver coins. A drawer is chosen at random and a coin taken from it at random is gold. Find the probability that the other coin in the same drawer is also gold.
| Step | Marks |
|---|---|
| P(drawer GG) = P(GS) = P(SS) = 1/3, with P(gold drawn) = 1, 1/2 and 0 respectively. | 1 |
| P(gold drawn) = 1/3 + 1/6 + 0 = 1/2. | 1 |
| P(drawer GG | gold drawn) = (1/3)/(1/2) = 2/3. | 1 |
| The other coin is gold exactly when the drawer is GG, so the probability is 2/3. | 1 |
| Total: 4 marks | 4 |
Answer: 2/3
Fast method: There are three gold coins in all, and two of them are in the GG drawer: 2 of 3 equally likely gold coins give 2/3.
Sanity check: The answer is above the intuitive 1/2 because the GG drawer has two ways to show a gold coin and the GS drawer only one; the posteriors 2/3 and 1/3 add to 1.
Formulas and units
| Result | Formula | Valid when | Units or note | Worked example |
|---|---|---|---|---|
| Total probability | P(A) = sum of P(Ej) P(A | Ej) | events E1..En mutually exclusive, exhaustive, with P(Ej) > 0 | pure number | Example 3 |
| Bayes theorem | P(Ei | A) = P(Ei) P(A | Ei)/sum of P(Ej) P(A | Ej) | same partition E1..En; P(A) > 0 | pure number | Example 3 |
| Two-cause form | P(E1 | A) = a1 l1/(a1 l1 + a2 l2), a = prior, l = likelihood | only two causes E1, E2 that are exclusive and exhaustive | pure number | Example 3 |
| Distribution condition | 0 <= p_i <= 1 and sum of p_i = 1 | for any discrete probability distribution | pure number | Example 1 |
| Mean (expectation) | E(X) = sum of x_i p_i | discrete random variable with finite values x_i | same as X | Example 1 |
| Variance | Var(X) = E(X²) - (E(X))², E(X²) = sum of x_i² p_i | discrete random variable; Var(X) divides by total probability 1 | unit of X squared | Example 2 |
| Linear change | E(aX + b) = a E(X) + b; Var(aX + b) = a² Var(X) | a and b are constants; holds for any random variable | as X | none |
| Expected gain | E(G) = sum of g_i p_i; fair game if E(G) = 0 | discrete gains g_i; expectation is the long-run average per play | rupees per game | Example 5 |
| Larger of two dice | P(X = k) = (2k - 1)/36; E(X) = 161/36 | max of two fair dice thrown together, X = larger number | pure number | none |
Common mistakes and speed
- Giving the likelihood P(A | E) when the posterior P(E | A) is asked. Why it tempts: The likelihood is stated in the problem, so it is the number at hand, and the option equal to it is placed among the choices.
- Leaving out one cause when computing the total probability, or using priors that do not add to 1. Why it tempts: With three machines or urns one branch is easily dropped, and a partial total gives a posterior that looks reasonable but is too large.
- In a two-draw urn problem, using the prior of the urn for the second draw instead of the updated probability. Why it tempts: The urn was chosen before any draw, so its prior seems to apply, but the first red ball has already changed which urn is likely.
- Computing the mean of a distribution as a simple average of the values. Why it tempts: The simple average of the values 0 to 3 is 1.5, a familiar figure; the weighted mean in the worked example is 2, because it needs the probabilities x p.
- Writing variance as E(X)² - E(X²) or forgetting to square the mean. Why it tempts: Both terms are present in the formula, and swapping them gives a negative number that students sometimes still report.
Time per question and fast method
Target: about 110 seconds per question.
For Bayes, scale to a convenient total (100, 1000 or the common denominator) and read the posterior as one branch count over the total of all branches. For distributions, find the constant from the sum, build a two-row table of x and p, and compute E(X) and E(X²) in one pass. Check that the posteriors add to 1.
Recall quiz
Pick an option for each question. Your answers stay on this page and are not sent anywhere.
Score: 0 of 6 correct. Pick an option for each question.
Practice
- A random variable X takes the values 1, 2, 3 and 4 with P(X = x) = k x. The mean of X is Verified (T1)
- Machines P, Q and R make 50, 30 and 20 percent of the output, and 2, 3 and 5 percent of their items… Verified (T1)
- A fair die is thrown. If it shows 1 or 2, a ball is drawn from Urn I (3 red and 2 blue balls); otherwise a… Verified (T1)
- A fair die is thrown twice and X is the larger of the two numbers shown. If E(X) = m/36, then m is ___. Verified (T3)
Previous-year questions
Previous-year questions are not imported yet. Previous-year questions are not imported yet; see the official papers on the NTA site. Official NTA papers page.
Going deeper and revision
Total probability and Bayes theorem: statement and conditions
Let E1, ..., En be pairwise mutually exclusive events with E1 or ... or En = S and P(E_i) greater than 0. Then for any event A: P(A) = sum of P(E_j) P(A | E_j) and P(E_i | A) = P(E_i) P(A | E_i)/P(A). The conditions that matter are the partition (nothing missing and no overlap) and the correct likelihoods P(A | E_i). If the causes are equally likely the priors cancel and the posterior is proportional to the likelihoods alone. For two causes the formula is the ratio of one branch product to the sum of both branch products.
Priors, likelihoods and posteriors: the classic error
The most common error is to answer with the likelihood P(A | E_i) when the posterior P(E_i | A) is asked. A device that flags 95 percent of faulty items and wrongly flags 4 percent of good ones, used on a stock in which 2 percent of items are faulty, gives a posterior for "faulty given flagged" of about 0.33, far from 0.95, because good items vastly outnumber faulty ones. The numbers are hypothetical. Rare causes stay improbable even after a positive sign. In exam wording look for "it is found that", "the item is defective" or "the ball drawn is red", then ask which event is the cause.
Multi-stage experiments and sequential information
When more than one draw is made from a randomly chosen urn, the first observation updates the probability of the urn, and the second draw is taken from the updated mix. With urns of 3 red and 2 blue, and 1 red and 4 blue, chosen with prior 1/3 and 2/3, observing a red ball makes the first urn more likely, 3/5 instead of 1/3, so a second red ball has probability (3/5)(2/4) = 3/10. Equivalent: P(both red)/P(first red). Without replacement an urn with too few red balls contributes zero to the later stage, which is a place where branches drop out.
Distribution of a random variable: constructing, mean and variance
To construct the distribution list every value of X, count the outcomes giving each value and check that the counts add to the size of the sample space. Mean and variance are then the weighted sums. Useful results: for X = number of heads in two tosses, mean 1 and variance 1/2; for the larger of two dice the mean is 161/36; for the number of aces in two cards drawn without replacement the mean is 2/13. E(X) lies between the least and greatest values of X; variance is zero only for a constant. Linearity of expectation, E(X + Y) = E(X) + E(Y), holds always, but Var(X + Y) = Var(X) + Var(Y) needs independence.
Expected gain, fair games and limiting checks
A game with payoff g_i and probability p_i has expected gain E(G) = sum of g_i p_i. The sign is what matters: a positive value favours the player. A check on any posterior question is that the posteriors for all causes add to 1, and that the posterior of a cause equals its prior if the likelihoods of all causes are equal (the observation carries no information). A check on a distribution is that the sum is 1 and that the mean lies between the extreme values.
Memory hook
Suppose a tea stall owner in Lucknow buys biscuit packets from three suppliers, and one morning a customer finds a packet with a broken seal.
- Before the complaint the owner only knows how many packets each supplier sends in a week, the prior share of each.
- He also knows from past complaints how often each supplier sends a broken seal, the likelihood for each.
- For the broken packet in hand he multiplies share by breakage rate for each supplier and asks which product is the largest part of the total: that part is the posterior, the chance the packet came from that supplier.
Bayes theorem is share x breakage rate for the cause in question, divided by the total of share x breakage rate over all causes.
The posterior is the cause's share of all the ways the observed effect could have happened.
Revision card
Try to answer each without looking above.
- State the law of total probability and the conditions on the events E1 to En.
- Write Bayes theorem and say which term is the prior, the likelihood and the posterior.
- How do you find an unknown constant in a probability distribution?
- Write E(X), E(X²) and the variance of a random variable.
- Give E(aX + b) and Var(aX + b).
- Why is P(faulty | flagged) not equal to P(flagged | faulty), and what check do the posteriors satisfy?
Sources and review
Reviewed Reviewed on 2026-11-20: every number recomputed by code and independently reviewed; textbook section references pending.
- Method: Every number in worked examples, recall checks and notes recomputed by code; claims recomputed independently by a separate verifier run using other numerical methods; textbook section references not yet attached; wording defects found were fixed afterwards and re-linted (code checks re-run) but not re-reviewed by a second run; syllabus scope compared with the NTA JEE Main 2026 syllabus text (by the verifier; see the report)
- Reviewer: independent verifier agent run (not the author)
- Date: 2026-11-20
- Defects found: 1; fixed: 1
- Report: content/reviews/learn4-prb-2026-11-20.md
Textbook references
- NCERT Mathematics Part 2, Class 12 (reprint 2026-27), Chapter 13: Probability, 13.5.2 Theorem of total probability (read 2026-11-22)
- NCERT Mathematics Part 2, Class 12 (reprint 2026-27), Chapter 13: Probability, 13.5.1 Partition of a sample space (read 2026-11-22)
- NCERT Mathematics Part 2, Class 12 (reprint 2026-27), Chapter 13: Probability, 13.5 Bayes' Theorem (read 2026-11-22)
Sources used
- Syllabus: NTA JEE (Main) 2026 syllabus, Mathematics, Unit 13 (https://jeemain.nta.nic.in/document/syllabus-2026/), imported into syllabus/lines/jee-main/2026.json
- NTA JEE (Main) 2026 syllabus, Mathematics, Unit 13 (https://jeemain.nta.nic.in/document/syllabus-2026/), read for scope
- Standard results of school-level statistics and probability; no textbook section reference attached yet (to be sourced at verification). Content written fresh for this site.
How labels work: see how answers and lessons are verified. Found a mistake? Use Report an error on any question page.