Conditional expectation on exponential distribution

How can I compute the conditional expectation C-X in the following formula

E[C-X|X$$<$$C];

where C is a constant and X a random variable following exponential distribution?

• Have you tried writing the expression as an integral and solving that? Mar 4 '19 at 20:23

Suppose that $$X \sim \mathcal{E}(\lambda)$$, then we have

\begin{align*} \mathbb{E}[C-X \mid X < C] &= \frac{\mathbb{E}[ (C-X)I_{X

Where $$I_{\cdot}$$ is the indicator function.

Now we need to solve the expectation which is basic integration

\begin{align*} \mathbb{E}[XI_{X

Thus we finally have

$$\mathbb{E}[C-X \mid X < C] = C + \frac{ e^{-\lambda C}(C + \frac{1}{\lambda} ) - \frac{1}{\lambda}}{1 - e^{-\lambda C}}$$

Here is a little R code to check if it works with $$\lambda = 0.01$$ and $$C=45$$

Ck<-45
X<-rexp(1e7,0.01)
Y<-X[X<Ck]   ## Select only the values of X < Ck
mean(Ck-Y)   ## empirical expectation
Ck + (Ck*exp(-0.01*Ck) + (exp(-0.01*Ck)-1)/0.01)/(1-exp(-0.01*Ck))


More generally when you have an conditional expectation of the type

$$\mathbb{E}[X \mid A]$$

you can use the relation

$$\mathbb{E}[X \mid A] = \frac{\mathbb{E}[X I_A]}{P(A)}$$

• Thank you @winperikle. I had done the sam job but my result is a bit different. In your last equation, in the numerator, it should be $\e^{-\lambda.C}$ (C+1/$\lambda$) I guess, no ? My solution differs from there Mar 6 '19 at 12:11