# Two random variables and their sum

$X$ and $Y$ are random variables uniformly distributed on $[a,b]$. Could the random variable $Z=X+Y$ be uniformly distributed if $X$ and $Y$ are dependent and correlation between them doesn't equal $1$ or $-1$?

-
$1/12$ of the square of the range of $Z$ is the variance of $Z$ if $Z$ is uniformly distibuted. That means the range of $Z$ would be less than $2(b-a)$. The variance of $Z$ is also $(b-a)^2(1+\rho)$ where $\rho$ is the correlation. Shortening the range of $Z$ necessarily means chopping triangles off corners of the square $[a,b]^2$. – Michael Hardy Dec 27 '12 at 0:12

Yes. For instance, let $X$ be uniformly distributed on $[0,1]$, and let $Y$ be equal to $\left\{ X+\frac{1}{2}\right\}$, where $\{x\}$ represents the fractional part of $x$. Then $Z=X+\left\{ X+\frac{1}{2}\right\}$ is uniformly distributed on $[1/2,3/2]$. There is an infinite family of such examples, parametrized by the number of jump discontinuities of $Y(X)$, in which $Z$ is uniformly distributed over $[1-1/n,1+1/n]$ and the correlation between $X$ and $Y$ approaches $-1$ as $n\rightarrow\infty$.

-
@cardinal Oh, I see that I was typing stupid comments without thinking. Thanks. – Learner Dec 27 '12 at 1:45
@Learner: It happens (to all of us). :-) – cardinal Dec 27 '12 at 1:46

We produce a discrete example, because the details are more pleasant to verify. The same idea leads to a continuous example.

Let $X=-3,-1,1,3$ each with probability $1/4$. Suppose that when $X=-3,-1,1,3$ respectively, then $Y=1,3,-3,-1$ respectively. Then $X+Y$ takes on the values $-2$ and $2$, each with probability $1/2$.

Since $X$ and $Y$ have mean $0$, their covariance is $E(XY)$ is $-3$. The variance of $X$ and of $Y$ are each $5$. So the correlation coefficient of $X$ and $Y$ is $-\frac{3}{5}$.

Continuous examples can be made using a similar strategy.

-
This is the same answer as @mjqxxxx has previously supplied. – cardinal Dec 27 '12 at 3:11
@cardinal: I have removed the continuous example. – André Nicolas Dec 27 '12 at 3:16