Find $E(X_1+X_2)$ for random vector uniformly distributed on triangle Consider a triangle with vertices (-1,0),(1,0),(0,1) and suppose $(X_1,X_2)$ is a random vector uniformly distributed on this triangle. Compute $E(X_1+X_2)$.
Since the random vector is uniformly distributed on the triangle, then I would simply say that $X_1,X_2$ are also uniformly distributed on it, such that:
$$E(X_1+X_2)=E(X_1)+E(X_2)=2 E(X_1)=2\int_{-1}^1 xf(x)dx=2 \int_{-1}^1 x \frac1{x}dx=2$$
Is my computation correct? (ps: I am not considering how a uniform RV is distributed, but just keep reasoning!)
Many thanks for any help!
 A: Denote the triangular region by $$\mathcal D := \{(x_1,x_2)\in\mathbb R^2: x_2\geqslant 0, x_1+x_2\leqslant 1, x_2-x_1\leqslant 1\}. $$ Since $(X_1,X_2)$ is uniformly distributed over $\mathcal D$, the joint density is a constant, given by the reciprocal of the area of $\mathcal D$. Since
$$
\mathrm{Area}(\mathcal D) = \frac12\cdot1\cdot2 = 1,
$$ it follows that
$$
f_{X_1,X_2}(x_1,x_2) = \mathsf 1_{\mathcal D}. 
$$
Define $g:\mathbb R^2\to\mathbb R$ by $g(x_1,x_2)=x_1+x_2$, then $g$ is (Lebesgue) measurable, so by the law of the unconscious statistician, we have
$$
\mathbb E[g(X_1,X_2)] = \int_{\mathcal D} g(x_1,x_2)f_{X_1,X_2}(x_1,x_2)\ \mathsf d(x_1\times x_2).
$$
Now, consider the inequalities that define $\mathcal D$:
\begin{align}
x_2&\geqslant 0\tag1\\
x_1+x_2&\leqslant1\tag2\\
x_2-x_1&\leqslant1\tag3.
\end{align}
Adding $(2)$ to $(3)$ and dividing by $2$ yields, along with $(1)$, the further inequality $0\leqslant x_2\leqslant 1$. Adding $-(1)$ to $(2)$ and to $(3)$ yield $-1\leqslant x_1\leqslant 1$. Hence we may write
\begin{align}
\mathcal D &= \left(\{0\leqslant x_2\leqslant 1\}\cap \{-1\leqslant x_1\leqslant 0\}\cap\{0\leqslant x_2\leqslant 1+x_1\}\right)\\
&\;\cup \left(\{0\leqslant x_2\leqslant 1\}\cap \{0\leqslant x_1\leqslant 1\}\cap\{0\leqslant x_2\leqslant 1-x_1\}\right).
\end{align}
It follows that
\begin{align}
\mathbb E[X_1+X_2] &= \int_{-1}^0\int_0^{1+x_1}\left(x_1+x_2\right)\ \mathsf dx_2\ \mathsf dx_1 + \int_0^1\int_0^{1-x_1}\left(x_1+x_2\right)\ \mathsf dx_2\ \mathsf dx_1\\
&= 0 + \frac13 = \frac 13.
\end{align}
Alternatively, we can make use of the fact that if an object has uniform density, its center of mass is its centroid - the point at which its medians (the line segments connecting each vertex to the midpoint of the opposite side). The median corresponding to the vertex $(0,1)$ and midpoint $(0,0)$ is clearly given by the line $x=0$. Now consider the vertex $(-1,0)$. The midpoint of the opposite side of the triangle is given by $\frac12\left((0,1)+(1,0)\right)) = \left(\frac12,\frac12\right)$. The slope of this line segment is given by
$$
\frac{y_2-y_1}{x_2-x_1} = \frac{\frac12-0}{\frac12-(-1)}= \frac13,
$$
and hence its equation by $y = \frac13(x+1)$. The point of intersection has $x$-coordinate $0$, and hence $y$-coordinate $\frac13$. From this we conclude that $\mathbb E[X_1]=0$, $\mathbb E[X_2]=\frac13$, and thus
$$
\mathbb E[X_1+X_2] = \frac13.
$$
