Blog
Mathematical notes. RSS
Wavelets for images: 2-D, by hand and in code
The 2-D wavelet transform that courses skip. One 2 × 2 block by hand, and why it is a tiny Fourier transform; why there are exactly three detail bands; a worked 4 × 4 example and a live 8 × 8 one; the band names settled; pyramid and standard decompositions; compression against the 8 × 8 DCT and denoising against an oracle blur, reported honestly; NumPy and PyTorch code checked against PyWavelets; what separable wavelets get wrong about direction and shifts; and where wavelets live in modern machine learning. Part 4 of Seeing in frequencies.
Fourier analysis, from first principles
What a frequency is, why sinusoids and no other basis, how to derive any Fourier pair you need, why partial sums overshoot, and how to read the spectrum of an image. Part 1 of Seeing in frequencies: every step derived, with figures that run live on my own sketches.
The discrete Fourier world: sampling, aliasing, the FFT and the uncertainty principle
What changes when signals are sampled and finite. The four Fourier transforms and the rule that links them, Poisson summation and the sampling theorem, aliasing in images and inside neural networks, the DFT and FFT computed by hand in 1-D and 2-D, leakage and windows, the DCT behind JPEG, and a proof that no signal is sharp in both time and frequency. Part 2 of Seeing in frequencies.
Wavelets, from first principles
Windows that shrink as frequency grows; when such a transform can be inverted; Haar by hand; multiresolution analysis and the two-scale equation; the fast wavelet transform as a filter bank, and lifting; perfect reconstruction; vanishing moments and why they make signals sparse; Daubechies-4 solved by hand; denoising with a proof of the universal threshold; and what the discrete transform gets wrong. Part 3 of Seeing in frequencies.
Diffusion models from first principles
Why adding noise and learning to remove it generates data. The forward process and its reverse step, why predicting the noise is a likelihood bound, Tweedie's formula and denoising score matching, the SDE and the probability-flow ODE, why sampling needs many steps, and what guidance really does. Every step derived, on a toy where everything is exact, next to a diffusion model trained on it.
Flow matching: straight lines, curved flows
Continuous normalising flows trained without simulating them. The continuity equation and the instantaneous change of variables; why regressing on straight lines between random pairs learns the right flow; why flow matching and diffusion are one model; why the learned paths still curve, and how optimal-transport pairing and reflow straighten them. Every step derived, with the exact flow of a toy next to three trained networks.
Generative models, one map: what each family can compute
The opener of a series that ends at one-step generators. What it means to learn a distribution; maximum likelihood as a KL divergence; change of variables and normalising flows; VAEs; GANs and their divergences, including MMD; energy-based models, the score and Langevin dynamics; autoregressive models. Every result derived step by step, and a flow, a VAE and a GAN trained on the same data to show how each one fails.
One-step generators: learn the jump, not the velocity
Why one step of a perfect diffusion or flow model returns the data mean, and what to learn instead. The flow map and the three equations that pin it down; consistency models, shortcut models and MeanFlow as three ways of enforcing them; distribution matching, from DMD to drifting models. Every step derived, with seven one-step models trained on the same toy.
Sparse variational Gaussian processes: Titsias, Hensman and what came after
How a Gaussian process scales from thousands to millions of points without changing the model. Variational inference from scratch, inducing points, Titsias's collapsed bound, Hensman's stochastic version, how many inducing points you need, and the 2025 bounds that go beyond p(f | u). Every step derived.

Fourier and wavelets on the sphere
Why a flat FFT breaks at the poles, how spherical harmonics fix it, what Bochner's theorem becomes on a globe, and how needlets give a wavelet transform for the Earth. A from-scratch tutorial with proofs.

From Fourier to wavelets: putting non-stationarity in the basis
Fourier features made Gaussian processes scale, but every sinusoid spans the whole domain. Wavelets are local in space and frequency. How that one change gives fast, non-stationary kernels, and what it does for global weather fields.

One operator I keep coming back to
The Laplacian is everywhere: heat, diffusion models, Wasserstein gradient flows, Gaussian processes, spherical harmonics, wavelets, even music. A tour of the operator that asks how different you are from your neighbours.
Deep Gaussian processes: stacking uncertainty
What composing Gaussian processes buys and what it costs. If a composition of GPs is not a GP, how is anything computed? What does all the mathematics buy, what is new, and where are deep GPs still the right tool? Fundamentals first, every step derived, with a deep GP fitted and taken apart.
Concentration inequalities: how far can an average stray?
Markov, Chebyshev, Chernoff and Hoeffding from one picture, with step-by-step proofs, interactive figures, and the places they decide real numbers: sample sizes, generalisation bounds, random features and high-dimensional geometry.
The Gaussian toolkit: identities, linear-algebra moves and tricks
The identities and moves that experts use without thinking and beginners struggle with: whitening, low-rank updates, Schur complements and spectra; moments, conditioning in both forms, KL, Stein, Bonnet and Price; total variance, the ELBO and Fisher information; and how all of it runs reinforcement learning. Each with a step-by-step proof.
Kernels that output functions: matrix- and operator-valued kernels
From one output to many to a whole function. Matrix-valued kernels, coregionalisation, the Kronecker trick, operator-valued kernels and their RKHS, and Gaussian processes that learn operators. Every step derived.
Gaussian processes, from first principles
From Bayesian linear regression to kernels, exact conditioning, the marginal likelihood and a working implementation. Every step derived, nothing skipped; every idea interactive.