Why are these two distributions the same? I came across this problem on Stack Overflow, where the OP was drawing two numbers $x_1$ and $x_2$, from a distribution $U(0,1)$, and defining a new value
$$ y = \left\{\begin{array}{ll}x_1 + x_2 & \mathrm{if\ }x_1 + x_2 \le 1 \\ 2 - x_1 - x_2 & \mathrm{otherwise}\end{array}\right.$$
Based on the description, it sounded like the OP might have been trying to fill a circle equally, so I checked if the distribution was the same as the distribution of $\sqrt{x_1}$. The distributions appear the same (comparing the distribution of $10^5$ samples of each), but I'm not sure why this is the case.

Can anyone explain this? The distribution of $x_1 + x_2$ is triangular (as one would expect) but I'm not sure why "folding it" upon itself gives this result.
UPDATE
I've come up with a partial answer that at least satisfies my curiosity but I don't think I have a 100% solution yet. It might not be perfectly formulated from a mathematical perspective, (especially the second part about the circle).
Using information here, I was able to figure out where the OP's distribution comes from more mathematically. If $X\sim U[0,1]$ and $Y$ is from the convolution $Y = X + X$, then we would have
$$ f_Y(s) = \int_{\mathbb{R}} f_X(x-s) f_X(x) dx,$$
where
$$ f_X(x) = \left\{\begin{array}{ll}1 & \mathrm{if\ } 0 \le x < 1 \\ 0 & \mathrm{otherwise} \end{array}\right.$$
This gives
$$ f_Y(s) = \left\{\begin{array}{ll} s & \mathrm{if\ } 0 \le s < 1 \\ 2 - s & \mathrm{if\ } 1 \le s < 2 \\ 0 & \mathrm{otherwise} \end{array}\right.$$
"Folding" $f_Y$ at $s=1$ (not sure the correct term) is the same as truncating it but doubling the pdf so we just have our new distribution $f_\tilde{Y}$,
$$ f_\tilde{Y}(s) = \left\{\begin{array}{ll} 2 s & \mathrm{if\ } 0 \le s < 1 \\ 0 & \mathrm{otherwise} \end{array}\right.$$
Now, if we consider a circle of radius $r_o$ then the area of a circle with radius $r \le r_o$ normed by $\pi r_o^2$ is like the cdf of $r$ inside that circle. Normalizing so $r_o=1$, the pdf would follow $2r$ inside the circle,
$$ f_R(r) = \left\{\begin{array}{ll} 2 r & \mathrm{if\ } 0 \le r < 1 \\ 0 & \mathrm{otherwise} \end{array}\right.$$
and $f_R=f_\tilde{Y}$.
I guess what's left is how do we define the distribution of $\sqrt{X} $where $X\sim U[0,1]$.
 A: Starting with the update above...
Using information here, I was able to figure out where the OP's distribution comes from more mathematically. If $X\sim U[0,1]$ and $Y$ is from the convolution $Y = X + X$, then we would have
$$ f_Y(s) = \int_{\mathbb{R}} f_X(x-s) f_X(x) dx,$$
where
$$ f_X(x) = \left\{\begin{array}{ll}1 & \mathrm{if\ } 0 \le x < 1 \\ 0 & \mathrm{otherwise} \end{array}\right.$$
This gives
$$ f_Y(s) = \left\{\begin{array}{ll} s & \mathrm{if\ } 0 \le s < 1 \\ 2 - s & \mathrm{if\ } 1 \le s < 2 \\ 0 & \mathrm{otherwise} \end{array}\right.$$
"Folding" $f_Y$ at $s=1$ (not sure the correct term) is the same as truncating it but doubling the pdf so we just have our new distribution $f_\tilde{Y}$,
$$ f_\tilde{Y}(s) = \left\{\begin{array}{ll} 2 s & \mathrm{if\ } 0 \le s < 1 \\ 0 & \mathrm{otherwise} \end{array}\right.$$
Now, if we consider a circle of radius $r_o$ then the area of a circle with radius $r \le r_o$ normed by $\pi r_o^2$ is like the cdf of $r$ inside that circle. Normalizing so $r_o=1$, the pdf would follow $2r$ inside the circle,
$$ f_R(r) = \left\{\begin{array}{ll} 2 r & \mathrm{if\ } 0 \le r < 1 \\ 0 & \mathrm{otherwise} \end{array}\right.$$
and $f_R=f_\tilde{Y}$.
Now coming at it from the other direction...
Returning to the original observation that the square root of a uniform distribution gave the same result as the addition of the two distributions, we can show they are the same using information from these lecture notes. First, let $z=g(x)$, in which case if $g$ is a 1-1 function on the domain of interest, then $$f_{Z}(z) = \frac{f_{X}(x)}{|g'(x)|}$$For $Z=\sqrt{X}$ or $X=Z^2$, where $z=g(x)=\sqrt{x}$, $$f_Z(z) = \frac{1}{|1/(2\sqrt{x})|} = \frac{1}{|1/(2z)|} = 2z.$$
