Mixed Probability Distribution - Expected Value Consider for one car owner the insurance policy with the following clauses:


*

*Deductible: If the loss $X>d$, then the insurer pays only for loss above $d>0$.

*Coverage Limit: If the loss $X>l$, then the insurer pays only for loss below $l>d$.
Now, we are to assume that the potential loss $X$ to the owner is of Pareto distribution with density $\displaystyle f(x)=\frac{ab^a}{x^{a+1}}$, for $x \geq b$, $a>0$, $d>b>0$.
If we let $Y$ be the potential loss to the insurer, then $$Y = \begin{cases}0, & \text{if}\,b<x\leq d \\ (X-d)_{+}, & \text{if}\, d<x \leq l \\ l-d, & \text{if}\, x>l \end{cases} $$
I now need to find $E(Y)$.
In my notes, I have the definition of $E(X)$ to be $$E(X) = \int_{\Omega}X(\omega)P(d \omega) = \int_{\mathbb{R}}x \mu (dx) = \int_{\mathbb{R}}xdF(x) = \begin{cases} \sum_{i} x_{i}P(\{x_{i}\}), & X \, \text{is discrete} \\ \int_{\mathbb{R}} xf(x) dx, & X\, \text{is absolutely continuous}\end{cases}$$
But I am not sure I entirely understand how to apply this definition to this case.
Since $Y$ is discrete at $Y = 0$, I was thinking at that point, we would have $E(Y) = 0\cdot P(\{ 0 \}) = 0$.
Then, for $Y = \max (\{0\}, X-d)$, it's continuous, so I'm thinking we would have $E(Y) = \int_{d}^{l}(x-d)f(x)dx = \int_{d}^{l}\frac{(x-d)a b^{a}}{x^{a+1}}dx$. But, for this part, do I need to consider all the possibilities for $a$? I.e., for which of $a<1$, $a=1$, $a>1$ does the integral converge?
Finally, I am not sure at all how to deal with the case where $Y = l-d$. To me, it seems discrete, but I am not sure, and so I don't know how to calculate its expectation.
Could somebody please help me calculate the expectation of $Y$ here? Thank you.
 A: $$\begin{align*}
\operatorname{E}[Y] &= \operatorname{E}[Y \mid X \le d]\Pr[X \le d] + \operatorname{E}[Y \mid d < X \le l]\Pr[d < X \le l] + \operatorname{E}[Y \mid l < X]\Pr[X > l] \\
&= 0 + \operatorname{E}[X - d \mid d < X \le l](F_X(l) - F_X(d)) + (l - d)S_X(l) \\
&= \int_{x=d}^l (x-d) f_X(x) \, dx + (l-d)(1 - F_X(l)).\end{align*}$$
Now, if $$f_X(x) = \frac{ab^a}{x^{a+1}}, \quad x \ge b, \; a > 0, \; d > b > 0,$$ we have $$F_X(x) = \int_{t=b}^x f_X(t) \, dt = 1 - (b/x)^a,$$ hence $$ (l-d)(1-F_X(l)) = b^a (l-d)l^{-a}.$$  We also note that 
$$\begin{align*}
\int_{x=d}^l (x-d) f_X(x) \, dx &= ab^a \left(\int_{x=d}^l x^{-a} \, dx - d \int_{x=d}^l x^{-a-1} \, dx \right) \\ 
&= ab^a \left(\frac{l^{-a+1} - d^{-a+1}}{-a+1} - \frac{d(l^{-a} - d^{-a})}{-a}\right) \\
&= b^a \left(\frac{((a-1)d - al)l^{-a} + d^{-a+1}}{a-1}\right).\end{align*}$$  
You could also have arrived at the same result by writing $$\int_{x=b}^\infty \min(\max(0,x-d),l-d) f_X(x) \, dx = \int_{x=d}^l (l-d)f_X(x) \, dx + \int_{x=l}^\infty (l-d) f_X(x) \, dx.$$  Note $l-d$ is a constant with respect to the variable of integration $x$.
