Let $Z\sim\mathcal{N}(0,1)$. Let $X$ be a random variable defined as $X:=ZI_{Z>0}$, where $I_{Z>0}$ is an indicator random variable for the event $\{Z>0\}$. How do I find $\mathbb{E}[X]$?

Here's my attempt.

Let $\Omega$ be the sample space on which $Z$ is defined. The random variable $X$ is a product of two random variables, $Z$ and $I_{Z>0}$. We thus have $$X(\omega)=Z(\omega)\cdot I_{Z>0}(\omega)=\begin{cases}Z(\omega)\quad\text{if }Z(\omega)>0\\ \\ 0\quad\text{ if }Z(\omega)\le 0\end{cases}$$ Thus, the range of $X$ is $\{0\}\cup\mathbb{R^+}=[0,\infty)$.

We have $$\mathbb{P}(X=0)=\mathbb{P}(Z\le 0)=1/2$$ and $$\mathbb{P}(X\le x)=\begin{cases}0\quad\text{if }x<0\\\frac{1}{2}\quad\text{if }x=0\\\frac{1}{2}+\mathbb{P}(0\le Z\le x)\quad\text{if }x>0\end{cases}$$

But $\mathbb{P}(0\le Z\le x)=\Phi(x)-\Phi(0)=\Phi(x)-\frac{1}{2}$, where $\Phi$ is the CDF of $Z$.

We therefore have $$\mathbb{P}(X\le x)=\begin{cases}0\quad\text{if }x<0\\\frac{1}{2}\quad\text{if }x=0\\\Phi(x)\quad\text{if }x>0\end{cases}$$.

I have studied that $\mathbb{E}[Y]=\sum_{y}y\mathbb{P}(Y=y)$ if $Y$ is discrete, and $\mathbb{E}[Y]=\int_{-\infty}^\infty f_Y(y)\mathrm{d}y$ if $Y$ is a continuous r.v. But I am not able to figure out what type of random variable $X$ is. In my understanding, $X$ cannot be continuous since $\mathbb{P}(X=0)=1/2\neq 0$, and $X$ cannot be discrete either since the range of $X$ is uncountable. How do I calculate $\mathbb{E}[X]$?

  • 1
    $\begingroup$ A variable can be a mix of continuous and discrete parts. Its then more like a continuous variable, but its PDF involves the Dirac delta function. $\endgroup$
    – jwimberley
    Feb 16, 2017 at 13:54
  • 2
    $\begingroup$ One way to compute the expectation of a non-negative random variable like $X$ is to integrate its survival function $1-\Phi$. $\endgroup$
    – whuber
    Feb 16, 2017 at 13:59
  • 2
    $\begingroup$ Or, using the law of total expecation, $EX=E(X|Z>0)P(Z>0) + E(X|Z<0)P(Z<0)=E(Z|Z>0)\frac12=\int_0^\infty zf(z)dz$. The last integral can be solved by making the substitution $u=z^2/2$. $\endgroup$ Feb 16, 2017 at 14:01

1 Answer 1


Following the comment by user whuber, we find the expectation of $X$ by $$ \DeclareMathOperator{\E}{\mathbb{E}} \E X = \int_0^\infty \left(1-\Phi(x)\right) \; dx $$ where $\Phi(x)$ is the standard normal cumulative distribution function (cdf), and $\phi(x)$ the corresponding density. This can be evaluated using integration by parts $$ \int_0^\infty (1-\Phi(x)) \; dx = \int_0^\infty \left(1-\Phi(x)\right)\cdot 1 \; dx =\\ \left[ x \cdot (1-\Phi(x)) \right]_0^\infty - \int_0^\infty -\phi(x) \cdot x \; dx =\\ \int_0^\infty x \phi(x)\; dx $$ The last integral by substituting $\frac12 x^2=u$, $du = x \; dx$ so $$ \int_0^\infty x \phi(x)\; dx = \frac1{\sqrt{2\pi}} \int_0^\infty e^{-u}\; du= \frac1{\sqrt{2\pi}} $$


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.