# Is Cholesky decomposition required to sample from a Gaussian given mean and variance matrix?

In the case of $X \sim \mathcal N(\mu, \Sigma)$ to sample from it one would need to perform Cholesky decomposition, is it also the case that this is required if $X ~ \sim \mathcal N(\mu, \sigma_{i,j}{I})$

where $\sigma_{i,j}{I}$ denotes a matrix with zeros everywhere except the diagonal, whose entries are not all equal, for example:

$$\begin{bmatrix}.3 & 0 & 0\\0 & .42 & 0\\0 & 0 & .362\end{bmatrix}$$

so that you have a variance matrix instead of a covariance matrix? Would it be appropriate in this case to just sample $X \sim \mathcal N(\mu, \sigma_{ij})$ where $\sigma_{ij}$ is a scalar, the $i,j$ entry of $\sigma_{i,j}{I}$ ?

• Your notation is at odds with itself: "$\sigma I$" ordinarily would be understood to mean a matrix with common values of $\sigma$ (a number) on its diagonal and zeros elsewhere. In this context, $\sigma_{ij}$ is either $0$ or $\sigma,$ rendering your reference to "$\sigma_{ij}$" confusing at best. What, then, do you mean by "variance matrix" versus "covariance matrix"? – whuber Mar 3 '18 at 21:39
• tried to make it clearer – atomsmasher Mar 3 '18 at 21:44
• Regarding the premise of the question -- it is not necessary to use Cholesky decomposition even in the general case. A matrix $A$ such that $\Sigma = AA^\top$ would suffice; Cholesky decomposition is one convenient way to get that, but it is not the only possible way to decompose $\Sigma$ into the product of a matrix and its transpose. [In the case of a diagonal matrix calculating the required decomposition becomes trivial.] – Glen_b Mar 3 '18 at 22:10

## 1 Answer

Your notation is still "non-standard".

Let's presume $X$ is an n by 1 random vector, which is distributed as $N(\mu,D)$, where $D$ is a diagonal matrix consisting of $\sigma^2_i$ for the ith diagonal term.

Then each component $X_i$ can be generated as $N(\mu_i,\sigma^2_i)$, independent of the other components of $X$. So if $Z$ is a n by 1 random vector of independent N(0,1) random variables, you can set $X_i = \mu_i + \sigma_i*Z_i$.

This is the same solution as would be provided by Cholesky decomposition because the Cholesky factor of the diagonal matrix $D$ has the simple form of being the diagonal matrix whose diagonal elements are the square roots of the corresponding diagonal elements of $D$.