Given that the:

$Mean = 30$

Range $= X_n - X_1 = 10$

$S^2 = Variance = 40$

is it possible to construct a dataset with those values?

So, to be honest I have no idea how to properly approach this and I have tried "brute forcing" this to find a set of numbers to make this work, but no matter what I do I can't seem to do it. Thus I believe that the answer is "no", however, I'm not sure about this.

Is there a standard procedure I can follow to solve this logically?

  • $\begingroup$ What does range mean? $\endgroup$
    – 5xum
    May 29, 2015 at 5:12
  • $\begingroup$ In this context, range is X_n - X_1, where X is a data set ordered from smallest to largest, left to right. $\endgroup$
    – Belphegor
    May 29, 2015 at 5:13

2 Answers 2


No, it is impossible.

Given any list of $n$ numbers $X_k$ without any constraint of its order. Let $$\begin{cases} \overline{X} &= \frac{1}{n}\sum_{k=1}^n X_k\\ \overline{X^2} &= \frac{1}{n}\sum_{k=1}^n X_k^2 \end{cases} \quad\text{ and }\quad \begin{cases} P &= \max\{ X_k : 1 \le k \le n \}\\ Q &= \min\{ X_k : 1 \le k \le n \} \end{cases} $$ The (biased) sample variances and unbiased sample variance for the numbers $X_k$ are given by the formulas $$\begin{cases} \sigma_X^2 &= \frac{1}{n}\sum\limits_{k=1}^n (X_k - \overline{X})^2 = \overline{X^2} - \overline{X}^2\\ s_X^2 &= \frac{1}{n-1}\sum\limits_{k=1}^n (X_k - \overline{X})^2 = \frac{n}{n-1}\sigma_X^2 \end{cases}$$

Since $(P - X_k)(X_k - Q) \ge 0$ for all $1 \le k \le n$, we have $$\frac{1}{n}\sum_{k=1}^n (P - X_k)(X_k - Q) \ge 0 \iff -PQ + (P+Q)\overline{X} - \overline{X^2} \ge 0\\ \implies \sigma_X^2 = (\overline{X^2} - \overline{X}^2) \le (P - \overline{X})(\overline{X} - Q)$$ This inequality is a special case of the Bhatia-Davis inequality. Since $P \ge \overline{X} \ge Q$, this leads to the Popoviciu's inequality on variances: $$\sigma_X^2 \le \frac14 (P-Q)^2 \quad\iff\quad s_X^2 = \frac{n}{n-1}\sigma_X^2 \le \frac{n}{4(n-1)}(P-Q)^2$$ Apply this to our problem where $P - Q = 10$, it is clear there is no way for the (biased) sample variances $\sigma_X^2$ to be equal to $40$. For the unbiased sample variances, if we want $s_X^2 = 40$, we need

$$40 \le \frac{n}{4(n-1)}10^2 = 25\frac{n}{n-1}\quad\implies\quad n \le \frac{8}{3}$$ Since $n$ is an integer $\ge 2$, $n$ can only be $2$. However when $n = 2$,

$$\begin{cases} \overline{X} &= \frac{P+Q}{2}\\ \overline{X^2} &= \frac{P^2+Q^2}{2} \end{cases} \quad\implies\quad \begin{align} s_X^2 &= \frac{2}{2-1}\left(\overline{X^2} - \overline{X}^2\right) = P^2 + Q^2 - \frac{(P+Q)^2}{2}\\ &= \frac12(P-Q)^2 = 50 \end{align} $$ This doesn't match the given number $40$ again. As a result, there is no data-set which can produces the desired mean, range and sample variances (for both biased and unbiased one).


First construct data centered at zero. Start with d=x-xbar and $S^2=sum(d*d)/(n-1)$. Use your max d is range/2=5 and construct pairs 5, -5 to satisfy range. $S^2$ now is (25+25)/1=50.

But need for $n=4$ for example $(25+25+x^2+(-x)^2)/3=20$ so chose $x=\sqrt{5}$. Then just add $30$ to each number to satisfy mean=$30$.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .