# Correlations between 3 random variables

I have a question as follows:

The correlation coefficients between three random variables are x, y, and z respectively. What relation do x, y, and z have to satisfy?

Can someone help me? Thanks very much in advance!

## 2 Answers

Suppose the correlations among the three pairs are found using the same data points, then a relation can be found. For variables a and b, the correlation is basically just the cos of the angle between them in n dimensional space (n = number of points in the data set), being the dot product of unit vectors along them.

The differences between the unit vectors will follow the triangle inequality. If the angle between unit vectors a and b is $\theta$, then $||a-b|| = 2|sin(\frac{\theta}{2})| = \sqrt{2-2cos\theta}$

So we can say that $\sqrt{2-2x} \le \sqrt{2-2y} + \sqrt{2-2z}$

So $\sqrt{1-x} \le \sqrt{1-y} + \sqrt{1-z}$

So ${1-x} \le {1-y} + {1-z} + 2\sqrt{(1-y)(1-z)}$

Which gives $x \ge y + z - 1 - 2\sqrt{(1-y)(1-z)}$

Of course, similar inequalities hold if we permute x, y, z in any order.

This type of questions is often asked on job interviews, so I share a full solution of this more general form.

Q: We have 3 variables, $X, Y, Z$. In what range can be the correlation between them?

A: We can put the 3 variables in a correlation matrix \begin{equation*} \left( \begin{array}{c c c} 1 & \rho(X, Y) & \rho(X, Z) \\ \rho(Y, X) & 1 & \rho(Y, Z) \\ \rho(Z, X) & \rho(Z, Y) & 1 \end{array} \right) \end{equation*} which must be positive and semi-definite; that means that its determinant must be non-negative. So, they must satisfy \begin{equation*} 1 + 2 \rho (X, Y) \rho (X, Z) \rho (Y, Z) - \rho(X, Y)^2 - \rho(X, Z)^2 - \rho(Y, Z)^2 \geq 0; \end{equation*} or, for given $\rho (X, Y); \rho (X, Z);$ thinking about this as the roots of a polynomial, we see that we must have $\rho(Y, Z)$ inside the open interval \begin{align*} ( \rho(X, Y) \rho(X, Z) &- \sqrt{ \rho(X, Y)^2 \rho(X, Z)^2 + 1 - \rho(X, Y)^2 - \rho(X, Z)^2}; \\ ~~~~~~~~ \rho(X, Y) \rho(X, Z) &+ \sqrt{ \rho(X, Y)^2 \rho(X, Z)^2 + 1 - \rho(X, Y)^2 - \rho(X, Z)^2} ). \end{align*} In practice, this means that if, for example, $\rho(X, Y) = \rho(X, Z) = 1$; for $\rho(Y, Z)$, the value must be 1. This can also be used to find answer to a common interview question: If $\rho(X, Y)= 0.9$, $\rho(X, Z) = 0.8$, Can $\rho(Y, Z) = 0.1$? Here, we see that it is not possible.