# Probability that $\displaystyle \vert x\vert +\vert y\vert +\vert z\vert +\vert x+y+z\vert=\vert x+y\vert +\vert x+z\vert +\vert y+z\vert$

Real numbers $$x, y$$, and $$z$$ are chosen from the interval $$[−1, 1]$$ independently and uniformly at random. What is the probability that $$\vert x\vert +\vert y\vert +\vert z\vert +\vert x+y+z\vert=\vert x+y\vert +\vert x+z\vert +\vert y+z\vert$$

Now if all of $$x, y, z$$ are positive or all negative then the equation is of course satisfied. Hence if we consider a 3D space , it denotes two unit cubes, one in the first octant centred at $$\left( \frac 12,\frac 12,\frac 12\right)$$ and the other in seventh octant centred at $$\left( -\frac 12,-\frac 12,-\frac 12\right)$$.

The total measure of universal set is the cube with edge length $$2$$ centred at origin.

But now I have a problem about what if any two of $$x, y, z$$ are positive while the other remaining be negative or the other way around. Even if I try to make cases it seems to be quite a cumbersome task to approach since we will also need to check signs of $$\vert x+y\vert$$ and similarly others as well as that of $$\vert x+y+z\vert$$

I also thought to give a shot using vectors but didn't reach any specific result.

Any help would be quite beneficial.

Edit:

I would also be happy to see a geometrical intuitive way to attack the problem.

• I have to admit nothing comes quickly to mind. I did a quick simulation, and the probability (assuming I haven't made any mistakes) comes out to something close to $0.3489$. Doesn't ring any bells yet. I'll keep thinking about it. Interesting problem. – Brian Tung Feb 17 at 5:30
• @BrianTung Thanks and by the way the answer is $3/8$ as stated by my professor. – Rohan Shinde Feb 17 at 5:33
• Weird. I must have done something wrong. Let me make sure I've picked the right PRNG. – Brian Tung Feb 17 at 5:36
• @Digamma: Yeah, it was all roundoff error. I get $3/8$ now, too. – Brian Tung Feb 17 at 5:39
• There is a natural $n$-d generalization (even length sums = odd length sums), and the 4-d probability is 13/48. As in the 3-d case, the measure in two orthants is 1, and the measure in all others is 1/6. My simple symbolic integration routine crashed Mathematica for the 5-d case, however. – Jim Ferry Feb 20 at 5:21

Suppose $$x$$ and $$y$$ are positive and consider the possible values of $$z$$. Because $$|x|+|y|=|x+y|$$ here, we want the equation $$|z| + |x+y+z| = |x+z| + |y+z|$$ to hold.

Assume $$x \le y$$; in this case, we have $$z \le x+z \le y+z \le x+y+z$$, and so we can consider five possibilities based on which of these are positive.

1. $$0 \le z \le x+z \le y+z \le x+y+z$$. Then the equation holds. You already know this case.
2. $$z \le 0 \le x+z \le y+z \le x+y+z$$. Then the equation simplifies to $$x+y=x+y+2z$$, which has probability $$0$$.
3. $$z \le x+z \le 0 \le y+z \le x+y+z$$. Then the equation simplifies to $$x+y=y-x$$, which has probability $$0$$.
4. $$z \le x+z \le y+z \le 0 \le x+y+z$$. Then the equation simplifies to $$x+y = -x-y-2z$$, which has probability $$0$$.
5. $$z \le x+z \le y+z \le x+y+z \le 0$$. Then the equation holds. This case is new.

The same thing happens when $$x \ge y$$, so that doesn't need to be considered separately.

So we see that when $$x$$ and $$y$$ are positive, we want either $$z$$ to be positive as well, or we want $$x+y+z$$ to be negative.

By symmetry, this covers all the possibilities. The equation holds when:

• All three of $$x,y,z$$ are positive;
• Two of $$x,y,z$$ are positive, but $$x+y+z$$ is negative;
• Two of $$x,y,z$$ are negative, but $$x+y+z$$ is positive;
• All three of $$x,y,z$$ are negative.

The regions inside $$[-1,1]^3$$ where these hold have volume respectively:

• $$1$$ (it's a cube of side length $$1$$);
• $$\frac12$$ (it's three pyramids that form a corner of a cube with $$\frac16$$ the volume);
• $$\frac12$$;
• $$1$$.

So total volume $$3$$ (out of $$8$$), so the equation holds with probability $$\frac38$$.

• Can you try to generalize it for n-dimensional space please? – Rohan Shinde Feb 20 at 9:30
• Not with the same approach; the amount of casework grows exponentially. – Misha Lavrov Feb 20 at 14:32

A simulation using R statistical software, for those interested, agrees with the theoretical answer.

> x<-runif(10^7,-1,1)
> y<-runif(10^7,-1,1)
> z<-runif(10^7,-1,1)
> mean(abs(x)+abs(y)+abs(z)+abs(x+y+z)==abs(x+y)+abs(x+z)+abs(y+z))
[1] 0.3749906


The following simulation in Matlab gives simulated probabilities, $$10^7$$ results for n from 2 to 10. Things written after percent signs are comments.

for n=2:10 % dimension n
b=cell(1,n);
[b{:}]=ndgrid(0:1); % n different 2x2x2x...x2 arrays
A=cat(20,b{:});
B=reshape(A,2^n,n); % array contains 0s and 1s to define all 2^n sums
C=(-1).^sum(B,2); % array contains +1 or -1 for each sum
for m=1:10000 % 10000 times 1000 trials is 10^7
D=(2*rand(1000,n)-1)*B'; % 1000 trials, all 2^n sums
E=abs(D)*C; % all 1000 combined sums
k(n)=k(n)+sum(abs(E)<1e-8); % count combined sums =0, give or take underflow
end;
disp(num2str([n k(n)/10000000]));
end;

2.0000    0.4998
3.0000    0.3748
4.0000    0.2710
5.0000    0.1900
6.0000    0.1240
7.0000    0.0815
8.0000    0.0494
9.0000    0.0297
10.0000    0.0168