- Last updated

- Save as PDF

- Page ID
- 3150

- Charles M. Grinstead & J. Laurie Snell
- Swarthmore College and Dartmouth College via American Mathematical Society

\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}}}\) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

In this section we consider the continuous version of the problem posed in the previous section: How are sums of independent random variables distributed?

##### Definition \(\PageIndex{1}\): convolution

Let \(X\) and \(Y\) be two continuous random variables with density functions \(f(x)\) and \(g(y)\), respectively. Assume that both \(f(x)\) and \(g(y)\) are defined for all real numbers. Then the convolution \(f ∗ g\) of \(f\) and \(g\) is the function given by

\[ \begin{align*}(f*g) &= \int_{-\infty}^\infty f(z-y)g(y)dy \\[4pt]&= \int_{-\infty}^\infty g(z-x)f(x)dx \end{align*} \]

This definition is analogous to the definition, given in Section 7.1, of the convolution of two distribution functions. Thus it should not be surprising that if X and Y are independent, then the density of their sum is the convolution of their densities. This fact is stated as a theorem below, and its proof is left as an exercise (see Exercise 1).

##### Theorem \(\PageIndex{1}\)

Let X and Y be two independent random variables with density functions fX (x) and fY (y) defined for all x. Then the sum Z = X + Y is a random variable with density function \(f_Z(z)\), where \(f_X\) is the convolution of \(f_X\) and \(f_Y\)

To get a better understanding of this important result, we will look at some examples.

##### Example \(\PageIndex{1}\): Sum of Two Independent Uniform Random Variables

Suppose we choose independently two numbers at random from the interval [0, 1] with uniform probability density. What is the density of their sum? Let X and Y be random variables describing our choices and \(Z = X + Y\) their sum. Then we have

\[f_X(x) = f_Y(y) = \begin{array}{cc} 1 & \text{if } 0 \leq x \leq 1 \\ 0 & \text{otherwise} \end{array} \nonumber \]

and the density function for the sum is given by

\[f_Z(z) = \int_{-\infty}^\infty f_X(z-y)f_Y(y)dy. \nonumber \]

Since \(f_Y (y) = 1 if 0 ≤ y ≤ 1\) and 0 otherwise, this becomes

\[f_Z(z) = \int_{0}^1 f_X(z-y)dy. \nonumber \]

Now the integrand is 0 unless 0 ≤ z − y ≤ 1 (i.e., unless z − 1 ≤ y ≤ z) and then it is 1. So if 0 ≤ z ≤ 1, we have

\[f_Z (z) = \int_0^z dy = z , \nonumber \]

while if 1 < z ≤ 2, we have

\[f_Z(z) = \int_{z-1}^1 dy = 2-z, \nonumber \]

and if \(z < 0\) or\(z > 2\) we have \(_fZ(z) = 0\) (see Figure 7.2). Hence,

