Rectifier function of random variable Let $X$ be a random variable with distribution $F_X$ and density $f_X$.  Define 
$$g(x) = \left\{
  \begin{array}{lr}
    x & : x \ge 0\\
   0 & : x < 0
  \end{array}
\right\}$$
and let $Y=g(X)$.  What is the PDF of $Y$?
My approach: via CDF
$$F_Y(y) = \Pr(Y\le y) = \Pr(g(X)\le y) = \Pr(X\le y) = F_X(y), \ y\ge 0$$
After taking the derivative, 
$$f_Y(y) = f_X(y), \ y \ge 0$$
This seems to be incorrect because $f_Y(y)$ is  not a PDF (integral is not equal to one).
I know that it probably has to do something with the fact that all $x\lt 0$ are mapped onto $y=0$. 
I just don't know how I can incorporate this in a constructive way.
 A: Let's assume that $X$ is a continuous random variable. Then, around variables like $Y$ there are two possible confusions related to terminology:
$Y$ is a censored version of $X$ (and sometimes people confuse "censoring" with "truncating"). Also, $Y$ has a mixed distribution (and sometimes people confuse "mixed" distributions with "mixture" distributions).  
$Y$ is a censored version of $X$ because a) we observe only non-negative values and b) when we observe $0$ we only know that the corresponding realization of $X$ was $x\leq 0$, i.e. we learn only that $X$ fell in an interval, not its specific value. This also creates the mixed distribution, i.e. a distribution that has a discrete part and a continuous part:
At value $0$, non-zero probability mass concentrates, equal to $P(X\leq 0)$. For $X>0$ we have $Y=X$. So the CDF of Y is
$$F_Y(y)  = \left\{
  \begin{array}{lr}
    F_X(y)& : y > 0\\
   F_X(0) & : y = 0\\
   0 & \text{elsewhere}
  \end{array}
\right\}$$
and $\lim_{y\rightarrow \infty}F_Y(y)=1$.  
As for its probability -mass function? - density function? -well, see the illuminating and educative comments below on the matter, as well as ways to express it in one row. Let's say we have a point where non-zero probability mass concentrates, $P(Y=0) = P(X \leq 0)<1$, while for $y>0$ we have a continuous function $f_X(y)$ that does satisfy $\int_{0}^{\infty}f_X(y)dy = 1- P(X \leq 0)$ , while this entity is $0$ everywhere else. So in all, it sums up to unity.
