Independent and identically distributed random variables Created 2026-09-24 Updated 2026-10-25
An independent and identically distributed sequence combines two conditions: its members are independent random variables, and every member has the same probability distribution. For a finite sequence with common law , this means that for all measurable sets ,For an infinite sequence, require this condition for every finite collection of distinct indices. Equal marginal distributions supply the common law; independence supplies the product. Neither condition supplies the other. Grinstead and Snell call the combination an independent trials process.[ref]
Introduction to Probability by Charles M. Grinstead and J. Laurie Snell. §4.1, Definitions 4.4–4.5, printed pp. 143–144: mutual independence and a common distribution
Choose a Bernoulli distribution with success probability . Four independent draws produce all sixteen binary patterns with probability each. If instead for one fair Bernoulli random variable , every member still has that same Bernoulli distribution, but only patterns
0000 and 1111 occur. Conversely, independently drawn Bernoulli random variables with success probabilities have a product joint probability distribution but unequal marginal distributions.IID sampling combines a common distribution with separate independent draws
. Original constructions of four Bernoulli random variables. Separate arrows in the first and third panels represent explicitly independent source draws; the middle panel copies one shared draw. Dependence and marginal laws are specified by the chosen models. Details.The combination is useful because one probability distribution describes each observation, while a product measure describes the full IID sample. In particular, an IID sample of finite-variance, real-valued observations has a predictable sample mean: its expected value stays at the population expected value, while its variance of a sample mean decreases as . This is a mechanism behind Monte Carlo integration and the finite-variance weak law of large numbers. Whether real observations satisfy the independence and common-law assumptions is a separate modelling question.
A weighting function must first be normalized to a probability density. The constant choice on meansEquivalently, transform and use the already normalized on . Independent samples give the unbiased Monte Carlo integration estimator
function uniform_monte_carlo(f, a, b, N):
require N >= 2
total = 0
total_squared = 0
for j in 1,...,N:
u = independent_uniform_0_1()
value = f(a+(b-a)*u)
total += value
total_squared += value*value
average = total/N
sample_variance = (total_squared-N*average*average)/(N-1)
integral = (b-a)*average
standard_error = abs(b-a)*sqrt(sample_variance/N)
return integral, standard_errorFor a general positive normalized importance density , replace each sample contribution by with . Here the uniform choice is the special case of importance sampling that assigns equal weight to every region of equal length.
With independent samples and finite variance, Monte Carlo integration has a root-mean-square stochastic error proportional to . The estimated standard error measures that random sampling uncertainty; it is not a deterministic bound.
For a sufficiently smooth one-dimensional integrand, the composite trapezoidal rule has errorfor some , hence . It is normally much more efficient in one dimension. The stated continuity assumption alone guarantees convergence, but does not guarantee this second-order rate; bounded second derivatives are an additional assumption.
The dimensional advantage is different: a tensor grid with total points in dimensions has only about points per direction and typically error . The Monte Carlo exponent remains , although its variance prefactor can still deteriorate with dimension. This explains why the stochastic method becomes attractive for high-dimensional integrals.
Past exam of the mathematics course of the University of Cambridge 2008 iii Paper 47 3 a Solution Created 2026-10-03 Updated 2026-10-14
A good pseudorandom number generator for Monte Carlo integration should have approximately uniform outputs, a period much longer than the intended run, and negligible detectable dependence both serially and in higher-dimensional tuples. It should be fast, reproducible from a seed, portable enough to reproduce a calculation, and numerically precise enough for the required tail probabilities. Values strictly inside avoid singularities in logarithmic inverse transform sampling. Separate simulations also need well-separated streams or seeds, rather than accidentally identical streams. A pseudorandom number generator is deterministic; these properties mean that it imitates independent uniform distributions sufficiently well for the application, not that its outputs are literally independent.
Past exam of the mathematics course of the University of Cambridge 2009 iii Paper 40 4 c Solution Created 2026-10-03 Updated 2026-10-14
There is a genuine normalization error in the printed function. Write independently, and . The internal sum produces a scalar; taking its mean does not divide by . The literal returned value is thereforeSince and , its expectation isIt does not estimate unbiasedly unless , and no fixed control variate coefficient removes this bias. In particular the actual call with returnsThis is an instance of summing before taking a mean changes Monte Carlo normalization.
The intended corrected method replaces the sum by a sample mean:It uses symmetry to write the tail as , then Monte Carlo integration on a bounded interval, and finally a mean-zero control variate. For the intended estimator is , whose summands are smooth and bounded. Keeping the average normalization, andDifferentiating this quadratic gives the Cauchy tail control variate on a bounded interval coefficientHere , , so . AlsoConsequentlyThe negative sign is consistent with decreasing and increasing. One may estimate the covariance and variance using a separate pilot sample and fix the resulting coefficient for a fresh sample. This coefficient minimizes the literal function's variance as well, but its missing factor of still leaves the bias above.
Past exam of the mathematics course of the University of Cambridge 2010 iii Paper 36 2 d Solution Created 2026-10-03 Updated 2026-10-14
Under independent area counts and independent area prior distributions, the joint posterior distribution factors into the gamma posteriors. For each simulation , draw one joint vector by independently generatingRank the risks within that joint draw, taking rank one to mean highest risk:The empirical posterior rank distribution and highest-risk probability areIndependent gamma draws make this direct Monte Carlo integration, so Markov chain Monte Carlo is unnecessary here. Continuous posteriors give ties probability zero, and the highest-risk probabilities sum to one. The same ranking calculation can be applied to dependent joint draws from a richer hierarchical Bayesian model; ranking separate posterior means would discard the uncertainty that the program is intended to measure.
The central limit theorem gives , so, with the cumulative distribution function of the standard normal distribution,The error has two tails. Using the supplied quantile, whose two-sided coverage is approximately , givesThe supplied quantile would be appropriate for a one-sided calculation; it would give only approximately two-sided coverage. Using the exact quantile instead of would give draws; we consistently use the paper's rounded value below.
For routine Monte Carlo integration, the central limit theorem calculation is preferable as a practical budget: it uses about one fifteenth as many draws as the Chebyshev's inequality bound. However, its coverage is approximate. Finite variance alone supplies no universal rate of convergence to the normal distribution; an integrand with large skewness or a heavy-tailed distribution can make the approximation poor even at a large sample count. If an unconditional finite-sample guarantee is required under only the stated assumptions, use the Chebyshev's inequality budget.
No: Monte Carlo integration is poorly suited to this smooth one-dimensional problem at such a tight tolerance. A sample-average Monte Carlo estimator has a standard error proportional to , whereas the deterministic composite Simpson's rule bound decreases as here and already certifies the target with tens of strips. Random sampling would require vastly more function evaluations and supplies a probabilistic error statement rather than the displayed deterministic guarantee.
A general-purpose high-dimensional choice is Monte Carlo integration. Draw independent vectors uniformly from the unit cube and evaluate . The cube has volume , so its integral is the expected value of . The iterative estimator isThe integrand is continuous on a compact set, hence bounded with finite variance. The strong law of large numbers gives almost sure convergence, and the square root of the mean squared error is exactly , where . Thus the standard stochastic accuracy rate is ; the dimension affects the variance and evaluation cost, not this exponent.
There is also an important structure-specific improvement here: is a separable integrand. The Fubini theorem reduces the requested value exactly toOne can therefore replace high-dimensional sampling by one-dimensional composite Simpson's rule calculations. For each factor use even , , andthen iterate and form the sum of the products. These smooth factors give deterministic discretization error for fixed centres. Thus Monte Carlo integration is a valid generic answer, while exploiting separability is the more efficient specialized alternative; a large dimension alone does not force a tensor-product grid.
A convenient choice for this irregular region is Monte Carlo integration. The region is contained in . For independent uniform points in that square, letThe indicator random variable incorporates the curved boundary directly. This estimator is unbiased; the integrand is bounded on the square, so its variance is finite. The variance of a sum of independent terms gives root mean square error in big O notation. This is a stochastic error rate. Applying a rectangular Simpson's rule to the indicator-weighted integrand would lose the smoothness required for its fourth-order error bound.
For a generic integrand in 20 dimensions, Monte Carlo integration gives root mean square error , whereas tensor-product quadrature with composite Simpson's rule gives only . One can sample uniformly in the Euclidean unit ball, for example by an independent uniform direction and radius with uniform on .
For this particular integrand, the most efficient elementary choice uses radial integration over a ball first. The area of the unit 19-sphere is , as follows from the volume of an n-ball. HenceThe reduced integrand is smooth. Apply composite Simpson's rule to obtain deterministic error in big O notation, with one original radial integrand evaluation per node. If the selection is restricted to direct multidimensional methods, Monte Carlo integration with root mean square error is the appropriate choice.
Pseudorandom number generator Created 2026-10-14 Updated 2026-10-20
A pseudorandom number generator is a deterministic state-update algorithm producing numbers intended to imitate an independent sequence from a prescribed probability distribution. For Monte Carlo integration, desirable features include good one-dimensional and multidimensional uniformity, a period far longer than the calculation, negligible detectable dependence, reproducible seeds, sufficient numerical precision and fast generation. Uniform marginal distributions alone do not provide independent draws.
