Section 1 · 7 min read

Probability and statistics

Probability rules, conditional probability and Bayes theorem, random variables, the uniform, binomial, Poisson, exponential and normal distributions, and mean, median, mode and standard deviation.

On this page
  1. Basic rules
  2. Random variables
  3. Standard distributions
  4. Descriptive statistics
  5. Worked examples
  6. Common traps
  7. Quick revision

Probability is one of the highest scoring parts of the mathematics section in GATE CS, typically worth 2 to 4 marks, and many of the questions are numerical answer type. Most problems combine a counting step with one of a few rules: complement, total probability, Bayes, linearity of expectation, or a standard distribution.

Basic rules

For events A,BA, B in a sample space SS:

  • 0≤P(A)≤10 \le P(A) \le 1, P(S)=1P(S) = 1, P(Aˉ)=1−P(A)P(\bar A) = 1 - P(A).
  • P(A∪B)=P(A)+P(B)−P(A∩B)P(A \cup B) = P(A) + P(B) - P(A \cap B).
  • For equally likely outcomes: P(A)=∣A∣∣S∣P(A) = \frac{|A|}{|S|}.

Conditional probability: P(A∣B)=P(A∩B)P(B)P(A \mid B) = \dfrac{P(A \cap B)}{P(B)} for P(B)>0P(B) > 0.

Multiplication rule: P(A∩B)=P(B) P(A∣B)P(A \cap B) = P(B)\,P(A \mid B).

Independence: AA and BB are independent iff P(A∩B)=P(A)P(B)P(A \cap B) = P(A)P(B). Mutually exclusive events with nonzero probabilities are never independent, because P(A∩B)=0≠P(A)P(B)P(A \cap B) = 0 \ne P(A)P(B). Pairwise independence of three events does not imply mutual independence.

Total probability and Bayes theorem

If B1,…,BkB_1, \dots, B_k partition the sample space, P(A)=∑iP(Bi) P(A∣Bi),P(A) = \sum_i P(B_i)\,P(A \mid B_i), P(Bj∣A)=P(Bj) P(A∣Bj)∑iP(Bi) P(A∣Bi).P(B_j \mid A) = \frac{P(B_j)\,P(A \mid B_j)}{\sum_i P(B_i)\,P(A \mid B_i)}.

A tree diagram is the cleanest way to organise these: branch first on the cause (BiB_i), then on the observation (AA), multiply along branches, and divide the branch you want by the total of all branches that end in AA.

Random variables

A discrete random variable has a probability mass function p(x)=P(X=x)p(x) = P(X = x) with ∑p(x)=1\sum p(x) = 1. A continuous one has a density f(x)≥0f(x) \ge 0 with ∫f=1\int f = 1, and P(a≤X≤b)=∫abf(x) dxP(a \le X \le b) = \int_a^b f(x)\,dx. For continuous XX, P(X=a)=0P(X = a) = 0 for every single value aa.

The cumulative distribution function is F(x)=P(X≤x)F(x) = P(X \le x). It is non-decreasing, goes from 0 to 1, and f=F′f = F' for continuous XX.

Expectation and variance

E[X]=∑x p(x)   or   ∫xf(x) dx,Var⁡(X)=E[X2]−(E[X])2.E[X] = \sum x\,p(x) \;\text{ or }\; \int x f(x)\,dx, \qquad \operatorname{Var}(X) = E[X^2] - (E[X])^2.

  • Linearity: E[aX+bY+c]=aE[X]+bE[Y]+cE[aX + bY + c] = aE[X] + bE[Y] + c, always, even for dependent variables.
  • Var⁡(aX+b)=a2Var⁡(X)\operatorname{Var}(aX + b) = a^2 \operatorname{Var}(X).
  • Var⁡(X+Y)=Var⁡(X)+Var⁡(Y)\operatorname{Var}(X + Y) = \operatorname{Var}(X) + \operatorname{Var}(Y) when X,YX, Y are independent (more generally, uncorrelated).
  • E[XY]=E[X]E[Y]E[XY] = E[X]E[Y] for independent X,YX, Y.
  • Standard deviation σ=Var⁡(X)\sigma = \sqrt{\operatorname{Var}(X)}.

Indicator trick: to find the expected count of something, write the count as a sum of indicator variables IjI_j and use E[∑Ij]=∑P(event j)E[\sum I_j] = \sum P(\text{event } j). For example, the expected number of fixed points of a random permutation of nn elements is n⋅1n=1n \cdot \frac{1}{n} = 1.

Standard distributions

