Skip to main content

Probability and Statistics

From mathematical foundations to computational practice

Author

Shashikant Chaudhary

Published

November 28, 2026

Welcome

An independent, calculus-based textbook

Probability describes what a model says about an uncertain world. Statistics asks the reverse question: what can observations tell us about that model? This book builds the mathematics linking the two and makes the connection concrete with Python.

PDF edition

Full PDF edition

All 16 chapters, three appendices, and 94 worked solutions in one downloadable PDF.

Buy the full PDF
Navy book cover with mint and copper probability curves

Free Chapter 1 sample

Read the introduction and the complete chapter on probability spaces, with exercises and worked solutions.

Histogram of sampled data overlaid with a theoretical normal probability density.

A population probability density and a simulated sample. The smooth curve is a model; the histogram is a finite collection of observations.

Who this book is for

This book is for readers who have met calculus, algebra and basic programming and want a solid working knowledge of probability and statistics. It is aimed at the transition between an undergraduate introductory course and the mathematical foundations of data science, AI and machine learning. We do not assume previous mastery of probability theory.

You should be comfortable manipulating fractions, powers, logarithms and summations; taking derivatives and elementary integrals; and writing simple Python functions. We will review double integrals, matrices and vectors when we need them. The Python reference provides a compact computing setup.

A useful distinction. An event has a probability within a specified model. An estimate is computed from data. Neither a decimal nor a confidence score is meaningful until you know which of these objects it describes.

The way to learn

Every new idea follows four complementary approaches:

  1. Build the model. Define the random experiment or inferential question, including assumptions and the quantities of interest.
  2. Do the mathematics. Derive the formula, justify the important steps, and check what happens in simple or limiting cases.
  3. Run an experiment. Simulate the model or calculate the result with Python and compare theory with observations.
  4. Interpret the result. Explain the answer in the language of the original problem, including what the calculation cannot establish.

For example, if a manufacturing process has independent outcomes represented by \(X_i \in \{0,1\}\) with \(\Pr(X_i=1)=p\), the sample proportion \(\widehat p = n^{-1}\sum_{i=1}^n X_i\) satisfies \(\operatorname{E}[\widehat p]=p\) and \(\operatorname{Var}(\widehat p)=p(1-p)/n\). A simulation can verify that repeated samples become more concentrated around \(p\) as \(n\) grows. This is the first connection between probability and estimation.

TipHow to use a chapter

Read with a notebook nearby. Reproduce each derivation before reading the next one. For a worked example, change a parameter and predict the answer before running the code. Solve the exercises independently, then expand Show Solution. Open the practice and solution notebooks directly in Google Colab, or download them for your local Jupyter environment.

Roadmap

Part Main direction
I. Foundations of probability Events, combinatorics, conditioning, discrete and continuous variables
II. Dependence and transformations Joint models, random vectors, Jacobians, convolution and generating functions
III. From probability to inference Convergence, sampling, simulation, estimation, intervals and tests
IV. Learning and stochastic models Bayesian inference, Markov chains, regression and classification

A focused four-week study route

The whole book is a reference as well as a course. If you are reviewing for AI/ML interviews or study, concentrate on the following core route, with approximately two to three hours per day. You can defer some of the longer proofs and study them on a second pass.

Week Read Practice goal
1 Chapters 1–4 Solve probability and distribution problems by hand; simulate them
2 Chapters 5–9 Work with dependence, transformations, MGFs and limit theorems
3 Chapters 10–13 Estimate parameters, construct intervals and test hypotheses
4 Chapters 14–16 Bayesian updating, stochastic dynamics and statistical learning

Do not equate finishing pages with learning: prioritize selected exercises, particularly programming problems, and keep a record of mistakes you can now explain.

Mathematical conventions

We use \(\Pr(A)\) for probability, \(\operatorname{E}[X]\) for expectation, \(\operatorname{Var}(X)\) for variance and \(\operatorname{Cov}(X,Y)\) for covariance. A capital letter usually indicates a random variable, while its lowercase counterpart represents an observed or possible value. A bold letter denotes a vector. The distribution notation \(N(\mu,\sigma^2)\) uses variance, not standard deviation, as its second parameter. \(\log\) means the natural logarithm unless a base is explicitly stated.1

1 The notation is deliberately consistent throughout the book. When reading documentation, check whether a library expects a variance, a standard deviation, a rate, or a scale. For example, SciPy’s exponential distribution takes a scale equal to the reciprocal of the rate.


Start with Chapter 1: Probability spaces.

Support this book

Help keep this resource growing.

The book is free for everyone to read. If it has helped you learn something new, you can support the work behind it with a coffee. Thank you for reading and learning along with me.

Buy me a coffee

Scan this QR code to open the Buy Me a Coffee page

Scan to support