\[f_Z(z) = \Bigg\{ \begin{array}{cc} z & \text{if } 0 \leq z \leq 1 \\ 2-z, & \text{if} 1 < z \leq 2 \\ 0, & \text{otherwise} \end{array} \nonumber \]

Note that this result agrees with that of Example 2.4.

##### Example \(\PageIndex{2}\): Sum of Two Independent Exponential Random Variables

Suppose we choose two numbers at random from the interval [0, ∞) with an *exponential *density with parameter λ. What is the density of their sum? Let X, Y , and Z = X + Y denote the relevant random variables, and \(f_X , f_Y , \)and \(f_Z\) their densities. Then

\[ f_X(x) = f_Y(x) = \bigg\{ \begin{array}{cc} \lambda e^{-\lambda x}, & \text{if } x \geq 0 \\ 0, & \text{otherwise} \end{array} \nonumber \]

and so, if z > 0,

\[ \begin{align*}f_Z(z) & = \int_{-\infty}^\infty f_X(z-y)f_Y(y)dy \\[4pt]&=\int_0^z \lambda e^{-\lambda (z-y)} \lambda e^{-\lambda y} dy \\[4pt] &=\int_0^z \lambda^2 e^{-\lambda z} dy \\[4pt] &=\lambda^2 z e^{-\lambda z} \end{align*}\]

while if z < 0, \(f_Z(z) = 0\) (see Figure 7.3). Hence,

\[ f_Z(z) = \bigg\{ \begin{array}{cc} \lambda^2 z^{-\lambda z}, & \text{if } z \geq 0, \\ 0, & \text{otherwise} \end{array} \nonumber \]

## Sum of Two Independent Normal Random Variables

##### Example \(\PageIndex{3}\)

It is an interesting and important fact that the convolution of two normal densities with means \(µ_1 and µ_2\) and variances \(σ_1 and σ_2\) is again a normal density, with mean \(µ_1 + µ_2\) and variance \( \sigma_1^2 + \sigma_2^2\). We will show this in the special case that both random variables are standard normal. The general case can be done in the same way, but the calculation is messier. Another way to show the general result is given in Example 10.17.

Suppose X and Y are two independent random variables, each with the standard normal density (see Example 5.8). We have

\[ f_X(x) = f_Y(y) = \frac{1}{\sqrt{2\pi}}e^{-x^2/2} \nonumber \]

and so

\[\begin{align*} f_Z(z) & = f_X * f_Y(z) \\[4pt] &= \frac{1}{2\pi} \int_{-\infty}^\infty e^{-(z-y)^2/2} e^{-y^2/2}dy \\[4pt] &= \frac{1}{2\pi} e^{-z^2/4} \int_{-\infty}^\infty e^{-(y-z/2)^2}dy \\[4pt] &= \frac{1}{2\pi} e^{-z^2/4}\sqrt{\pi} \left[ \frac{1}{\sqrt{\pi}} \int_{-\infty}^{\infty} e^{-(y-z/2)^2dy} \right] \end{align*}\]

The expression in the brackets equals 1, since it is the integral of the normal density function with \( \mu =0\) and \(\sigma = \sqrt{2}\) So, we have

\[f_Z(z) = \frac{1}{\sqrt{4\pi}}e^{-z^2/4} \nonumber \]

##### Example \(\PageIndex{4}\): Sum of Two Independent Cauchy Random Variables

Choose two numbers at random from the interval \((-\infty, \infty\) with the Cauchy density with parameter \(a = 1\) (see Example 5.10). Then

\[ f_X(x) = f_Y(y) = \frac{1}{\pi(1+x^2)} \nonumber \]

and \(Z = X +Y\) has density

\[f_Z(z) = \frac{1}{\pi^2} \int_{-\infty}^\infty \frac{1}{1+(z-y)^2} \frac{1}{1+y^2}dy. \nonumber \]

This integral requires some effort, and we give here only the result (see Section 10.3, or Dwass\(^3\) ):

\[fZ(z) =\frac{2}{\pi (4+z^2)} \nonumber \]

Now, suppose that we ask for the density function of the average

\[A = (1/2)(X + Y ) \nonumber \]

of X and Y . Then A = (1/2)Z. Exercise 5.2.19 shows that if U and V are two continuous random variables with density functions \(f_U(x)\) and \(f_V(x)\), respectively, and if \(V = aU\), then

\[f_V (x) = \bigg( \frac{1}{a}\bigg) f_U \bigg( \frac{x}{a} \bigg). \nonumber \]

Thus, we have

\[f_A(z) = 2f_Z(2z) = \frac{1}{\pi(1+z^2)} \nonumber \]

Hence, the density function for the average of two random variables, each having a Cauchy density, is again a random variable with a Cauchy density; this remarkable property is a peculiarity of the Cauchy density. One consequence of this is if the error in a certain measurement process had a Cauchy density and you averaged a number of measurements, the average could not be expected to be any more accurate than any one of your individual measurements!

##### Example \(\PageIndex{5}\): Rayleigh Density

Suppose X and Y are two independent standard normal random variables. Now suppose we locate a point \(P\) in the *xy*-plane with coordinates (X, Y ) and ask: What is the density of the square of the distance of P from the origin? (We have already simulated this problem in Example 5.9.) Here, with the preceding notation, we have

\[\begin{align*} f_X(x) &= f_V(x) \\[4pt] &= \frac{1}{\sqrt{2\pi}} e^{-x^2/2} \end{align*} \]

Moreover, if \(X^2\) denotes the square of \(X\), then (see Theorem 5.1 and the discussion following)

\[\begin{align*} f_{X^2}(r) &= \begin{array}{} \dfrac{1}{\sqrt{2\pi r}}(e^{-r/2}) & \text{if } r>0\\ 0 & \text{otherwise}.\end{array} \\[4pt] &= \begin{array}{cc} \dfrac{1}{2\sqrt{r}}(f_X\sqrt{r}) + f_X(-\sqrt{r})) & \text{if } r>0\\ 0 & \text{otherwise}.\end{array} \end{align*}\]

This is a **gamma density** with \(\lambda = 1/2\), \(\beta = 1/2\) (see Example 7.4). Now let \(R^2 = X^2 + Y^2\)

Then

Hence, \(R^2\) has a gamma density with λ = 1/2, β = 1. We can interpret this result as giving the density for the square of the distance of P from the center of a target if its coordinates are normally distributed. The density of the random variable *R* is obtained from that of \(R^2\) in the usual way (see Theorem 5.1), and we find

\[ f_R(r) = \Bigg\{ \begin{array}{cc} \frac{1}{2}e^{-r^2/2} \cdot 2r = re^{-r^2/2}, & \text{if } r \geq 0 \\ 0, & \text{otherwise} \end{array} \nonumber \]

Physicists will recognize this as a **Rayleigh density**. Our result here agrees with our simulation in Example 5.9.

## Chi-Squared Density

More generally, the same method shows that the sum of the squares of n independent normally distributed random variables with mean 0 and standard deviation 1 has a gamma density with λ = 1/2 and β = n/2. Such a density is called a chi-squared density with n degrees of freedom. This density was introduced in Chapter 4.3. In Example 5.10, we used this density to test the hypothesis that two traits were independent.

Another important use of the chi-squared density is in comparing experimental data with a theoretical discrete distribution, to see whether the data supports the theoretical model. More specifically, suppose that we have an experiment with a finite set of outcomes. If the set of outcomes is countable, we group them into finitely many sets of outcomes. We propose a theoretical distribution that we think will model the experiment well. We obtain some data by repeating the experiment a number of times. Now we wish to check how well the theoretical distribution fits the data.

Let \(X\) be the random variable that represents a theoretical outcome in the model of the experiment, and let \(m(x)\) be the distribution function of *X*. In a manner similar to what was done in Example 5.10, we calculate the value of the expression

\[ V = \sum_x \frac{(\sigma_x - n\cdot m(x))^2}{n\cdot m(x)} \nonumber \]

where the sum runs over all possible outcomes x, n is the number of data points, and ox denotes the number of outcomes of type x observed in the data. Then

for moderate or large values of *n,* the quantity *V* is approximately chi-squared distributed, with *ν*−1 degrees of freedom, where ν represents the number of possible outcomes. The proof of this is beyond the scope of this book, but we will illustrate the reasonableness of this statement in the next example. If the value of *V* is very large, when compared with the appropriate chi-squared density function, then we would tend to reject the hypothesis that the model is an appropriate one for the experiment at hand. We now give an example of this procedure.

##### Example \(\PageIndex{6}\): DieTest

Suppose we are given a single die. We wish to test the hypothesis that the die is fair. Thus, our theoretical distribution is the uniform distribution on the integers between 1 and 6. So, if we roll the die n times, the expected number of data points of each type is *n*/6. Thus, if \(o_i\) denotes the actual number of data points of type \(i\), for \(1 ≤ i ≤ 6\), then the expression

\[ V = \sum_{i=1}^6 \frac{(\sigma_i - n/6)^2}{n/6} \nonumber \]

is approximately chi-squared distributed with 5 degrees of freedom.

Now suppose that we actually roll the die 60 times and obtain the data in Table 7.1. If we calculate V for this data, we obtain the value 13.6. The graph of the chi-squared density with 5 degrees of freedom is shown in Figure 7.4. One sees that values as large as 13.6 are rarely taken on by V if the die is fair, so we would reject the hypothesis that the die is fair. (When using this test, a statistician will reject the hypothesis if the data gives a value of V which is larger than 95% of the values one would expect to obtain if the hypothesis is true.)

In Figure 7.5, we show the results of rolling a die 60 times, then calculating V , and then repeating this experiment 1000 times. The program that performs these calculations is called **DieTest**. We have superimposed the chi-squared density with 5 degrees of freedom; one can see that the data values fit the curve fairly well, which supports the statement that the chi-squared density is the correct one to use.

So far we have looked at several important special cases for which the convolution integral can be evaluated explicitly. In general, the convolution of two continuous densities cannot be evaluated explicitly, and we must resort to numerical methods. Fortunately, these prove to be remarkably effective, at least for bounded densities.

## Independent Trials

We now consider briefly the distribution of the sum of n independent random variables, all having the same density function. If \(X_1, X_2, . . . , X_n\) are these random variables and \(S_n = X_1 + X_2 + · · · + X_n\) is their sum, then we will have

\[f_{S_n}(x) = (f_X, \timesf_{x_2} \times\cdots\timesf_{X_n}(x), \nonumber \]

where the right-hand side is an n-fold convolution. It is possible to calculate this density for general values of n in certain simple cases.

##### Example \(\PageIndex{7}\)

Suppose the \(X_i\) are uniformly distributed on the interval [0,1]. Then

\[f_{X_i}(x) = \Bigg{\{} \begin{array}{cc} 1, & \text{if } 0\leq x \leq 1\\ 0, & \text{otherwise} \end{array} \nonumber \]

and \(f_{S_n}(x)\) is given by the formula \(^4\)

\[f_{S_n}(x) = \Bigg\{ \begin{array}{cc} \frac{1}{(n-1)!}\sum_{0\leq j \leq x}(-1)^j(\binom{n}{j}(x-j)^{n-1}, & \text{if } 0\leq x \leq n\\ 0, & \text{otherwise} \end{array} \nonumber \]

The density \(f_{S_n}(x)\) for \(n = 2, 4, 6, 8, 10\) is shown in Figure 7.6. If the Xi are distributed normally, with mean 0 and variance 1, then (cf. Example 7.5)

\[f_{X_i}(x) = \frac{1}{\sqrt{2pi}} e^{-x^2/2}, \nonumber \]

and

\[f_{S_n}(x) = \frac{1}{\sqrt{2\pi n}}e^{-x^2/2n} \nonumber \]

Here the density \(f_Sn\) for \(n=5,10,15,20,25\) is shown in Figure 7.7.

If the \(X_i\) are all exponentially distributed, with mean \(1/\lambda\), then

\[f_{X_i}(x) = \lambda e^{-\lambda x}. \nonumber \]

and

\[f_{S_n} = \frac{\lambda e^{-\lambda x}(\lambda x)^{n-1}}{(n-1)!} \nonumber \]

In this case the density \(f_{S_n}\) for \(n = 2, 4, 6, 8, 10\) is shown in Figure 7.8.