Happy Dussehra! May good always win. Happy Diwali! Wishing you a bright year ahead. Merry Christmas! Warm wishes from Vizag. Happy New Year! Here’s to a great year ahead.

AI · Written by Claude

Probability & Statistics

The key ideas of Probability and Statistics: probability rules, random variables and distributions, sampling, estimation and hypothesis testing, and correlation and regression, with where each is used in monitoring, A/B tests and machine learning.

By Claude7 min read

  • Revisit
  • Probability & Statistics
  • Engineering

Probability is the mathematics of uncertainty; statistics uses data to make decisions despite it. Today this subject sits under A/B tests, alert thresholds, capacity planning, reliability targets and every machine-learning model. This article revisits the five units of the JNTUK course.

Unit 1: Probability

Basic definitions

Term Meaning
Experiment A process with uncertain outcome (rolling a die)
Sample space S The set of all outcomes
Event A subset of the sample space
Probability P(A) A number from 0 to 1; P(S) = 1

If all outcomes are equally likely, P(A) = favourable outcomes / total outcomes.

Rules

Rule Formula
Complement P(not A) = 1 − P(A)
Addition P(A ∪ B) = P(A) + P(B) − P(A ∩ B)
Conditional P(A | B) = P(A ∩ B) / P(B)
Multiplication P(A ∩ B) = P(A) P(B | A)
Independence A and B are independent if P(A ∩ B) = P(A) P(B)

Mutually exclusive events cannot happen together; that is different from independent.

Total probability and Bayes’ theorem

If events B₁, …, Bₙ partition the sample space, the total probability of A is Σ P(A | Bᵢ) P(Bᵢ). Bayes’ theorem reverses a conditional probability:

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

Example: a disease affects 1% of people. A test detects it 99% of the time but also gives a false positive for 5% of healthy people. If you test positive, the chance you actually have it is 0.99 × 0.01 / (0.99 × 0.01 + 0.05 × 0.99) ≈ 17%, far lower than most people guess, because healthy people are so much more numerous.

Today: Bayes’ theorem is behind spam filters and diagnostic tools. It is also why an alert with a small false-positive rate can still be wrong most of the time when the thing it detects is rare.

Unit 2: Random variables and expectation

A random variable X assigns a number to each outcome. It is discrete (countable values, described by a probability mass function) or continuous (described by a probability density function f(x), where probabilities are areas under the curve). The cumulative distribution function F(x) = P(X ≤ x) works for both.

Expectation and variance

Quantity Discrete formula Meaning
Mean E(X) Σ x P(x) The long-run average
Variance Var(X) E(X²) − (E(X))² Spread around the mean
Standard deviation √Var(X) Spread, in the units of X

Properties: E(aX + b) = a E(X) + b; Var(aX + b) = a² Var(X); for independent variables the variances add. The moment generating function produces all moments of a distribution. Chebyshev’s inequality says at least 1 − 1/k² of any distribution lies within k standard deviations of the mean.

Today: an SLO error budget is an expected value; “p99 latency” is a point on the cumulative distribution. A mean can hide a long tail, which is why both mean and spread are reported.

Unit 3: Probability distributions

Discrete distributions

Distribution Models Mean Variance
Bernoulli One yes/no trial with probability p p p(1 − p)
Binomial B(n, p) Number of successes in n independent trials np np(1 − p)
Poisson(λ) Number of events in a fixed interval, rare and independent λ λ
Geometric Trials until the first success 1/p (1 − p)/p²

The Poisson distribution approximates the binomial when n is large and p is small.

Continuous distributions

Distribution Models Notes
Uniform Every value in [a, b] equally likely Mean (a + b)/2
Exponential(λ) Waiting time between Poisson events Mean 1/λ; “memoryless”
Normal N(μ, σ²) Bell curve; sums of many small effects Symmetric; mean μ, variance σ²

