# Does uniform conditional distribution imply independence?

Take two random variable $X,Y$ and suppose $X$ is distributed uniformly on $[0,1]$ conditional on $Y$. Does this imply that $X$ is independent of $Y$? Could you make an example?

Independence would mean that knowing the value of $Y$ gives no information on the value of $X$.

So here $X$ will be independent of $Y$ only if $X$ has a uniform marginal distribution on $[0,1]$, and the conditional distribution $X|Y$ is uniform on $[0,1]$ independent of the value of $Y$.

An example be a uniform (joint) distribution over the unit square.

Here are some examples using Tetris blocks:

For the "S" block we have $p[X|Y=\text{middle}]=p[X]=\text{uniform}$, but $X$ is certainly not independent of $Y$.

While for the "O" block we have $p[X|Y]=p[X]=\text{uniform}$, so $X$ is independent of $Y$.

• Thanks. However is it true that if $X$ conditional on $Y$ is distributed as a standard Normal then $X$ and $Y$ are independent? – user3285148 Apr 27 '17 at 17:06
• I might have misunderstood. If $X|Y$ is uniform on $[0,1]$ for all $Y$ values, then yes it is independent: The value of $Y$ does not enter into the formula for $p[X|Y]$. I thought you meant just you had one particular $Y$ value. – GeoMatt22 Apr 27 '17 at 17:14
• So the point is that it is not the particular form of $p[X|Y]$ that matters, but the fact that it does not depend on the value of $Y$. – GeoMatt22 Apr 27 '17 at 17:18
• I added an example of $X$ uniform for only some $Y$, where the marginal is uniform but $X$ does depend on $Y$. – GeoMatt22 Apr 27 '17 at 18:13
• @user3285148: There's no such thing as "the standard normal exception". (Source: A Google search for this exact phrase gives only this question, and some unrelated Linkedin profiles). As GeoMatt22 explains, it's not the particular form of the conditional distribution that matters (be it Uniform, Normal, Gamma or whatever), only that it is the same distribution for every possible value of Y. – Meni Rosenfeld Apr 27 '17 at 20:38

If the conditional pdf of $X$ given $Y$ is the same density function for all values of $Y$ (in the support of $f_Y(y)$), that is, $f_{X\mid Y}(x\mid y)$ equals $g(x)$ where the value of $g$ does not depend on $y$ at all, then $$f_X(x) = \int f_{X,Y}(x,y) \mathrm dy = \int f_{X\mid Y}(x\mid y)\cdot f_Y(y)\mathrm dy = g(x)\int f_Y(y)\mathrm dy = g(x),$$ that is, the unconditional pdf of $X$ is the same as the common conditional pdf of $X$ given $Y$. In particular, uniformity does not have anything to do with it at all: what we need is that it is always the same density function regardless of the value of $y$.

Suppose that $f_{X,Y}(x,y)$ has value $1$ on (the interior of) the unit square. Then $f_{X\mid Y}(x\mid y) \sim U(0,1)$ and $X$ and $Y$ are both independent $U(0,1)$ random variables.

Suppose that $f_{X,Y}(x,y)$ has value $2y$ on (the interior of) the unit square. Then $f_{X\mid Y}(x\mid y) \sim U(0,1)$, and $X \sim U(0,1)$ also. Note that $X$ and $Y$ are independent random variables but $Y$ is not a $U(0,1)$ random variable.

Suppose that $f_{X,Y}(x,y)$ has value $2x$ on (the interior of) the unit square. Then $f_{X\mid Y}(x\mid y) = 2x\mathbf 1_{\{x\colon x \in (0,1)\}}$ and the unconditional density of $X$ is the same density. $X$ and $Y$ are independent random variables but $X$ is not a $U(0,1)$ random variable. Uniform distribution of $X$ is not needed: what is needed is that $f_{X\mid Y}(x\mid y)$ is the same for all choices of $y$.