Transformation between random variables If given realization of X and Y, which are i.i.d. Gaussian random variables.
We need to generate random variables C and D which are jointly Gaussian with zero mean and covariance matrix like
$
  \begin{bmatrix}
    2 & -1  \\
    -1 & 2 
  \end{bmatrix}$
using X and Y. How to provide a transformation that can be used to obtain C and D from X and Y?

from the covariance matrix $\sigma^2_C=2, \sigma^2_D=2, \sigma_{CD}=\sigma_{DC}=-1$.
Hence, $\rho_{CD}=\frac{-1}{2}$. The desired transform is
$$\begin{align}
C&=\sigma_CX\\
D&=\sigma_D(\rho_{CD}X+\sqrt{1-\rho^2_{CD}}Y)
\end{align}$$
It is assumed that $X$ and $Y$ are zero-mean. Otherwise, the same transformation should be used with $\tilde{X}=X-\mu_X$ and $\tilde{Y}=Y-\mu_Y$.
