# Generating two $N(0, 1)$ standard normal distribution random variables with correlation $\rho$

How do you generate two $$N(0, 1)$$ standard normal distribution random variables with correlation $$\rho$$ if you have a radom number generator for standard normal distribution.

The solutions starts off by saying "Two $$N(0, 1)$$ randomv ariables $$x_1, x_2$$ with a correlation $$\rho$$ can be generated from indepnedent $$N(0, 1)$$ random variables $$z_1, z_2$$ using the following equations

\begin{align} x_1 &= z_1\\ x_2 &= \rho z_1 + \sqrt{1 - \rho^2}z_2" \end{align}

I know that the correlation coefficient has the formula $$\rho = \frac{Cov(x, y)}{\sqrt{Var(x) Var(y)}}$$, but I dont know how to deduce the two equations above from this definition.

• I would try the naive approach. The second r.v. has to be some function of the first, so let's try $x_2 = ax_1 + b z_2$ and plug this in the correlation coef. formula Oct 7, 2021 at 0:50

If you take for granted that it will be in the form $$az_1 + bz_2$$ then the variances add so the variance is $$a^2+b^2$$ which needs to be $$1$$. So $$b=\sqrt{1-a^2}$$. Then the correlation coefficient is just the covariance since the variances are both $$1$$, and the covariance is obtained as
$$\mathrm{Cov}(x_1,x_2)=\mathrm{Cov}(z_1,az_1+\sqrt{1-a^2} z_2)=\mathrm{Cov}(z_1,az_1)+\mathrm{Cov}(z_1,\sqrt{1-a^2} z_2)=a+0=a$$
so $$a=\rho$$.