# Covariance in the errors of random variables

I have two computed variables say $$x\sim N(\mu_{x}, \sigma_{x})$$ and $$y\sim N(\mu_y, \sigma_y)$$. Additionally, the $$\sigma_x$$ and $$\sigma_y$$ are both computed from different types of errors (different components used to compute $$\mu_x$$ and $$\mu_y$$).

\begin{align} \sigma_x & = \sqrt{A_x^2 + B_x^2 + C_x^2 + D_x^2}\\ \sigma_y & = \sqrt{A_y^2 + B_y^2 + C_y^2 + D_y^2} \end{align}

My goal is to find the covariance in $$\sigma_x$$ and $$\sigma_y$$.

I know that (assuming A, B, C, D are independent from each other, thus cross terms are zero) for,

\begin{align} \text{cov}([A_x, B_x, C_x, D_x], [A_y, B_y, C_y, D_y]) = \text{cov}(A_x, A_y) + \text{cov}(B_x, B_y)+ \text{cov}(C_x, C_y)+ \text{cov}(D_x, D_y) \end{align}

However, I am stuck when I have to compute $$\text{cov}(\sqrt{[A_x^2, B_x^2, C_x^2, D_x^2]}, \sqrt{[A_y^2, B_y^2, C_y^2, D_y^2]})$$.

I am not sure if the relation $$\sqrt{\text{cov}(A^2, B^2)} = \text{cov}(A, B)$$ works.

Any help will be appreciated.

Apologies, if this question is not in the right format to ask.

EDIT:

Following of how $$X$$ is computed using $$A$$, $$B$$, $$C$$ and $$D$$, \begin{align} X = \dfrac{A}{B} + C + D \end{align}

• Could you write down how are $X,Y$ calculated using $A,B,C,D$? Oct 30, 2021 at 10:16
• I have added the relationship of how $X$ is computed. $Y$ is computed in a similar way. Oct 30, 2021 at 11:04
• Do you try to find $Cov(x,y)$ in terms of $\sigma_x,\sigma_y$ or the covariance of the SD estimators, i.e $Cov(\sigma_x,\sigma_y)$? Oct 30, 2021 at 11:20

Generally speaking, the relation $$\sqrt{Cov(A^2,B^2)}=Cov(A,B)$$ does not hold. Consider the following counterexample:

Let $$X\sim U[0,2\pi]$$ and $$Y=\sin(x), Z=\cos(X)$$. You can see here the proof for $$Cov(Y,Z)=0$$. Now, let's examine $$Cov(Y^2,Z^2)$$:

$$Cov(Y^2,Z^2)=E[(Y^2-E[Y^2])(Z^2-E[Z^2])]=E\left[(\sin^2(X)-\int_0^{2\pi}\sin^2(x)dx)(\cos^2(X)-\int_0^{2\pi}\cos^2(x)dx)\right]$$

The result of both integrals is $$\pi$$ so

$$Cov(Y^2,Z^2)=E\left[(\sin^2(X)-\pi)(\cos^2(X)-\pi)\right]\\=E[\sin^2(X)\cos^2(X)-\pi\sin^2(X)-\pi\cos^2(X)+\pi^2]\\=\int_0^{2\pi}\sin^2(x)\cos^2(x)dx-E[\pi(\sin^2(X)+\cos^2(X))+\pi^2]\\=\int_0^{2\pi}{\sin^2(x)\cos^2(x)dx}-E[\pi\cdot1+\pi^2]\\=\int_0^{2\pi}{\sin^2(x)\cos^2(x)dx}-\pi+\pi^2$$ The result of this integral is $$\pi/4$$ so overall we get $$Cov(Y^2,Z^2)=\pi^2-\frac{3}{4}\pi$$ and then $$\sqrt{Cov(Y^2,Z^2)}\ne Cov(Y,Z)$$.

The covariance of $$x,y$$ is defined as $$Cov(x,y)=E[xy]-E[x]E[y]$$. Given $$x\sim N(\mu_x,\sigma_x^2), y\sim N(\mu_y,\sigma_y^2)$$, we know that $$E[x]E[y]=\mu_x \mu_y$$ and we're left with finding $$E[xy]$$.

As explained here, we can write $$xy$$ as $$\frac{1}{4}(x+y)^2-\frac{1}{4}(x-y)^2$$ (check it!). For our $$x,y$$ we get that $$(x+y)\sim N(\mu_x+\mu_y,\sigma_x^2+\sigma_y^2+2\sigma_x\sigma_y),\qquad (x-y)\sim N(\mu_x-\mu_y,\sigma_x^2+\sigma_y^2-2\sigma_x\sigma_y)$$

Denote $$S_+=\sqrt{\sigma_x^2+\sigma_y^2+2\sigma_x\sigma_y}$$ and $$S_-=\sqrt{\sigma_x^2+\sigma_y^2-2\sigma_x\sigma_y}$$, we get: $$\frac{(x+y)}{S_+}\sim N\left(\frac{\mu_x+\mu_y}{S_+},1\right),\qquad \frac{(x-y)}{S_-}\sim N\left(\frac{\mu_x-\mu_y}{S_-},1\right)$$

Next, we can write $$E[xy]=\frac{1}{4}E[(x-y)^2]-\frac{1}{4}E[(x-y)^2]=\frac{1}{4}E\left[S^2_+\left(\frac{x+y}{S_+}\right)^2\right]-\frac{1}{4}E\left[S^2_-\left(\frac{x-y}{S_-}\right)^2\right]\\=\frac{1}{4}S^2_+E\left[\left(\frac{x+y}{S_+}\right)^2\right]-\frac{1}{4}S^2_-E\left[\left(\frac{x-y}{S_-}\right)^2\right]$$

Now look at $$E\left[\left(\frac{x+y}{S_+}\right)^2\right]$$: we know that $$\frac{(x+y)}{S_+}\sim N\left(\frac{\mu_x+\mu_y}{S_+},1\right)$$ so its square has a chi-square distribution with non-centrality parameter $$\lambda_+=\frac{(\mu_x+\mu_y)^2}{S_+^2}$$, thus $$E\left[\left(\frac{x+y}{S_+}\right)^2\right]=1+\lambda_+$$. In a similar manner, $$E\left[\left(\frac{x-y}{S_-}\right)^2\right]=1+\lambda_-$$ where $$\lambda_-=\frac{(\mu_x-\mu_y)^2}{S_-^2}$$. We overall get:

$$E[xy]=\frac{1}{4}S^2_+E\left[\left(\frac{x+y}{S_+}\right)^2\right]-\frac{1}{4}S^2_-E\left[\left(\frac{x-y}{S_-}\right)^2\right]\\= \frac{1}{4}(S^2_++(\mu_x+\mu_y)^2)-\frac{1}{4}(S^2_-+(\mu_x-\mu_y)^2)\\= \frac{1}{4}(\sigma_x^2+\sigma_y^2+2\sigma_x\sigma_y-\sigma_x^2-\sigma_y^2+2\sigma_x\sigma_y+\mu^2_x+2\mu_x\mu_y+\mu^2_y-\mu^2_x+2\mu_x\mu_y-\mu^2_y)\\=\frac{1}{4}(4\sigma_x\sigma_y+4\mu_x\mu_y)$$

And finally

$$Cov(x,y)=E[xy]-E[x]E[y]=\sigma_x\sigma_y$$

• Thank you so much. I think I'll be able to find the solution for my problem now. Oct 31, 2021 at 4:13