Generating samples of a Gaussian vector with independent components above a hyperplane Let $(Z_1,Z_2,\dots,Z_N)$ be a Gaussian vector with iid components, zero mean, and unit variance. Consider a hyperplane in $\mathbb{R}^N$. I am interested in generating samples of this Gaussian vector that fall on one side of the hyperplane.
For simplicity, let $N = 2$ and let the hyperplane be $aZ_1 + bZ_2 = c$. Suppose that I am interested in generating samples of $(Z_1,Z_2)$ such that $aZ_1 + bZ_2 > c$. Here is the solution methodology that comes to mind:


*

*Find the line perpendicular to $aZ_1 + bZ_2 = c$.

*Rotate this perpendicular line so that it coincides with the y-axis. I therefore get a rotation matrix here.

*Now my rotated line is $d$ units above (assume for simplicity; it could be below) the origin where $d$ is the distance of $aZ_1 + bZ_2 = c$ from the origin.

*Samples of $(Z_1,Z_2)$ can then be easily generated by first generating samples that lie above the rotated line and subsequently applying the inverse of the rotation matrix to these samples. I'm taking advantage of the fact that the components are independent.


This looks like a tedious task even in 2-dimensions. I am wondering if there is a simpler approach that translates very well to $N$-dimensions.
Suggestions appreciated!
 A: You don't need a rotation; a reflection is good enough and less complicated. All you want is that some axis direction is transformed into the normal. You also don't really need to “find” the normal; it's the unit vector along $\pmatrix{a\\b}$. More generally, let the hyperplane be defined by $\vec n\cdot\vec z=c$; rescale this to
$$
\frac{\vec n}{|\vec n|}\cdot\vec z=\frac c{|\vec n|}
$$
and write this as $\vec n'\cdot z=c'$, so that $\vec n'$ is a unit vector normal to the hyperplane. Let $\vec e$ denote the unit vector along, say, the $x_1$ axis. Then reflecting in the plane through the origin perpendicular to $\vec n'-\vec e$ flips $\vec e$ onto $\vec n'$. Denote the unit normal $\frac{\vec n'-\vec e}{|\vec n'-\vec e|}$ of this plane by $\vec r$. Draw from the distribution truncated at $x_1=c'$ for $x_1$, and from the full distribution for all other components. Denote the resulting vector by $\vec x$. Then the desired random vector is
$$
\vec z=\vec x-2\left(\vec x \cdot\vec r\right)\vec r\;.
$$
By the way, you're taking advantage of much more than just the independence of the components. You're making use of the rotational invariance of a product of Gaussians in Cartesian coordinates; you can't do this with general i.i.d. random variables.
