The random variable $X$ has a distribution in $\mathbb{R}$ with density $$g(x) = \begin{cases}0 & \text{if } x < 0 \\ e^{-x} & \text{if } x \geq 0\end{cases}$$ Calculate the expected value of the random variable $ Y = \min(X, 3)$.
Hint: The density of the random variable $Y$ is the same as that of the variable $X$.
I know the expected value for $X$ is:
$$E(X) = \displaystyle \int_{-\infty }^{\infty}xf(x)dx = \int_{0 }^{\infty}xe^{-x}dx = \begin{bmatrix} -xe^{-x}+\int e^{-x}dx \end{bmatrix}_{0}^{\infty} = \begin{bmatrix} -xe^{-x}-e^{-x} \end{bmatrix}_{0}^{1} = 1 $$
But I don't understand what $Y = \min(X, 3)$ means, is it an interval $(0, 3)$ or maybe just $0$? The minimal value of $g(x)$ for an argument from the range of $<0,3>$ is $0$.
Is this the answer?:
$$ E(Y) = \displaystyle \int_{0}^{3}xe^{-x}dx = \begin{bmatrix} -xe^{-x}+\int e^{-x}dx \end{bmatrix}_{0}^{3} = 1 - 4e^{-3}$$
More generally, if $X\sim\mathsf{Exp}(\lambda)$ and $c>0$ with $Y=X\wedge c$. then $Y$ has a mixture distribution with $$ \mathbb P(Y=c) = \mathbb P(X\geqslant c) = 1-\int_0^c \lambda e^{-\lambda t}\ \mathsf dt= e^{-\lambda c}. $$ and for $0<t<c$,$$ \mathbb P(X\leqslant t) = \int_0^t \lambda e^{-\lambda t}\ \mathsf dx = 1-e^{-\lambda t}, $$ so that $$ F_Y(t) := \mathbb P(X\leqslant t) = (1-e^{-\lambda t})\cdot\mathsf 1_{(0,c)}(t) + e^{-\lambda c}\cdot\mathsf 1_{[c,\infty)}(t),\ t\geqslant 0. $$ The expected value would then be $$ \int_0^\infty (1-F_Y(t))\ \mathsf dt = \int_0^ce^{-\lambda x}\ \mathsf dx + c\cdot\mathbb P(X=c) = \frac1\lambda\left(1-e^{-\lambda c}\right). $$