Distribution PMF or PDF Mean Variance
Bernoulli(pp) P(1)=pP(1) = p, P(0)=1−pP(0) = 1 - p pp p(1−p)p(1-p)
Binomial(n,pn, p) (nk)pk(1−p)n−k\binom{n}{k}p^k(1-p)^{n-k} npnp np(1−p)np(1-p)
Geometric(pp), trials until first success (1−p)k−1p(1-p)^{k-1}p, k≥1k \ge 1 1/p1/p (1−p)/p2(1-p)/p^2
Poisson(λ\lambda) e−λλkk!\dfrac{e^{-\lambda}\lambda^k}{k!} λ\lambda λ\lambda
Uniform(a,ba, b) 1b−a\dfrac{1}{b - a} on [a,b][a, b] a+b2\dfrac{a + b}{2} (b−a)212\dfrac{(b - a)^2}{12}
Exponential(λ\lambda) λe−λx\lambda e^{-\lambda x}, x≥0x \ge 0 1/λ1/\lambda 1/λ21/\lambda^2
Normal(μ,σ2\mu, \sigma^2) 1σ2πe−(x−μ)2/(2σ2)\dfrac{1}{\sigma\sqrt{2\pi}}e^{-(x-\mu)^2/(2\sigma^2)} μ\mu σ2\sigma^2

Discrete uniform on {1,…,n}\{1, \dots, n\}: mean n+12\frac{n+1}{2}, variance n2−112\frac{n^2 - 1}{12}.

Notes on each

  • Binomial: number of successes in nn independent trials with the same pp. Given the mean and variance, 1−p=variancemean1 - p = \frac{\text{variance}}{\text{mean}}.
  • Poisson: counts of rare events in a fixed interval. It approximates Binomial(n,pn, p) with λ=np\lambda = np when nn is large and pp small. The sum of independent Poisson(λ1\lambda_1) and Poisson(λ2\lambda_2) is Poisson(λ1+λ2\lambda_1 + \lambda_2). If the rate is λ\lambda per unit time, the count in time tt is Poisson(λt\lambda t).
  • Exponential: waiting time between Poisson events. P(X>t)=e−λtP(X > t) = e^{-\lambda t}. It is memoryless: P(X>s+t∣X>s)=P(X>t)P(X > s + t \mid X > s) = P(X > t). Mean equals standard deviation. The minimum of independent exponentials with rates λ1,λ2\lambda_1, \lambda_2 is exponential with rate λ1+λ2\lambda_1 + \lambda_2.
  • Normal: symmetric about μ\mu, so mean = median = mode. Standardise with Z=X−μσZ = \frac{X - \mu}{\sigma}. Roughly 68%, 95% and 99.7% of the mass lies within 1, 2 and 3 standard deviations. A linear function aX+baX + b of a normal variable is normal with mean aμ+ba\mu + b and variance a2σ2a^2\sigma^2. The sum of independent normals is normal.
  • Uniform: probabilities are lengths (or areas, for two independent uniforms on a square) divided by the total.

Descriptive statistics

For data x1,…,xnx_1, \dots, x_n:

  • Mean xˉ=1n∑xi\bar x = \frac{1}{n}\sum x_i.
  • Median: middle value after sorting; for even nn, the average of the two middle values.
  • Mode: most frequent value (there can be several).
  • Variance (population) 1n∑(xi−xˉ)2=x2‾−xˉ2\frac{1}{n}\sum (x_i - \bar x)^2 = \overline{x^2} - \bar x^2. The sample variance divides by n−1n - 1 instead. GATE usually means the population version unless it says "sample".
  • Adding a constant to every value shifts mean, median and mode by that constant and leaves the variance unchanged. Multiplying by cc scales the mean by cc and the variance by c2c^2.
  • For a moderately skewed distribution, an empirical relation is mode≈3 median−2 mean\text{mode} \approx 3\,\text{median} - 2\,\text{mean}.
  • In a right-skewed (long right tail) data set, typically mode < median < mean; left-skewed reverses it.

Worked examples

Worked example 1: Bayes with three sources

Machines M1,M2,M3M_1, M_2, M_3 produce 50%, 30% and 20% of the items in a factory, with defect rates 1%, 2% and 3%. An item is found defective. What is the probability that M3M_3 made it?

  1. Branch products: 0.5×0.01=0.0050.5 \times 0.01 = 0.005, 0.3×0.02=0.0060.3 \times 0.02 = 0.006, 0.2×0.03=0.0060.2 \times 0.03 = 0.006.
  2. P(defective)=0.017P(\text{defective}) = 0.017.
  3. P(M3∣defective)=0.0060.017≈0.353P(M_3 \mid \text{defective}) = \frac{0.006}{0.017} \approx 0.353.

