# Does independence of $X_i$ and $Y_j$ imply independence of vectors $\mathbf{X}$ and $\mathbf{Y}$?

Let independency of two random variables $$A$$ and $$B$$ be defined as $$P(A,B) = P(A)P(B)$$.

Let's consider two vectors as variables $$\mathbf{X} = (X_1, X_2)$$ and $$\mathbf{Y} = (Y_1,Y_2)$$.

Must we have that $$\mathbf{X}$$ and $$\mathbf{Y}$$ are independent if the elements $$X_i$$ and $$Y_j$$ are independent for all $$i$$ and $$j$$?

Related: In Intuition on Independence of Random Vectors , it is explained that independence of vectors $$\mathbf{X}$$ and $$\mathbf{Y}$$ implies independence of $$X_i$$ and $$Y_j$$. Is the reverse also true?

An example is for a vector $$X$$ of size 1 and $$Y$$ of size 2.

Let $$X$$ be Bernoulli variable with equal probability. Let $$Y$$ be distributed, with equal probability, among $$(1,1)$$ or $$(0,0)$$ if $$X=0$$ and among $$(1,0)$$ and $$(0,1)$$ if $$X=1$$.

Then following observations will occur with equal probability

X1  Y1   Y2
1    1    0
1    0    1
0    1    1
0    0    0


Here $$X_1$$ is independent from $$Y_1$$ and $$X_1$$ is independent from $$Y_2$$. But $$X_1$$ is not independent from $$(Y_1,Y_2)$$.