I'm curious of how to find the expected value of the following. Suppose we have a constant function defined on,
$$f(x) = \begin{cases} 1 & if \ \ \ 0 < x< D \\ 0 & if \ \ \ x> D \end{cases}$$
For $$D \sim Exp(2)$$
Is there anyway to compute
$$\mathbb{E}(f(x))=?$$
Fix $x$. The random variable $Y=f(x)$ can be either $1$, with probability $\Pr(D>x)$ or $0$. Hence, $E(f(x))=\Pr(D>x)=\exp(-2x)$