The expected value \({\Bbb E}_{{\mathrm x} \sim p}[x]\) of a continuous distribution with probability density function given by \(p\) is the "average" value of a random variable with this distribution, and can be computed using the following formula:
\({\Bbb E}_{{\mathrm x} \sim p}[x] = \int_{-\infty}^{\infty} x p(x) dx\) .
Compute the expectation of the exponential distribution, whose density function is:
\(p(x; \lambda) = \lambda (1_{x \geq 0}) \exp(-\lambda x)\) ,
for a given parameter \(\lambda > 0\), where the indicator function \(1_{x \geq 0}\) is 1 if \(x\) is non-negative and 0 if \(x\) is negative.
A.:
We have:
\(\begin{eqnarray*} {\Bbb E}_{{\mathrm x} \sim p}[x] &=& \int_{-\infty}^{\infty}x\lambda(1_{x \geq 0})\exp(-\lambda x)dx\\ &=& \int_{0}^{\infty} x \lambda \exp(-\lambda x) dx. \end{eqnarray*} \)
Using integration by parts,
\(\begin{eqnarray*} \left.\int_{0}^{\infty} x \lambda \exp(-\lambda x) dx = -x\exp(-\lambda x)\right|_0^{\infty} &-& \int_{0}^{\infty} \lambda \exp(-\lambda x) dx. \end{eqnarray*} \)
The first term vanishes, because both extremes evaluate to zero. For the second term, we have:
\(\begin{eqnarray*} -\int_{0}^{\infty} \lambda \exp(-\lambda x) dx &=& \left.-\frac{1}{\lambda}\exp(-\lambda x)\right|_0^{\infty} = \frac{1}{\lambda}. \end{eqnarray*} \)
The expected value is therefore \(1/\lambda\).
A.:
The density function is positive for \(x \geq 0\) only. In this domain, the density is strictly decreasing. It follows that the maximum value is found for \(x = 0\), and the value is \(\lambda \exp(-0) = \lambda\).