# Exact distribution of sample mean of a continuous distribution

Please first note that I do know about the central limit theorem but I wish to derive an exact expression for the sample mean for any continuous distribution with probability density function $f(x)$. I thought I derived it correctly here but there is some mistake I can't spot. Can anyone tell me where I have made a mistake?

I take a simple case to derive the sample mean for with only 2 samples. The probability density function $f(x)$ is defined as: $$f(x)=\frac{x}{50}$$ The maximum value of $x$ is $10$ and the minimum value of $x$ is $0$. Note that: $$\int_0^{10} f(x) dx =1$$

The samples are random variables $X_1$ and $X_2$

$$\bar{x}=\frac{x_1+x_2}{2}$$

If the sample mean is to equal $\bar{x}$ then given that the first sample is $x_1$ the second sample $x_2$ must equal $2\bar{x}-x_1$. But if $x_1$ is too large or too small then a value of $x_2$ may not exist in the range [0,10].

We know

$$x_2 \leq 10 \quad \therefore 2\bar{x}-x_1 \leq 10$$ $$\implies x_1 \geq 2\bar{x}-10$$ And

$$x_2 \geq 0 \quad \therefore x_1 \leq 2\bar{x}$$ $$\implies 2\bar{x}-10 \leq x_1 \leq 2\bar{x}$$

The probability that $X_1$ takes the value $x_1$ and $X_2$ takes the value $2\bar{x}-x_1$ is $f(x_1)f(2\bar{x}-x_1)$

To account for all cases of $X_1$ that could result in $\bar{X}=\bar{x}$ we integrate with respect to $x_1$

$$\int_{2\bar{x}-10}^{2\bar{x}}f(x_1)f(2\bar{x}-x_1)dx_1$$

I did this integration and it ended up as

$$\frac{1}{7500}(1000-570\bar{x}-120\bar{x}^2)$$

The sample mean must lie inside $[0,10]$ so the integral of all the eventualities of the sample mean over the range $[0,10]$ should equal 1. But:

$$\int_0^{10} \frac{1}{7500}(1000-570\bar{x}-120\bar{x}^2)=-7.8$$

So where have I made an incorrect assumption?

• Remember the Jacobian when you change variables. Commented Sep 2, 2013 at 16:19
• Your $f$ is not a distribution function: its integral diverges and it even attains negative values. An essential part of its definition is that $f(x)=0$ for $x\lt 0$ and $f(x)=0$ for $x\gt 10$. (You are cognizant of that in the text but your calculations do not fully reflect it.) When you take care of that, you don't have to worry about restricting the integration endpoints. This will all become clearer when you draw a picture of the PDF of the joint distribution of $(X_1,X_2)$ and consider the range of $x_1$ for which it is nonzero.
– whuber
Commented Sep 2, 2013 at 17:58
• Could you tell what sort of chapter I should look at in order to learn how to make f(x)=0 for x outside of [0,10]. I thought that doing so would make the function non continuous and therefore non integratable. Commented Sep 2, 2013 at 19:15
• Why do you think a density function that has a single point of discontinuity would make it non-integrable? Commented Sep 2, 2013 at 23:50
• @Glen_b I thought that since continuity was necessary for differentiation at a point that it was also necessary for integration over a point. Are you sure it is valid to integrate from 1 to infinity if f(x) is discontinuous at 10? Commented Sep 3, 2013 at 1:35

This is rather trickier than it appears. The reason is that since the variables involved are non-negative, some subtle restrictions on the domain of integration of the convolution arise, resulting also in a piece-wise density function for $\bar X$. I assume that $X_1$, $X_2$ are independent. We start by defining the variables $$Y_i = \frac12 X_i,\; i=1,2$$ Then by the change-of variables formula we easily obtain

$$f_{Y_i}(y_i) = f_{X_i}(2y_i)\cdot 2 = \frac{2}{5^2}y_i,\; i=1,2\;, y_i \in [0,5]$$

