Past exam of the mathematics course of the University of Cambridge 2015 iii Paper 37 4 a Solution Created 2026-10-03 Updated 2026-10-06
The generalized quantile function isThe tail limits of a cumulative distribution function make the defining set nonempty and its infimum finite. Monotonicity and right continuity imply exactly when . To see the direction involving the infimum, let points in the defining set decrease towards it; right continuity gives , so every larger also qualifies. Consequently, for a uniform distribution variable ,The probability-zero endpoints can be assigned arbitrary outputs. This proves inverse transform sampling even for distributions with atoms or flat portions; continuity or strict monotonicity of is not required.
Past exam of the mathematics course of the University of Cambridge 2015 iii Paper 37 4 c i Solution Created 2026-10-03 Updated 2026-10-06
Integrating the Weibull distribution density gives for . Inverse transform sampling therefore givesReplacing by produces the same probability distribution. Both uniforms belong to with probability one. Here the conventional Weibull scale is , rather than .
Past exam of the mathematics course of the University of Cambridge 2017 iii Paper 216 1 b Solution Created 2026-10-03 Updated 2026-10-06
Adaptive rejection sampling is exact rejection sampling for a differentiable log-concave probability density. Given interior evaluation points , construct the upper envelopewhere is the unnormalized target probability density function. The concave function lies below all its tangent lines, so . Interpolation between adjacent evaluation points gives a lower envelope there, allowing a squeeze test. The normalized upper envelope is a piecewise exponential proposal distribution.
Draw and an independent from the uniform distribution, and accept when . A squeeze test can establish acceptance without evaluating . Otherwise evaluate and, whenever it is evaluated, add to the envelope's points. Repeat until acceptance. On each linear piece , its integral is on , with value when . These integrals select a piece; inverse transform sampling samples within it.
Here, with and , the log-posterior on hasChoose evaluation points strictly inside , avoiding any endpoint singularities of the logarithm. Every finite set of tangent lines gives a finite upper-envelope integral on this bounded interval; slope conditions needed for unbounded supports are unnecessary. When the posterior distribution is simply the uniform distribution and may be sampled directly.
For any fixed envelope, proposal times acceptance is proportional to . Conditional on all past evaluations and rejections, the next accepted value therefore has the same normalized posterior density. To see that adaptation does not spoil this, at every attempted draw its accepted mass is a scalar times that fixed posterior density; summing over possible rejection histories preserves it. The acceptance probability stays bounded below by its positive initial-envelope value because insertion only lowers the upper envelope. Thus acceptance occurs almost surely. With fresh independent randomness, successive accepted values are exact independent samples from the posterior distribution, even when the envelope is retained and improved between them.
Past exam of the mathematics course of the University of Cambridge 2017 iii Paper 216 1 c Solution Created 2026-10-03 Updated 2026-10-06
An exact finite mixture model follows from the binomial theorem:Define positive mixture weightsHere is the Beta function, so the component probability distributions are . All coefficients are computable from the observed integer counts.
Use inverse transform sampling with the supplied to choose : writing and , take . Then recycle its position inside that interval,Recycling a uniform random variable after discrete sampling makes uniform independently of , since . It is also independent of all supplied random variables with gamma distributions. Transform these by the probability integral transform:They are independent random variables with uniform distributions because has a unit-rate exponential distribution.
Conditional on , put and . Form the values and return their th order statistic. This uses at most the supplied random variables with gamma distributions, since . The uniform order statistic formula givesAveraging these component probability density functions with weights recovers exactly the normalized posterior density. Unused inputs can be discarded. When , , , and the output is , as required. Interval endpoints and ties have probability zero; any consistent convention there is harmless. Exactness here concerns the mathematical algorithm; finite-precision arithmetic can be stabilized with logarithmic mixture weights.
Past exam of the mathematics course of the University of Cambridge 2019 iii Paper 350 2 b Solution Created 2026-10-03 Updated 2026-10-05
A simple choice is an independent Laplace distribution at each pixel, giving a Laplace prior for sparse images:Its negative log density penalizes the L1 norm. Relative to a normal distribution, it combines a sharp peak at zero with heavier tails, allowing most pixels to lie near the background level while a few have appreciable intensity. Quantitatively, , so the expected number of appreciable pixels is . Choosing large makes this small. This is a simple sparsity model: it does not enforce that nearby active pixels form connected objects, nor does its continuous density give exact zero pixels positive probability. Additional spatial modelling would be needed to insist on contiguous shapes.
To sample, draw independent and use inverse transform sampling:The endpoint events have probability zero and can be assigned arbitrary finite values. To justify the rule, the cumulative distribution function of a centered Laplace distribution isThe displayed rule is , so . Independence of random variables then gives the stated product prior distribution.
Past exam of the mathematics course of the University of Cambridge 2019 ii Paper 4 26K b i Solution Created 2026-09-24 Updated 2026-10-03
The quantile function is nondecreasing, hence a Borel measurable function. More explicitly, for every ,Thus is a random variable, and because Lebesgue measure is being used on ,Its cumulative distribution function is therefore , soThis is inverse transform sampling.
Past exam of the mathematics course of the University of Cambridge 2022 ii Paper 4 28K a Solution Created 2026-09-24 Updated 2026-09-25
Generate and setFor ,which is the distribution function of an exponential distribution with rate one. This is inverse transform sampling.
Past exam of the mathematics course of the University of Cambridge 2025 ii Paper 4 28L a Solution Created 2026-09-24 Updated 2026-09-25
Let be the quantile function. For ,The reverse implication is immediate from the infimum defining . For the forward implication, if there is a point with . If , choose with ; monotonicity and right continuity giveThe endpoint values have zero probability under a continuous uniform variable.
Past exam of the mathematics course of the University of Cambridge 2026 iii Paper 207 4 a Solution Created 2026-09-24 Updated 2026-09-25
If , the inverse transform sampling formulahas survival function and hence the required exponential distribution.
Probability integral transform Created 2026-10-05 Updated 2026-10-06
If has a continuous cumulative distribution function , then has the uniform distribution on . Combined with inverse transform sampling, this constructs the monotone rearrangement to a target with quantile function .
Sign-truncated normal sampling 2026-10-07
To draw restricted to a positive value, let and return for uniform . For restriction to a negative value use . These are inverse transform sampling constructions. Repeatedly drawing an untruncated normal until its sign agrees is also exact, but inefficient for rare signs.
Uniform random variable Created 2026-10-06 Updated 2026-10-07
A uniform random variable has a uniform distribution. Independent such variables can supply independent inverse transform sampling; reusing a single variable for two transforms generally creates dependence.