Expected value of a random variable involving 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: $X$ is a mixture random variable; possessing a probability mass (of $\tfrac 12$) at $X=0$ and a probability density for all real values above $0$ (identical to the standard normal's).   It is unsurprising that we use a mixture of summation and integration to evaluate the expected value.
$\begin{align}\mathsf E(X) ~&=~ 0\cdot\mathsf P(X=0) + \int_0^\infty x~\phi(x)\operatorname d x \\[1ex] ~&=~ \int_0^\infty (x\,\mathsf e^{-x^2/2}/\sqrt{2\pi})~\operatorname d x \\[1ex] &=~\end{align}$
Which is in fact solvable by symbolic integration.   You can do the rest.
A: You can use a more general expression for $\mathbb{E}[X]$,
$$\mathbb{E}[X]=\int_{-\infty}^\infty x\mathrm{d}P_X(x)$$
which, for $X$ discrete it becomes $\mathbb{E}[X]=\sum_{x} x\mathbb{P}[X=x]$, for $X$ continuous it becomes $\mathbb{E}[X]=\int_{-\infty}^\infty xf_X(x)\mathrm{d}x$
and for $X$ mixed variable (continuous and discrete components) it becomes $$\mathbb{E}[X]=\int_{-\infty}^\infty xf_X(x)\mathrm{d}x + \sum_{x} x\mathbb{P}[X=x]$$
In this particular case, we have that 
$$\mathbb{E}[X]=\int_{0}^\infty x\frac{1}{\sqrt{2\pi}}\exp{\left(-\frac{x^2}{2}\right)}\mathrm{d}x + \sum_{x=0} x\mathbb{P}[X=x]=\frac{1}{\sqrt{2\pi}}$$
also theres a Wikipedia entry for that distribution:
https://en.wikipedia.org/wiki/Rectified_Gaussian_distribution
and here you can learn more about mixed distributions: http://www.randomservices.org/random/dist/Mixed.html
A: Your variable $X$ is a mixed random variable.
You can separate it into a discrete part and a continuous part
and add up the contributions of each part to the expected value of
the entire distribution, as other answers do, or you can use the formula
$$
\mathbb E[Y] = \int_0^\infty (1-F_Y (t)) \, dt
 - \int_{-\infty}^0 F_Y (t) \, dt,
$$
as shown elsewhere.
But for a non-negative random variable, such as your $X,$ the second integral is zero and can be omitted, as shown
in the answer to Integral of CDF equals expected value.