Worked example 2: Expected value by indicators

Each of 10 people throws their hat into a pile and takes one back at random. Each of 6 balls is then thrown independently into one of 4 bins. Find (a) the expected number of people who get their own hat, and (b) the expected number of empty bins.

(a) Each person has probability 110\frac{1}{10} of getting their own hat, so the expected number is 10×110=110 \times \frac{1}{10} = 1.

(b) A given bin stays empty with probability (34)6≈0.178\left(\frac{3}{4}\right)^6 \approx 0.178, so the expected number of empty bins is 4×0.178≈0.7124 \times 0.178 \approx 0.712.

Linearity works even though the events are dependent.

Worked example 3: Poisson count

Requests arrive at a server as a Poisson process at 3 per second. What is the probability of at least 2 requests in a given second?

P(X≥2)=1−P(0)−P(1)=1−e−3(1+3)=1−4e−3≈1−0.199=0.801.P(X \ge 2) = 1 - P(0) - P(1) = 1 - e^{-3}(1 + 3) = 1 - 4e^{-3} \approx 1 - 0.199 = 0.801.

Worked example 4: Continuous density

XX has density f(x)=c(1−x2)f(x) = c(1 - x^2) on [−1,1][-1, 1]. Find cc and P(X>0.5)P(X > 0.5).

  1. ∫−11(1−x2) dx=2−23=43\int_{-1}^{1} (1 - x^2)\,dx = 2 - \frac{2}{3} = \frac{4}{3}, so c=34c = \frac{3}{4}.
  2. P(X>0.5)=34∫0.51(1−x2) dx=34[(1−0.5)−1−0.1253]=34(0.5−0.2917)≈0.156P(X > 0.5) = \frac{3}{4}\int_{0.5}^{1}(1 - x^2)\,dx = \frac{3}{4}\left[(1 - 0.5) - \frac{1 - 0.125}{3}\right] = \frac{3}{4}\left(0.5 - 0.2917\right) \approx 0.156.

Worked example 5: Geometric waiting

A fair die is rolled until a 6 appears. What is the probability that more than 3 rolls are needed, and what is the expected number of rolls?

  1. More than 3 rolls means the first 3 are not 6: (56)3=125216≈0.579\left(\frac{5}{6}\right)^3 = \frac{125}{216} \approx 0.579.
  2. Geometric with p=16p = \frac{1}{6}: E=1p=6E = \frac{1}{p} = 6.

Common traps

  • Treating mutually exclusive as independent.
  • Dividing by the wrong total in Bayes: the denominator is the probability of the observed evidence, summed over all causes.
  • Writing Var⁡(aX+b)=aVar⁡(X)+b\operatorname{Var}(aX + b) = a\operatorname{Var}(X) + b. The constant disappears and aa is squared.
  • Adding variances of dependent variables.
  • Forgetting memorylessness: for an exponential lifetime, the time already survived does not matter.
  • Using the Poisson rate for the wrong interval length. Scale λ\lambda to the interval asked.
  • In "at least one" questions, multiplying the success probabilities instead of using 1−P(none)1 - P(\text{none}).
  • Confusing population and sample variance.

Quick revision

  • P(A∪B)=P(A)+P(B)−P(A∩B)P(A \cup B) = P(A) + P(B) - P(A \cap B); P(A∣B)=P(A∩B)/P(B)P(A \mid B) = P(A \cap B)/P(B).
  • Bayes: prior times likelihood, divided by the sum over all causes.
  • EE is always linear; variances add only for independent variables.
  • Var⁡(X)=E[X2]−E[X]2\operatorname{Var}(X) = E[X^2] - E[X]^2; Var⁡(aX+b)=a2Var⁡(X)\operatorname{Var}(aX + b) = a^2\operatorname{Var}(X).
  • Binomial: npnp, np(1−p)np(1-p). Poisson: mean = variance = λ\lambda.
  • Uniform[a,b][a, b]: a+b2\frac{a+b}{2}, (b−a)212\frac{(b-a)^2}{12}.
  • Exponential: mean 1/λ1/\lambda, P(X>t)=e−λtP(X > t) = e^{-\lambda t}, memoryless.
  • Normal: aX+b∼N(aμ+b,a2σ2)aX + b \sim N(a\mu + b, a^2\sigma^2); mean = median = mode.
  • Geometric: mean 1/p1/p; P(X>k)=(1−p)kP(X > k) = (1-p)^k.
  • Indicator variables turn expected counts into sums of probabilities.

Further reading

Test this section