# Sum of iid random variables

Let $X_1, X_2,...,X_n$ be iid random variables. Let $Z_1, Z_2, Z_3$ be defined as $X_1, X_1+X_2, X_1+X_2+X_3$ respectively. Are $Z_1, Z_2$ and $Z_3$ also iid's?

The question is based on renewal processes. If the inter arrival durations are iid, are the arrival times also iid?

• Is this a homework? If yes please use self-study tag.
– Tim
Jan 30, 2015 at 19:27
• In addition to adding the tag, follow the instructions in stats.stackexchange.com/tags/self-study/info. Especially, add your own thoughts on the problem. For example, do you know the definition of iid? Jan 30, 2015 at 19:33
• Suppose the $X_i$ were constants (which can be considered a special case of a random variable). Do you think $X_1, X_1+X_2$, and $X_1+X_2+X_3$ must have the same three values? (That is part of what "iid" implies.)
– whuber
Jan 30, 2015 at 19:45
• @Aksakal "Contains in it" by itself does not imply correlation. For instance, the random variable $X_2 (\sin^2(X_1) + \cos^2(X_1))$ is explicitly a function of $X_1$, but it is independent of $X_1$.
– whuber
Jan 30, 2015 at 19:55
• @Aksakal Right, you got it. (Although invoking the Radon-Nikodym derivative isn't quite right, since we're talking about random variables rather than distributions. But I understand.) That's exactly the point: you must actually do some calculations. You cannot say that just because a variable is "contained in" a formula means it creates a dependence.
– whuber
Jan 30, 2015 at 20:05

Assume that $E[X_i]=0$. If this is not true, then simply subtract the mean, it's a constant, so it will not change anything.

For independent random variables $Cov[Z_nZ_{n-1}]=E[Z_nZ_{n-1}]=0$.

Evaluate the left hand side $$E[Z_nZ_{n-1}] =E[(Z_{n-1}+X_n)Z_{n-1}] =E[X_nZ_{n-1}]+E[Z^2_{n-1}] =E[Z^2_{n-1}]>0$$ So, $Z_n$ is not independent of $Z_{n-1}$.

Here, we used $E[X_nZ_{n-1}]=0$, because $X_n$ is independent of all $X_i$.

This answer is meant to supplement this excellent analytical answer. I often like to numerically check things to rapidly visualize.

A quick simulation shows this can't be true in general. Let $$X_i \stackrel{iid}{\sim} \text{Uniform}(0,1)$$.

With 10000 samples, it is clear that $$Z_i$$ are not i.i.d.

Some MATLAB code below:

% MATLAB R2018a
n = 10000;   % sample size
% Generate samples from Xi ~ U(0,1)
X1 = rand(5000,1);
X2 = rand(5000,1);
X3 = rand(5000,1);

% Get Zi
Z1 = X1;
Z2 = X1 + X2;
Z3 = X1 + X2 + X3;


If two random variables $$Y_1$$ & $$Y_2$$ are independent, their correlation will be zero. We know the reverse is not always true (e.g. zero correlation does not imply independence).

% Check correlation for Xi's (should be approx zero)
% Cx(i,j) = corr(Xi,Xj)
Cx = ones(3);
Cx(1,2) = corr(X1,X2); Cx(2,1) = Cx(1,2);
Cx(1,3) = corr(X1,X3); Cx(3,1) = Cx(1,3);
Cx(2,3) = corr(X2,X3); Cx(3,2) = Cx(2,3);

% Check correlation for Zi's (are they even close to zero?)
Cz = ones(3);
Cz(1,2) = corr(Z1,Z2); Cz(2,1) = Cz(1,2);
Cz(1,3) = corr(Z1,Z3); Cz(3,1) = Cz(1,3);
Cz(2,3) = corr(Z2,Z3); Cz(3,2) = Cz(2,3);

% Visually inspect distributions
figure
s(1)= subplot(1,3,1)
histogram(Z1,'Normalization','pdf','FaceColor','r')
s(2) = subplot(1,3,2)
histogram(Z2,'Normalization','pdf','FaceColor','b')
s(3) = subplot(1,3,3)
histogram(Z3,'Normalization','pdf','FaceColor','g')

% Cosmetics
ylabel(s(1),'PDF')
for k = 1:3
xlabel(s(k),['Z' num2str(k)])
s(k).XLim = [0 4];
s(k).YLim = [0 1.2];
end