# Function of independent random variables cannot be independent of each variable?

Suppose $Y_1,Y_2,\ldots, Y_n$ are independent, where $Y_i$ is a continuous valued random variable with a density $p_{Y_i}(y_i)$ on its domain $\mathcal{D}_i\subseteq \mathbb{R}.$ Can one show that for any continuous function $f:\mathbb{R}^n\to\mathbb{R},$ that is non-constant on $\mathcal{D}_1\times \mathcal{D}_2\times\ldots \times \mathcal{D}_n,$ we must have that $f(Y_1,Y_2,\ldots, Y_n)$ is not independent of $Y_i$ for at least one $i$?

Note: It is possible that $f(Y_1,Y_2,\ldots, Y_n)$ is independent of $Y_i$ for some $i.$ For instance, if $Y_1$ is distributed uniformly on $[0,1]$ and $Y_2,Y_3$ are normally distributed with mean 0 and variance 1, then $Z:=f(Y_1,Y_2,Y_3) = Y_1\cdot Y_2+\sqrt{1-Y_1^2}\cdot Y_3$ is independent of $Y_1.$

Note 2: One can construct counterexamples if $Y_1,Y_2,\ldots, Y_n$ are allowed to be discrete valued. For instance, if $Y_i$ is a Bernoulli random variables with parameter $\frac{1}{2},$ then $f(Y_1,Y_2,\ldots, Y_n)$ defined as the XOR of all the $Y_i$'s is independent of each $Y_i.$

• More generally, in the discrete case such functions are called "correlation immune" and are important in cryptology and elsewhere. Aug 6, 2013 at 2:34

First define $f:[0,1]\rightarrow [0,1]$ as follows:
$$f(x,y)=2(y-x)-1 \hbox{ if } 1\ge y-x \ge 1/2$$ $$f(x,y)=-2(y-x)+1 \hbox{ if } 1/2\ge y-x \ge 0$$ $$f(x,y)=2(y-x)+1 \hbox{ if } 0\ge y-x \ge -1/2$$ $$f(x,y)=-2(y-x)-1 \hbox{ if } -1/2\ge y-x \ge -1$$
Then let $X$ and $Y$ be uniformly (and independently) distributed on $[0,1]$. It's easy to check that $f(X,Y)$ is independent of both $X$ and $Y$.