Define now the r.v. $\bar X = Y_1 + Y_2$. In general, the convolution here is $$f_{\bar X}(\bar x) = \int_{-\infty}^{\infty} f_{Y_1}(\bar x - y_2)f_{Y_2}(y_2)dy_2$$

...where for some range of values the integral will be zero. But the question is, what will be the effective limits of integration? Will they be "just" $[0,5]$ which is the range of $y_2$, or something else?

If we look at the distribution function of $\bar X$ we have $$F_{\bar X}(\bar x) = P(\bar X \le \bar x) = P(Y_1 + Y_2 \le \bar x)$$

This gives us the inequality $y_1 + y_2 \le \bar x \Rightarrow y_1\le \bar x - y_2$. BUT $y_1$ ranges in $[0,5]$ so we must respect $$0 \le y_1 \le \bar x - y_2 \le 5 \Rightarrow 0 \le \bar x - y_2 \le 5$$

which is analyzed in two inequalities, $$y_2 \le \bar x\;,\qquad \text{and} \;\bar x -5 \le y_2$$

Now $y_2$ ranges in $[0,5]$, while $\bar x$ ranges in $[0,10]$. So we have to break the range of $\bar x$ accordingly.

A) $0\le \bar x \le 5$.

When $\bar x$ ranges in this interval, the inequality $y_2 \le \bar x$ is binding, while the inequality $\bar x -5 \le y_2$ is always satisfied (= for all values of $y_2$). So for this range of $\bar x$ the range of integration of the convolution will be $[0, \bar x]$.

B) $5\le \bar x \le 10$.
For this range the inequality $y_2 \le \bar x$ is always satisfied, while the inequality $\bar x -5 \le y_2$ is binding. So for this range of $\bar x$ the range of integration of the convolution will be $[\bar x -5, 5]$.

Therefore we have,

$$\text{For}\; 0\le \bar x \le 5\;\;, f_{\bar X}(\bar x) = \int_{0}^{\bar x} f_{Y_1}(\bar x - y_2)f_{Y_2}(y_2)dy_2 = \frac{4}{5^4}\int_{0}^{\bar x} (\bar x-y_2)y_2dy_2$$

while

$$\text{For}\; 5\le \bar x \le 10\;\;, f_{\bar X}(\bar x) = \int_{\bar x -5}^{5} f_{Y_1}(\bar x - y_2)f_{Y_2}(y_2)dy_2 = \frac{4}{5^4}\int_{\bar x -5}^{5} (\bar x-y_2)y_2dy_2$$

Carrying out the simple but tedious algebra we arrive at

$$0\le \bar x \le 5\qquad f_{\bar X}(\bar x) = \frac {2}{3\cdot 5^4}\bar x^3$$ $$5\le \bar x \le 10\qquad f_{\bar X}(\bar x) = -\frac {8}{15} + \frac {4}{5^2}\bar x - \frac {2}{3\cdot 5^4}\bar x^3$$

Not very nice-looking, eh? Still, it will be illuminating to draw the graph of the above density - it is very nice-looking. It is everywhere non-negative and has a nice curvature. Moreover, one can check that it integrates to unity, namely

$$\int_{0}^{10}f_{\bar X}(\bar x)d\bar x = \int_{0}^{5}\frac {2}{3\cdot 5^4}\bar x^3d\bar x +\int_{5}^{10}\Big[-\frac {8}{15} + \frac {4}{5^2}\bar x - \frac {2}{3\cdot 5^4}\bar x^3\Big]d\bar x$$

$$= \frac 16 + \frac 56 = 1$$.

• this is brilliant! Thank you so much, I only wish I had the rank on this website to give you some upvotes Commented Sep 5, 2013 at 15:15
• Glad it was useful to you. If you so eager to reward me, can't you mark my answer as "accepted"? (although, really, I do not participate in this forum in order to collect reputation points). Commented Sep 5, 2013 at 15:19