# Slope and intercept of linear equation of uniformly distributed variables

Consider the random variable $y_M$ which equals the sum of $M$ independently uniformly distributed random variables; i.e., $y_M = x_1 + x_2 +\ldots + x_M$, with the assumption that each of the $x_i$ are independently and uniformly distributed. The variance of the sum equals the sum of the variances of each of the $x_i$. That is, $Var[x_1 + x_2 + \ldots + x_M]$ $= Var[x_1] + Var[x_2] + \ldots + Var[x_M]$. Likewise, $Mean[x_1 + x_2 + \ldots + x_M]$ $= Mean[x_1] + Mean[x_2] + \ldots + Mean[x_M]$.

Given this I need to do the following:

1. Construct $Y(x_1, x_2 , \ldots, x_M) = a(x_1 + x_2 + \ldots + x_M) + b$.
2. Find $a$ (slope) and $b$ (intercept) such that $Y$ has zero mean and unit variance.

This seems to be a transformation technique (of which I'm unaware). Any thoughts on how to approach this problem?

• Just as I expected here: stats.stackexchange.com/questions/15805/…. This is a kind of transformation that is covered in any calculus-based introduction to statistics book, and you have half of the answer in your question already: $E[Y]=a\sum E[X_i] + b$, $V[Y] = a^2 \sum V[X_i]$. Sep 26, 2011 at 20:58
• So I solve and get a = sqrt(1 / var(x)) and b = -mean(x) / sqrt(var(x)). Then my normally distributed variable is Y = a * sum(x) + b? Sep 26, 2011 at 21:26
• Ahh got it. Sum of expected values (0.5) and variances (1/12). Thanks. Sep 26, 2011 at 21:40

Hint: since $$a$$ and $$b$$ are constants, you can compute the mean and variance of $$Y$$ in terms of $$a$$, $$b$$, and what you have already established. That gives two easily-solved equations in two unknowns.

### Edit

Now that the answer has been sketched in comments, I will sketch it here for completeness. The general setting in which this works is one in which $$(x_1, x_2, \ldots, x_M)$$ has an $$M$$-variate distribution with finite first and second moments (namely, its expectation $$(\mu_i)$$ and covariance matrix $$\Sigma_{ij}$$). (That is, they do not have to be uniform--indeed they do not have to have a common distribution--and they can be dependent.) Using the most basic properties of expectation and variance, we compute

$$Var(Y) = Var(a(x_1 + \ldots + x_M) + b) = a^2\sum_{i=1}^M\sum_{j=1}^M \text{Covar}(x_i,x_j) = a^2\sum_{i,j}\Sigma_{ij}$$

and

$$\mathbb{E}[Y] = a(\mu_1 + \mu_2 + \ldots + \mu_M) + b = a\mu + b.$$

We can therefore make the variance equal to unity by setting $$a = \left(\sum_{i,j=1}^M\Sigma_{ij}\right)^{-1/2}$$ and zero out the mean by setting $$b = -a\mu$$. This can always be done provided $$Y$$ isn't degenerate (that is, constantly equal to a single value, in which case $$\sum_{i,j}\Sigma_{ij}=0$$).

A special case is when the $$x_i$$ have a common uniform distribution supported on $$[0,1]$$ and are independent. Here, $$\mu_i = 1/2$$ implies $$\mu=M/2$$ and $$\Sigma_{ij} = (1/{12})\delta_{ij}$$ implies $$\sum_{i,j}\Sigma_{ij} = M/{12}$$, whence $$a = \sqrt{12/M}$$ and $$b = -a\mu$$ $$=-\sqrt{M/12}$$.

• Thanks for your response, and forgive the ignorance, but how does computing the mean and variance help in computing a and b? Sep 26, 2011 at 17:41
• @strimp Because you can then solve for the values of $a$ and $b$ that standardize $Y$ (make it have zero mean and unit variance).
– whuber
Sep 26, 2011 at 19:56