# Are two random vectors independent if their corresponding components are all independent?

Let $$\mathbf{X} = (X_1,\ldots,X_n)$$ and $$\mathbf{Y} = (Y_1,\ldots,Y_n)$$ be random vectors, and let $$f_{\mathbf{X}}(x_1,\ldots,x_n)$$ and $$f_{\mathbf{Y}}(y_1,\ldots,y_n)$$ be their respective pdfs or pmfs. If $$X_i$$ and $$Y_i$$ are independent for each $$i$$, i.e. $$f_{X_i,Y_i}(x,y) = f_{X_i}(x) f_{Y_i}(y) \;\;\;\text{for} \; i=1,2,\ldots,n$$ (where $$f_{X_i}(x),f_{Y_i}(x)$$ are the marginal pdfs/pmfs of $$X_i$$ and $$Y_i$$, respectively, and $$f_{X_i,Y_i}(x,y)$$ is the joint pdf/pmf of $$X_i$$ and $$Y_i$$), then is it necessarily true that

$$f_{\mathbf{X},\mathbf{Y}}(x_1,\ldots,x_n,y_1,\ldots,y_n) = f_{\mathbf{X}}(x_1,\ldots,x_n) f_{\mathbf{Y}}(y_1,\ldots,y_n) \; ?$$ ($$f_{\mathbf{X}}$$ and $$f_\mathbf{Y}$$ being the pdfs/pmfs of $$\mathbf{X}$$ and $$\mathbf{Y}$$, respectively, and $$f_{\mathbf{X},\mathbf{Y}}$$ being the joint pdf/pmf of $$\mathbf{X}$$ and $$\mathbf{Y}$$.) This seems like it should be true, and I've tried to prove it by induction on $$n$$, but I was not successful.

No, this is not true. Here's a counterexample: You flip two fair coins (independently). $$H_1$$ is 1 if the first coin is heads and 0 if it's tails, while $$T_1$$ is 1 if the first coin is tails and 0 otherwise. We use analogous notation for the result of the second flip, $$H_2$$ and $$T_2$$.

Now consider $$X = (H_1, H_2)$$ and $$Y = (T_2, T_1)$$. Each component is independent (i.e. $$H_1$$ is independent of $$T_2$$, and $$H_2$$ is independent of $$T_1$$). However $$f_{X,Y}(H_1=1, H_2=1, T_2=1, T_1=1) = 0$$, rather than $$f_{X}(H_1=1, H_2=1)f_Y(T_2=1, T_1=1) = (1/4)(1/4) = 1/16$$.

• Thanks for this nice simple example! – Leonidas Jul 18 at 17:46

As a sort of elaboration of @mlphd31's nice example (+1), suppose $$X_1, X_2, \dots, X_{50}$$ and $$Y_1, Y_2, \dots, Y_{50}$$ are all independently distributed as $$\mathsf{Unif}(0,50),$$ and that $$X_{51}, X_{52}, \dots, X_{100}$$ and $$Y_{51}, Y_{52}, \dots, Y_{100}$$ are all independently distributed as $$\mathsf{Unif}(50,100).$$ This scenario is simulated in R:

set.seed(716)
a=rep(c(0,50),50)
x = runif(100, a, a+50)
y = runif(100, a, a+50)


Then $$\mathbf{X} = (X_1, \dots, X_{100})$$ is not independent of $$\mathbf{Y} = (Y_1, \dots, Y_{100}),$$ as shown by non-zero correlation and a 2-dimensional plot.

cor(x, y)
[1] 0.7454673
plot(x, y, pch=20)


Perhaps closer to a practical example, for each $$i = 1, 2, \dots, 100,$$ let $$X_i, Y_i$$ be independently distributed as $$\mathsf{Norm}(i+30, 5).$$ [We may be weighing 100 standard specimens of known weights $$i+30$$ on two different low-quality scales in order to assess whether the two scales are of equal accuracy or precision.]

set.seed(2020)
mu = 31:130
x = rnorm(100, mu, 5)
y = rnorm(100, mu, 5)
cor(x, y)
[1]0.962425
plot(x, y, pch=20)


• Thanks for these thoughtful examples + plots! – Leonidas Jul 18 at 17:48