# Sampling from a multivariate gaussian via affine transformation of uniform random samples?

I saw a proof some number of months ago and seem to have forgotten to bookmark it. Essentially, the proof showed that with just a few elements, the {mean vector, cov vector} of the target gaussian and a scalar randomly sampled from the uniform distribution with range [0,1], the target distribution could be sampled by an "affine transformation."

Could someone link and/or how this works? There's a decent chance that I'm confused and conflating ideas...

I doubt that your memory is correct.

An affine transformation of a multivariate uniform density will leave you with a uniform density over some hyper-parallelogram. Meanwhile a multivariate normal (of dimension $$p$$, say) has support over the whole of $$\mathbb{R}^p$$. This gap appears to be unbridgeable without some form of nonlinear transformation.

There are a variety of ways of generating independent standard Gaussian random variates from independent $$U(0,1)$$ random variates*, the simplest of which is perhaps the Box-Muller transformation, which takes a pair of independent standard uniform values to a pair of independent standard Gaussians.

If you have a source of independent standard Gaussians, then you can obtain a multivariate normal distribution from them with specified mean-vector $$\mathbf{\mu}$$ and variance-covariance matrix $$\mathbf{\Sigma}$$. Many questions on site discuss how to do this. Briefly: Let $$\mathbf{z}$$ be a vector of independent standard Gaussians. Let $$A$$ be a matrix such that $$AA^\top=\mathbf{\Sigma}$$. Then $$\mathbf{x}=A\mathbf{z}+\mathbf{\mu}$$ would have the required distribution.

As we see, the "affine" part would relate to getting correlated Gaussians with given mean from independent standard Gaussians.

A proof would require a few facts about means, variances and normal distributions:

- That $$E(AX+\mathbf{\mu}) = AE(X)+\mathbf{\mu}$$. (A basic property of expectations.)

- That $$\text{Var}(AX+\mathbf{\mu}) = A\text{Var}(X)A^\top$$. (A basic property of variances.)

- That linear combinations of multivariate normals have multivariate normal distributions.

Given the requisite facts the result follows immediately.

* if you have a source of such quantities

• My memory, as you noted, was absolutely wrong. I did, however, I find the link I was referring to. It primarily motivates the univariate and multivariate gaussians and describes how to sample from a multivariate gaussian via an affine transformation of the univariate gaussian sample. But it seems that I imagined the uniform -> normal transformation, as you noted. peterroelants.github.io/posts/multivariate-normal-primer Aug 17, 2021 at 18:20