I am writing my P exam for actuaries. I have the solution manual but I ran into this question, which confused me. I understood the solution but it did differently in how I wouldve tackled the problem.
This is about finding the $var(y-x)$.
I have a discrete probability chart. I dont know how to draw here but I will try my best to detail it.
So $x = 0, 1, 2$ and $y = 0, 1, 2$ where P(x,y) are $p(0, 0) = 0, p(1, 0) = 0.4, p(2, 0) = 0.2$ this is the first row. then the second row is $p(0,1)=0.2, p(1,1)=0.2, p(2,1) = 0$
ok the total prob of both of them is 1. which we can calculate from the chart.
So how I approached this is I know
$var(x-y) = var(x) + var(y) - 2cov(x, y)$
Then I got confused how would I calculate var(x) or cov(x,y). Like I know their formula. but how would I compute $E(x), E(x^2), E(y), E(y^2),$ and most importantly $E(xy)$
In the solution manual they did change of variables which seemed fine but just finding it like that how would I do it.
Please any help or feedback would be highly appreciated.
Thank you very much
So what you have is:
To get the expectations, you multiply the probability by each value of the variable. But note now that the table gives you the joint distribution of $X$ and $Y$ and you want the marginal distributions for this. So for $X$, you sum the columns and for $Y$ you sum the rows, giving:
Recall the definition of the expectation:
$$ E(X)=\sum_{k=0}^\infty k Pr(X=k) $$ which in this case is simply
$$ E(X)=0*\frac{1}{5}+1*\frac{3}{5}+2*\frac{1}{5}=1 $$ and $$ E(Y)=0*\frac{3}{5}+1*\frac{2}{5}+2*0=\frac{2}{5} $$
Similarly, for $E(X^2)$ and $E(Y^2)$ you simply square the values (not the probabilities!):
$$ \begin{align} E(X^2)&=0^2*\frac{1}{5}+1^2*\frac{3}{5}+2^2*\frac{1}{5}=\frac{7}{5}\\ E(Y^2)&=0^2*\frac{3}{5}+1^2*\frac{2}{5}+2^2*0=\frac{2}{5} \end{align} $$
So then you get the variances from $V(X)=E(X^2)-E(X)^2$:
$$ \begin{align} V(X)&=\frac{7}{5}-1^2=\frac{2}{5}\\ V(Y)&=\frac{2}{5}-\frac{4}{25}=\frac{6}{25} \end{align} $$
Now, what remains for the covariance is $E(XY)$. The definition of it is similar to the expectation:
$$ E(XY)=\sum_{k=0}^\infty\sum_{l=0}^\infty kl Pr(X=k, Y=l) $$
Given how I calculated the things above, I hope you can take it from here!
EDIT: Okay, so here's how you do it. First, note that the sums both go from 0 to 2 so we have
$$ E(XY)=\sum_{k=0}^2\sum_{l=0}^2klPr(X=k, Y=l) $$
But, what happens when either $k=0$ or $l=0$? Then you multiply by 0! So in fact, the sums start at 1, giving us:
$$ E(XY)=\sum_{k=1}^2\sum_{l=1}^2klPr(X=k, Y=l) $$
But, if you look at the table, the probability that $Y$ is 2 is equal to 0. This means that there is only one value of $Y$ that goes into the calculation -- $Y=1$. So then we get the answer:
$$ E(XY)=\sum_{k=1}^2kPr(X=k, Y=1)=Pr(X=1, Y=1)+2Pr(X=2, Y=1)=Pr(X=1, Y=1)=\frac{1}{5}. $$
Then we simply use the definition of the covariance:
$$ Cov(X, Y)=E(XY)-E(X)E(Y)=\frac{1}{5}-1*\frac{2}{5}=-\frac{1}{5} $$
Hence, the covariance is equal to $-\frac{1}{5}$.