Minimum of a random variable and a constant If X and Y are random variables such that X ~ Geo (p) and Y ~ exp (λ). Calculate expected value and the variance of the random variables min {X, M} and min {Y, M}, where M is a positive constant.
I know that if Y= min{X,M}, then $Y=X$ when $X<M$ and $Y=M$ if $M\leq X$. But then I get confused on what to do to calculate the expectation. 
When $Y=M$ then $P(Y=k)=0$? And therefore I just have to compute the sum from 1 to $M-1$ of $xp (1-p)^x$ ?
 A: Use the Law of Total Expectation, followed by conditional expectation.
$\begin{align}
\mathsf E(\min(X,M))
 & = \mathsf E(\min(X,M)\mid X\leq M)\,\mathsf P(X\leq M)+\mathsf E(\min(X,M)\mid X>M)\,\mathsf P(X> M)
\\[2ex]
 & = \mathsf E(X\mid X\leq M)\,\mathsf P(X\leq M) +\mathsf E(M\mid X>M)\,\mathsf P(X>M)
\\[2ex]
 & = \mathsf E(X\mid X\leq M)\,\mathsf P(X\leq M) +M\,\mathsf P(X>M)
\\[2ex]
& = \left(\sum_{x=0}^M \frac{x \,\mathsf P(X=x)}{\mathsf P(X\leq M)} \right)\mathsf P(X\leq M)+M\,\mathsf P(X>M)
\\[1ex]
& = \sum_{x=0}^M xp(1-p)^{x-1} + M\,(1-p)^M
\\[1ex]
& = \frac{1-(M p+1) (1-p)^M}{p}+\frac{Mp(1-p)^M}{p}
\\[1ex]
& = \frac{1-(1-p)^M}{p}
\\[2ex]
\mathsf E(\min(X,M)^2) 
& = \sum_{x=0}^M x^2\, \mathsf P(X=x)+M^2\,\mathsf P(X > M)
\\[1ex] & \vdots
\\[3ex]
\mathsf {Var}(\min(X,M)) & =\mathsf E(\min(X,M)^2)-\mathsf E(\min(X,M))^2 
\end{align}$
And similar for the exponential variable $Y$
A: Let $Y$ be exponential with parameter $\lambda$, and let $M$ be positive. Let $W=\min(Y,M)$.
Then $W=M$ if $Y\ge M$. It follows that $\Pr(W=M)=e^{-\lambda}$. Thus
$$E(W)=\int_{y=0}^M y\lambda e^{-\lambda}\,dy+ Me^{-\lambda},\tag{1}$$
and 
$$E(W^2)=\int_{y=0}^M y^2\lambda e^{-\lambda}\,dy+ M^2e^{-\lambda}.\tag{2}$$
To calculate the variance of $W$, note this is $E(W^2)-(E(W))^2$ and use the results of of (1) and (2).
