# Prove 2 identical uniform's are independent by computing the joint distribution

Let $$A,B,C$$ be iid Unif(0,1). Let $$X,Y$$ be random variables:

• $$X=(A-B)1_{A-B>0}+(1+(A-B))1_{A-B<0}$$

• $$Y=(C-B)1_{C-B>0}+(1+(C-B))1_{C-B<0}$$

I am able to show that $$X,Y$$ are id Unif(0,1). My problem is showing they are iid (i.e. I'm missing the independent).

(I'm not allowed to use measure theory here, but I actually don't see how I would anyway since both $$X$$ and $$Y$$ have a '$$B$$' in the formula.)

Okay so elementary probability stuff only. Let's compute joint cdf and hope it's uniform on unit square. This is

$$P(X \le x, Y \le y) = 1_{x,y > 1} + x1_{0 < x < 1, y > 1} + y1_{0 < y < 1, x > 1} + xy1_{0 < x,y < 1}$$

I believe I get everything except the $$xy1_{0 < x,y < 1}$$ part.

It seems we have to take cases

• Case 1:$$X=A-B, Y=C-B$$
• Case 2: $$X=(A-B)+1, Y=C-B$$
• Case 3: $$X=A-B, Y=(C-B)+1$$
• Case 4: $$X=(A-B)+1, Y=(C-B)+1$$

Okay let's try Case 1. (Update: The bounds are wrong, but the questions in re the tags are still valid, I believe.)

$$P(0 < X = A - B \le x, 0 < Y = C - B \le y)$$

What I think is conditional probability but of 2 random variables conditioned on 1. Instead of the usual $$P(z_1 < Z < z_2 | B=b) := \int_{z_1}^{z_2} f_{Z|B=b}(z) dz,$$ with $$f_{Z|B=b}(z)=\frac{f_{Z,B}(z,b)}{f_B(b)},$$ it looks like we'll have like $$P(z_1 < Z < z_2, u_1 < U < u_2 | B=b) := \int_{u_1}^{u_2} \int_{z_1}^{z_2} f_{(Z,U)|B=b}(z,u) dz du,$$ with $$f_{(Z,U)|B=b}(z,u) =$$, I think, $$\frac{f_{Z,U,B}(z,b,u)}{f_B(b)}$$

• Note: if any of the definitions ':=' are in fact not definitions, then you'll have to explain conditioning on an event of probability zero to me please.

So here's what I think is next:

$$P(0 < X = A - B \le x, 0 < Y = C - B \le y) = P(B < A \le x+B, B < C \le y+B)$$

$$= \int_{b=0}^{b=1} P(B < A \le x+B, B < C \le y+B | B=b) f_B(b) db \tag{1?}$$

$$= \int_{b=0}^{b=1} P(b < A \le x+b, b < C \le y+b | B=b) f_B(b) db \tag{2????}$$

$$= \int_{b=0}^{b=1} \int_{b}^{x+b} \int_{b}^{y+b} f_{(A,C)|B=b}(a,c) dc da f_B(b) db \tag{3 part 1?}$$

$$= \int_{b=0}^{b=1} \int_{b}^{x+b} \int_{b}^{y+b} \frac{f_{(A,C,B)}(a,c,b)}{f_B(b)} dc da f_B(b) db \tag{3 part 2?}$$

$$\text{[details omitted because actually the bounds are wrong]}$$

$$\text{[details omitted because actually the bounds are wrong]}$$

$$\text{[details omitted because actually the bounds are wrong]}$$

$$= xy$$

And then assuming all of the above is correct and all the question mark parts are justified, repeat for the other 3 cases and it looks like we have $$xy$$ in each. Are these cases supposed to be added up and so I'm missing $$\frac14$$? Or what?

• Case 2: $$b-1, so again just $$xy$$

• Case 3: $$b, so again just $$xy$$

• Case 4: $$b-1, so again just $$xy$$

• For $$(1?)$$, I think the rule is like for an event $$E$$ and continuous random variable $$B$$, we have $$P(E)=\int_{\mathbb R} P(E|B=b) f_B(b) db$$. Is this correct?

• Oh wait a minute wiki says we can't quite do this. What I understand is that we can't do it for arbitrary $$E$$, but we can do it when (but not only when I guess) $$E=\{Y \in \ \text{some interval or Borel set I guess}\}$$, for some continuous random variable $$Y$$ s.t. the joint pdf $$f_{X,Y}$$ is well-defined? (I forgot if any 2 continuous random variables necessarily have a well-defined joint pdf.)
• For $$(2????)$$, I think we're doing something like for events $$E$$, $$H$$ and $$G$$ and continuous random variable $$B$$: we have $$P(E|H)=P(E \cap H|H)$$, but $$P(G|H)$$ is defined only for $$P(H)>0$$. What is being done here when technically $$P(H)=0$$? I mean of course in the 1st place when we say like '$$P(E|B=b)$$', this is notational, we're not really conditioning on the $$P$$-null event $$\{B=b\}$$. But I still don't get exactly what's being done here.

• For $$(3 \ \text{parts 1 and 2})$$, I'm actually just guessing here, what's the definition of conditional joint cdf of 2 random variables given a 3rd? And please provide a reference.

• Wiki just says $$F_{(X,Y)|Z=z}(x,y):=P(X \le x, Y \le y|Z=z)$$, but it doesn't quite define $$P(X \le x, Y \le y|Z=z)$$.

• For just 1 continuous random variable conditioned on 1 continuous random variable, it's $$P(X \le x, |Z=z) := \int_{-\infty}^{x} f_{X|Z=z}(t) dt$$, where $$f_{X|Z=z}(t) := \frac{f_{(X,Z)}(x,z)}{f_{Z}(z)}$$.

• For 2 continuous random variables conditioned on 1 continuous random variable, I think it's $$P(X \le x, Y \le y|Z=z) := \int_{-\infty}^{x} \int_{-\infty}^{y} f_{(X,Y)|Z=z}(t,u) du dt$$, but then...

• What's $$f_{(X,Y)|Z=z}(t,u)$$? (I guess we do the elementary probability way of thinking: define the pdf before the cdf...) According to this site (see problems 1 and 16), it's $$f_{(X,Y)|Z=z}(t,u): = \frac{f_{(X,Y,Z)}(t,u,z)}{f_Z(z)}$$. So, I guess I'm right about joint cdf/pdf stuff. I'm just hoping for a reference please.

• As I wrote in an answer to a previous question like this one: draw a picture. – whuber Mar 18 at 13:33
• @Xi'an Although certainly your diagrams qualify, I don't see any 3D versions there. – whuber Mar 18 at 18:55
• @whuber wait I made a huge error over something apparently so simple (maybe). Please see edit. Is it correct? I have $xy$ now instead of $xy \pm$ (other stuff) – John Smith Kyon Mar 22 at 5:57
• @whuber updated question. it's not just about the bounds now. i get the bounds are wrong. i figured out the bounds on my own. now i'm wondering about the joint pdf/cdf stuff mainly. – John Smith Kyon Mar 24 at 5:37
• Cross-post: math.stackexchange.com/q/4066689/321264. – StubbornAtom Mar 25 at 14:55

The joint distribution of $$(A^-,C^ -)=(A-B,C-B)$$ is given by its density \begin{align} f(a^-,c^-)&=\int f_A(a^-+b)f_C(c^-+b)f_B(b)\,\text d b\\ &=\int_0^1 \mathbb I_{(0,1)}(a^-+b)\mathbb I_{(0,1)}(c^-+b)\,\text d b\\ &=[\min(1,1-a^-,1-c^-)-\max(0,-a^-,-c^-)]^+\\ &=\mathbb I_{(0,1)}(a^-)\mathbb I_{(0,1)}(c^-)[\min(1,1-a^-,1-c^-)-\max(0,-a^-,-c^-)]^+\\ &\ +\mathbb I_{(-1,0)}(a^-)\mathbb I_{(0,1)}(c^-)[\min(1,1-a^-,1-c^-)-\max(0,-a^-,-c^-)]^+\\ &\ +\mathbb I_{(0,1)}(a^-)\mathbb I_{(-1,0)}(c^-)[\min(1,1-a^-,1-c^-)-\max(0,-a^-,-c^-)]^+\\ &\ +\mathbb I_{(-1,0)}(a^-)\mathbb I_{(-1,0)}(c^-)[\min(1,1-a^-,1-c^-)-\max(0,-a^-,-c^-)]^+\\ &=\mathbb I_{(0,1)}(a^-)\mathbb I_{(0,1)}(c^-)[\min(1-a^-,1-c^-)-0]\\ &\ +\mathbb I_{(-1,0)}(a^-)\mathbb I_{(0,1)}(c^-)[\min(1,1-c^-)+a^-]^+\\ &\ +\mathbb I_{(0,1)}(a^-)\mathbb I_{(-1,0)}(c^-)[\min(1,1-a^-)+c^-]^+\\ &\ +\mathbb I_{(-1,0)}(a^-)\mathbb I_{(-1,0)}(c^-)[1+\min(a^-,c^-)]\\ &=\mathbb I_{(0,1)}(a^-)\mathbb I_{(0,1)}(c^-)[1-\max(a^-,c^-)]\\ &\ +\mathbb I_{(-1,0)}(a^-)\mathbb I_{(0,1)}(c^-)[1-c^-+a^-]^+\\ &\ +\mathbb I_{(0,1)}(a^-)\mathbb I_{(-1,0)}(c^-)[1-a^-+c^-]^+\\ &\ +\mathbb I_{(-1,0)}(a^-)\mathbb I_{(-1,0)}(c^-)[1+\min(a^-,c^-)]\\ &=\mathbb I_{(0,1)}(a^-)\mathbb I_{(0,1)}(c^-)\mathbb I_{a^->c^-}[1-a^-]\\ &\ +\mathbb I_{(0,1)}(a^-)\mathbb I_{(0,1)}(c^-)\mathbb I_{a^-c^-}[1+c^-]\\ \end{align}

The joint density thus writes differently on the 8 rectangular triangles of the $$(-1,1)^2$$ square as drawn below (with two triangles where it is null):

If one now considers $$(X,Y)$$ i.e. $$X=A^-+\mathbb I_{A^-<0}\qquad Y=C^-+\mathbb I_{C^-<0}$$ its distribution is defined by the probabilities of arbitrary squares $$\mathbb P((X,Y) \in [x_1,x_2]\times[y_1,y_2]) \qquad 0< x_1,x_2,y_1,y_2<1$$ which are equal to \begin{align}&\mathbb P((A^-,C^-) \in [x_1,x_2]\times[y_1,y_2])\\ &\quad+\mathbb P((A^-+1,C^-) \in [x_1,x_2]\times[y_1,y_2])\\ &\quad+\mathbb P((A^-,C^-+1) \in [x_1,x_2]\times[y_1,y_2])\\ &\quad+\mathbb P((A^-+1,C^-+1) \in [x_1,x_2]\times[y_1,y_2])\\ &=\mathbb P((A^-,C^-) \in [x_1,x_2]\times[y_1,y_2])\\ &\quad+\mathbb P((A^-,C^-) \in [x_1-1,x_2-1]\times[y_1,y_2])\\ &\quad+\mathbb P((A^-,C^-) \in [x_1,x_2]\times[y_1-1,y_2-1])\\ &\quad+\mathbb P((A^-,C^-) \in [x_1-1,x_2-1]\times[y_1-1,y_2-1]) \end{align}

Using the symmetries between the four translated squares, as in the figure below (feel free to move the squares!), the non-constant terms just cancel each other and one ends up with the uniform distribution on $$(0,1)^2$$.

A much faster resolution goes as follows: since $$A^-$$ and $$C^-$$ are independent given $$B=b$$ \begin{align} &P((X,Y)\in [x_1,x_2]\times[y_1,y_2]|B=b)\\ &=\mathbb P((A^-+\mathbb I_{A^-<0},C^-+\mathbb I_{C^-<0}) \in [x_1,x_2]\times[y_1,y_2]|B=b)\\ &=\mathbb P(A^-+\mathbb I_{A^-<0}\in [x_1,x_2]|B=b)\times \mathbb P(C^-+\mathbb I_{C^-<0}\in [y_1,y_2]|B=b)\\ &=\mathbb P(A-b+\mathbb I_{A the conditional joint distribution is Uniform, hence the marginal is also Uniform.

• oh wow. thanks Xi'an. had no idea this would be so complicated. 1 - am i going somewhere with my thought 1? 2 - do you definitely disagree that $A-B$ and $C-B$ are independent for any independent $A,B,C$? 3 - Are $A-B$ and $C-B$ something 'conditionally' independent on $B$ for any independent $A,B,C$? (I didn't learn that much conditional independence in grad or undergrad.) – John Smith Kyon Mar 18 at 10:19
• Thanks xi'an 1 - am i going somewhere with my thought 1? – John Smith Kyon Mar 18 at 11:28
• Xi'an, 4 - wait so i'm going somewhere in my thought 3 re 'promote' (and thought 1 too perhaps)? i'd think to say joint cdf conditional on $B$ is uniform and then say the unconditional joint cdf is uniform – John Smith Kyon Mar 18 at 11:36
• (damn it xi'an i accidentally deleted a comment aside from just -5 and -6...) Edit: (Oh good thing i had another tab open. the other comment i deleted was the update about the $xy$ thingy) – John Smith Kyon Mar 24 at 5:38
• 7 - thanks xi'an! updated question. it's not just about the bounds now. i get the bounds are wrong. i figured out the bounds on my own. now i'm wondering about the joint pdf/cdf stuff mainly. may you please help with the joint pdf/cdf stuff and other stuff in the tag question marks parts? – John Smith Kyon Mar 24 at 5:38

I am able to show that $$X,Y$$ are id Unif(0,1). My problem is showing they are iid (i.e. I'm missing the independent).

Intuitively:

Besides $$X \sim U(0,1)$$ and $$Y \sim U(0,1)$$ you can also show the independence from $$B$$ like $$X|B \sim U(0,1)$$ and $$Y|B \sim U(0,1)$$.

• $$B$$ is the only common variable in the equations for $$X$$ and $$Y$$
• The distributions of $$X$$ and $$Y$$ are independent from this $$B$$

• the $$X$$ and $$Y$$ are also independent from each other.

I believe that this intuitive view is sufficient. The rest, computing a joint distribution, is more like an awkward exercise that obscures the insight.

You could compute the joint distribution conditional on $$B$$ as a 2D uniform variable $$X,Y|B \sim U(0,1) \times U(0,1)$$ to show independence of the joint distribution from $$B$$ to conclude that also $$X,Y \sim U(0,1) \times U(0,1)$$

(I am using the symbol $$\times$$ to indicate the product of the pdf's, I do not know if there's an official notation or standard)

• +1 This is by far the best answer. – Jarle Tufto Mar 24 at 9:49
• @JarleTufto Xian also sort of gives the same answer at the end of his post (but it is obscured by lots of lines of formulae and that's why I added my short post). – Sextus Empiricus Mar 24 at 9:57
• Thanks Sextus Empiricus! 2 follow-up questions: 1 - is the the $X,Y|B \sim$ stuff below the line supposed to be the precise version of the intuitive stuff above the line? or is it an alternative prooff? 2 - in re the $X,Y|B \sim$ stuff below the line, my next question then is what exactly is conditional joint distribution of 2 (or more) random variables on a single random variable (at least assuming they all have continuous pdfs). I ask about this here on maths se and sort of here – John Smith Kyon Mar 25 at 5:20
• @JohnSmithKyon 1 The stuff below the line is an alternative. It is how you can make the approach if you insist on using a joint distribution. 2 To make computations about this joint distribution easier, you could first compute the joint distribution of $X,Y$ with $B$ fixed to some particular value to gain intuition about the problem (particularly $B=0$ is easy and you could start with that, but for the intuition try others too), second do the same but consider it as a parameter. Third, you will realize that the value of the parameter $B$ does not influence the distribution of $X,Y$. – Sextus Empiricus Mar 25 at 6:53
• @Xi'an the second part of my answer is the same as your second part, but in the first part I give an argument that is different and simplifies the problem: there is no need to think about a joint distribution. I disagree with you that mathematical formulas can not be verbose and obscuring intuition, that doesn't mean I am against the use of formulas on this forum (But there are differences in styles). Personally I found the question post full of too much spaghetti, and that's what made me create this simple post. It was not criticism of your post. – Sextus Empiricus Mar 25 at 22:39

I would like the share the results of staring at a diagram. I promise to do almost no calculation (and the calculations that are performed involve only multiplications by $$0,$$ $$1,$$ and $$-1$$ along with additions).

Start by re-expressing $$X$$ as

$$X = A-B \mod 1,$$

which is just the fractional part of $$A-B.$$ This function is defined on the entire $$(A,B)$$ plane, where its contours look like those in the first figure.

On this figure I have outlined the unit square. This is a fundamental domain for the group of unit translations of the square in the plane. The group has other fundamental domains, though, such as this one:

These domains differ by two congruent regions in which the variables $$A\mod 1,$$ $$B \mod 1,$$ and $$A-B \mod 1$$ have matching values:

Therefore the distributions of $$A-B \mod 1$$ are the same on both domains.

However, there's an area (=probability)-preserving map between the domains. The linear transformation defined by the matrix

$$\pmatrix{1 & -1\\0 & 1}$$

is a skew transformation that tilts the second domain (the parallelogram) sideways back into the first domain (the unit square). Because it is a one-to-one area-preserving transformation and does not change the values of $$A \mod 1$$ or $$B \mod 1,$$ it does not change their distribution. But the image of $$A-B \mod 1$$ under this transformation is just $$A:$$

We may perform a similar set of operations in the $$(C,B)$$ plane where $$Y=C-B\mod 1,$$ and achieve a comparable result. The conclusion? The combined transformation

$$\pmatrix{1 & -1 & 0 \\ 0 & 1 & 0 \\0 & 0 & 1} \pmatrix{1 & 0 & -1\\0 & 1 & 0 \\ 0 & 0 & 1} = \pmatrix{1 & -1 & -1\\0 & 1 & 0\\0 & 0 & 1}$$

is a one-to-one distribution-preserving transformation that maps $$(X,B,Y)$$ into $$(A,B,C).$$ Since the latter is a set of iid uniform$$(0,1)$$ variables, so is the former. In particular,

$$X$$ and $$Y$$ have uniform distributions on $$[0,1)$$ and are independent (as well as being independent of $$B$$).

As a check, here's a scatterplot matrix based on 1,000 realizations of $$(A,B,C).$$

A <- seq(0,1, length.out=11)[-1]
X <- expand.grid(A=A, B=A, C=A) + runif(length(A)^3*3, A[1]-A[2], 0)
X$X <- with(X, (A-B) %% 1) X$Y <- with(X, (C-B) %% 1)
pairs(subset(X, select=c(X,B,Y)), pch=19, col="#00000010")


All bivariate marginal distributions, at least, appear to be uniform on the square, supporting these results.