# Expected value of a random variable involving a standard normal random variable

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]$?

• 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. – jwimberley Feb 16 '17 at 13:54
• One way to compute the expectation of a non-negative random variable like $X$ is to integrate its survival function $1-\Phi$. – whuber Feb 16 '17 at 13:59
• 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$. – Jarle Tufto Feb 16 '17 at 14:01