# If a max()-function is applied to a random variable, what is the functional form of the resulting new random variable?

Suppose you have a random variable $X$ with a probability density function $f(x)$. Now, we define a new random variable $Y$ as follows:

$$Y = \max(0,X-q),$$ where $q$ is a constant.

What is the functional form for the probability density function $f(y)$? Specifically, is it possible to write the PDF of $y$ as a function $f(x)$ and $q$ somehow?

Functionally, the operation that transforms $X$ to $Y$ works as follows:
• Shift the pdf of $X$ to the left by $q$ units: $X\to X-q$
• Take all the probability of this new random variable being negative and crush it into a single point at 0: $X-q\to\max(0,X-q)$
Therefore $Y$ has the following pdf: $$g(x)=\begin{cases}0&x<0\\ c=\int_{-\infty}^qf(t)\,dt&x=0\\ f(x+q)&x>0\end{cases}$$ Assuming $f$ was continuous, this is an example of a mixed random variable – neither continuous, neither discrete, but combining the characteristics of both. The discrete part is the spike at $x=0$ of $Y$, a Dirac delta function, and the continuous part is $x>0$, which has not been affected by anything other than the shift.