What is it?
A function with whose integral over a set is the probability of that set. A density is not a probability: it can exceed 1; it is probability per unit length.
Why does it exist?
With infinitely many possible values, each individual value must have probability zero, yet some regions are more likely than others. The density describes that relative likelihood, and integration recovers actual probabilities.
Intuition
Think of a histogram of many samples with bins getting thinner and thinner, normalized so the total area is 1. In the limit the bars become a curve: the density. Probability is area under it; is the probability of landing in a tiny interval near .
Formal definition
has density if for every (measurable) set , with and . Then where is the cumulative distribution function.
Formulas
- normal (Gaussian) density
- Bayes' rule for densities
Example
Uniform on : there. The density is 2 (> 1) but every probability is fine: .
Why does it matter?
Generative AI is density modelling: VAEs, normalizing flows and diffusion models all learn a density of images or sounds (explicitly or through its score ). Bayesian inference updates densities with data, and the normalizing integral in the denominator is usually the hard part.
Where it shows up in computing
The Kalman filter propagates Gaussian densities of the state through predictions and measurements.
Where it shows up in AI
Generative models learn densities; diffusion models learn the score .
Priors, likelihoods and posteriors over continuous parameters are densities.
Regression losses are negative log-densities: squared error ↔ Gaussian noise, absolute error ↔ Laplace noise.
Where is it used?
Computing topics reachable from here, through the chain of ideas that leads to them:
What depends on it
Exercises
For which is on a density? Compute .
Solution
, so . By symmetry .