For the normal distribution, about 68% of values lie within 1σ of the mean, 95% within 2σ and 99.7% within 3σ. Any normal variable is converted to the standard normal with Z = (X − μ) / σ and read from a Z-table. The central limit theorem: the average of many independent samples is approximately normal, whatever the original distribution.

Today: requests per second to a service are roughly Poisson, and the time between them is exponential, which is the basis of queueing models. Errors per thousand requests are binomial. The 3σ rule underlies simple anomaly-detection thresholds on metrics.

Unit 4: Sampling and estimation

Population and sample

A population is everything of interest; a sample is the part you observe. Parameters (μ, σ) describe populations; statistics (x̄, s) describe samples. The sample mean has its own distribution, with mean μ and standard error σ/√n, so larger samples give tighter estimates.

Estimation

Idea Meaning
Point estimate A single value from the sample (x̄ for μ)
Unbiased estimator Its average over many samples equals the true parameter (sample variance divides by n − 1)
Confidence interval A range built to contain the true parameter with a stated probability
Maximum likelihood Choose the parameter that makes the observed data most probable

A 95% confidence interval for a mean (large sample) is x̄ ± 1.96 σ/√n. It does not mean “95% probability that the true mean is inside this particular interval”; it means the method captures the true value in 95% of repeated samples. For small samples with unknown σ, the t-distribution is used. Intervals for proportions work similarly.

Today: a load test run once gives a point estimate; running it ten times gives an interval. Survey and benchmark numbers without a sample size or interval should be treated with caution.

Unit 5: Hypothesis testing, correlation and regression

Hypothesis testing

You test a claim by asking whether the data would be surprising if the claim about “no effect” were true.

Step Detail
1. Hypotheses Null H₀ (no effect) versus alternative H₁
2. Significance level α The acceptable false-alarm rate, usually 0.05
3. Test statistic Z, t, χ² or F, from the data
4. Decision Compare with the critical value, or use the p-value: reject H₀ if p < α
Error Meaning
Type I Reject a true H₀ (false positive), probability α
Type II Fail to reject a false H₀ (false negative), probability β

Common tests: the Z-test and t-test (compare means), the chi-square test (categorical data, goodness of fit, independence) and the F-test (compare variances; ANOVA compares several means). A p-value is the probability of seeing data at least this extreme if H₀ is true; it is not the probability that H₀ is true.

Correlation and regression

Correlation r measures the strength of a linear relationship, from −1 to +1. Regression fits a line y = a + bx by least squares, with slope b = Σ(x − x̄)(y − ȳ) / Σ(x − x̄)². The coefficient of determination r² is the share of variation explained by the line. Correlation does not imply causation: two things can move together because of a third factor.

Queueing (as covered in the syllabus)

An M/M/1 queue has Poisson arrivals at rate λ and exponential service at rate μ. Utilization ρ = λ/μ; the average number in the system is ρ / (1 − ρ), which grows sharply as ρ approaches 1.

Today: A/B tests are hypothesis tests on conversion rates; flaky-test detection and regression checks on latency use the same logic. Linear regression is the simplest machine-learning model. The queueing result explains why a server at 90% utilization has far longer waits than one at 60%, and why autoscalers keep headroom.

One-minute recap

Unit Key idea You meet it in
1. Probability Addition, conditional, Bayes’ theorem Spam filters, alert false positives
2. Random variables Mean, variance, CDF Latency percentiles, error budgets
3. Distributions Binomial, Poisson, exponential, normal; central limit theorem Request arrivals, anomaly thresholds
4. Sampling and estimation Standard error, confidence intervals Load tests, benchmarks, surveys
5. Testing and regression H₀, p-value, Type I and II errors, least squares A/B tests, trend lines, capacity planning

Next in Engineering Revisited: Computer Graphics.


Written by Claude, Anthropic’s AI assistant, as part of Engineering Revisited, a quick refresher of the B.Tech subjects one at a time.

Spotted something wrong or out of date?Suggest a correction. I review every suggestion before changing the page.