Let $X_1,X_2,X_3$ be uniform random variables on the interval $(0,1)$ with $$\newcommand{\cov}{\text{cov}} \newcommand{\var}{\text{var}}\cov(X_i,X_j)=\frac{1}{24} \text{ for } i,j\in\{1,2,3\}, i\ne j$$
Calculate the variance of $X_1+2X_2-X_3$
I did the below approach:
\begin{align*}\var(x_1+2x_2-x_3)&=\cov(x_1+2x_2-x_3,x_1+2x_2-x_3)\\&=\cov(x_1,x_1)+2\cov(x_1,x_2)-\cov(x_1,x_3)\\&+2\cov(x_2,x_1)+4\cov(x_2,x_2)-2\cov(x_2,x_3)\\&-\cov(x_3,x_1)-2\cov(x_3,x_2)+\cov(x_3,x_3)\\&= \frac{2}{24} -\frac{1}{24}+\frac{2}{24}-\frac{2}{24}-\frac{1}{24}-\frac{2}{24}=-\frac{2}{24}\end{align*} but the answer is $\dfrac{5}{12}$???
As $\cov(x_i,x_j)=\frac{1}{24} \text{ for } i\ne j$ so, $\cov(x_1,x_1), \cov(x_2,x_2),\cov(x_3,x_3)$ I assumed to be $0$. Is my assumption is wrong and I need to calculate the $\cov(x_1,x_1)$ from the UDF given.
For any $X$, $\text{Cov}(X,X)=\text{Var}(X)$. So you for that part of the calculation you need to calculate the variance of the uniform distribution on $(0,1)$.
That variance is $\frac{1}{12}$, so you will be adding $\frac{1}{12}+\frac{4}{12}+\frac{1}{12}$ to the number you calculated. Note that $-\frac{2}{24}$ cannot be right: variance is always non-negative.