# Finding the covariance of the union of two segments of a triangle?

Consider points $$A=(0,1),\:B=(0,0),\:C=(1,0)$$. We choose a random point $$(X,Y)$$ on $$\overline{AB} \cup \overline{BC}$$ i.e. the union of the two line segments that "connect" at the origin. Find $$Cov(X,Y)$$.

I'm not sure if I'm interpreting it right:

1) It's asking for the "L" shape and not a region like a $$1\times 1$$ square. If this is the case, then $$X \sim Unif(0,1)$$ and $$Y \sim Unif(0,1)$$. Then would it be a matter of finding $$X+Y$$?

OR

2) The union of both segments forms an angle, a $$90^{\circ}$$ angle. Since standard deviation is analogous to the pythagorean theorem, then by cosine law, $$Cov(X,Y)=0$$

Am I misunderstanding the question or approaching it incorrectly?

There's a 1/2 probability we lie on the line segment $$\overline{AB}$$, in which case $$X = 0$$ and $$Y \sim \text{Unif}(0, 1)$$, and there's a 1/2 probability we line on line segment $$\overline{BC}$$, in which case $$X \sim \text{Unif}(0,1)$$ and $$Y = 0$$. So, $$(X, Y)$$ follows from the following mixture distribution: \begin{align*} (X, Y) \sim \frac{1}{2}(0, \text{Unif}(0, 1)) + \frac{1}{2}(\text{Unif}(0, 1), 0) \end{align*} If we let $$B \sim \text{Ber}(\frac{1}{2})$$ be a random variable denoting which component from the mixture we are sampling from, then \begin{align*} \text{Cov}(X, Y) &= \mathbb{E}[\text{Cov}(X, Y|B)] + \text{Cov}(\mathbb{E}(X|B), \mathbb{E}(Y|B)) \\ &=0 + \text{Cov}\left(\frac{1}{2}B, \frac{1}{2}(1-B)\right) \\ &= -\frac{1}{16} \end{align*}
• Is the Bernoulli part necessary? With the mixture distribution you gave doesn't it just follow that $E[XY]-E[X]E[Y]=0-(.25)\cdot(.25)=-.0625$. – Tomás Palamás Apr 29 at 21:16