I came across a problem in a Carmona's Statistical Analysis of Financial Data in R (pg. 189, Problem 3.13). The due date has passed, so now it is considered a self-study question.

I am seeking a simple-to-understand proof to the following:

$X_1 \sim \mathcal{N}(0,1)$, $X_2 \sim \mathcal{N}(0,1)$

$X_3 \sim \begin{cases} |X_2| & X_1 \geq 0 \\ -|X_2| & X_1 < 0 \end{cases} $

(Q.) Compute the CDF of $X_3$. State if $X_3$ is Gaussian.

Intuitively, I believe $X_3$ should be standard normal $\sim \mathcal{N}(0,1)$. Half of the time, $X_3 = $ folded normal, while half of the time $X_3 = $ negative of a folded normal, by simple symmetry. I run an R simulation to test my suspicions and find this to be correct (the R code and plot is listed at the end of the question).

We know $\mathbb{P}(X_1 \leq 0) = \mathbb{P}(X_1 > 0) = \frac{1}{2}$ by symmetry. We also know:

$\mathbb{P}(|X| \leq x) = \\ \mathbb{P}(-x \leq X \leq x) = \\ \mathbb{P}(X \leq x) - \mathbb{P}(X \leq -x) = \\ \mathbb{P}(X \leq x) - [1 - \mathbb{P}(X \leq x)] = \\ 2 \cdot \mathbb{P}(X \leq x) - 1$

So, we try to say $X_3 \sim \frac{1}{2} \cdot [2 \cdot \mathbb{P}(X \leq x) - 1] + \frac{1}{2} \cdot [-2 \cdot \mathbb{P}(X \leq x) + 1]$, but the math here does not work out. Any help from this point would be appreciated.

R Code and Result

# Variables
N <- 1000000
X1 <- rnorm(n=N, mean=0, sd=1); X2 <- rnorm(n=N, mean=0, sd=1)
X3 <- rep(0, N)

# Compute X3
for (i in 1:N) {
  if (X1[i] >= 0) {
    X3[i] <- abs(X2[i])
  } else {
    X3[i] <- -1*abs(X2[i])

# Histogram (density)
hist(X3, freq=FALSE, breaks=50, 
     main="Histogram of X3 from Simulation",
     xlab="Value of X3",
# Overlay standard normal for comparison
lines(density(X1), col="blue", lwd=2)


  • 2
    $\begingroup$ $X_3$ has a mixture distribution: half the weight is given to a half-normal distribution and the other half of the weight is given to the negative of a half-normal distribution. Together these two halves describe a Normal distribution, QED. In general, the distribution of $X_3$ consists of the positive portion of the distribution of $X_2$, with weight $\Pr(X_1\ge 0)$, along with the reflected version of that positive portion, with the complementary weight. When $X_2$ is symmetric about $0$ and $X_1$ has probability $1/2$ of being non-negative, $X_3$ has the same distribution as $X_2.$ $\endgroup$
    – whuber
    Oct 23, 2018 at 2:43
  • $\begingroup$ Crucial assumption of independence of $X_1$ and $X_2$ is missing in the question ( which is certainly mentioned in the original source of the problem). $\endgroup$ Oct 25, 2018 at 6:12

1 Answer 1


I assume $X_1$ and $X_2$ are independent of each other in what follows (thanks for pointing out the importance of this go to @stubbornatom.)

I would work directly with the cumulative density function of $X_3$:

$$P(X_3 \leq x) = 0.5[P(|X_2|\leq x) + P(-|X_2| \leq x)]$$

Consider $x \leq 0$. In this case, $P(|X_2| \leq x) = 0$, so, dropping it from the r.h.s. of the above equation, we have:

$$P(X_3 \leq x) = 0.5P(-|X_2| \leq x) = 0.5[P(X_2 \leq x) + P(-X_2 \leq x)]$$

where the second term on the r.h.s. covers the two cases $X_2 \leq 0$ (in which case $-|X_2| = X_2$) and $X_2 > 0$ (in which case $-|X_2|=-X_2$) respectively. Multiplying the terms of the last probability by $-1$ and switching the direction of the inequality results in:

$$P(X_3 \leq x) = 0.5[P(X_2 \leq x) + P(X_2 \geq -x)] = P(X_2 \leq x)$$

where the last equality is due to the symmetry of the standard Normal distribution around $0$.

A similar logic can be used to show that $P(X_3 \leq x) = P(X_2 \leq x)$ for the case $x > 0$. (Actually I think saying "symmetry" is probably sufficient.) Since the CDF of $X_3$ is everywhere equal to the CDF of $X_2$, and $X_2$ is standard Normal, it follows that $X_3$ is standard Normal too.

  • $\begingroup$ This is exactly what I was looking for. Thank you for the detailed, step-by-step solution. $\endgroup$
    – ERT
    Oct 23, 2018 at 1:14
  • $\begingroup$ Didn't we assume that $X_1$ is independent of $X_2$? $\endgroup$ Oct 25, 2018 at 6:18
  • $\begingroup$ @StubbornAtom - yes, that's why we can just substitute $0.5$ for $P(X_1 < 0)$ everywhere. $\endgroup$
    – jbowman
    Oct 25, 2018 at 14:13
  • 1
    $\begingroup$ Was it apparent from the question? That's what I am asking. $\endgroup$ Oct 25, 2018 at 14:34
  • 1
    $\begingroup$ No, it wasn't (+1), but without it you'd be hard-pressed to solve the problem, or so it seems to me. I'll add your point to the top of the anser, because it is important. $\endgroup$
    – jbowman
    Oct 25, 2018 at 16:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.