Imagine we have a random variable X with a certain distribution, being easy to calculate;
Now we construct a retention in it, (or also an insurance sum, so a maximum sum being paid out) - in this case we use a retention and call this variable Y... For example we have then:
$$Y=0\cdot\mathbb{1}_{\{x<50\}}+(X-50)\cdot\mathbb{1}_{\{x\geq50\}} $$
which is now the payout if we have a retention of 50; Now calculating the expectation is easy:
$$\mathbb{E}(Y)=\mathbb{E}(X\cdot\mathbb{1}_{\{x\geq50\}})-50\mathbb{E}(\mathbb{1}_{\{x\geq50\}})= \int_{50}^{\infty}xf_x(x)dx-50 \mathbb{P}(X\geq 50) $$
But now I'm lost, how can I now calculate the variance of Y now - I though of calculating $$\mathbb{E}(Y^2)$$ and then calculate the variance with that but I somehow don't know how to do it - can someone give me an advice?
Thank you so much!!!
EDIT:
Now let's make Y a more compliacated, e.g.
$$Y=0\cdot\mathbb{1}_{\{x<50\}}+(X-50)\cdot\mathbb{1}_{\{x\geq50 \text{ and } x\leq200\}} + (200 + 0.1 \cdot X) \mathbb{1}_{\{x\geq200\}} $$
They payout doesn't really make sense but just that I understand it better... How do I calculate the variance here?
I would proceed as you suggested and use $Var(Y) = \mathbb{E}[Y^2] - \mathbb{E}[Y]^2$.
For $\mathbb{E}[Y^2]$ we have $Y^2 = (X-50)^2 \mathbb{1}_{X \geq 50}(X)$, so
$$ \mathbb{E}[Y^2] = \int_{x=50}^\infty (x-50)^2 f_X(x) \mathrm{d} x. $$
The variance becomes
$$ Var(Y) = \int_{x=50}^\infty (x-50)^2 f_X(x) \mathrm{d} x - \left( \int_{x=50}^\infty (x-50) f_X(x) \mathrm{d} x \right)^2.$$