Suppose [tex]$X$[/tex] is a uniform discrete random variable with possible values [tex]$X=1, 2, \ldots, n$[/tex]. Show that the variance of [tex][tex]$X$[/tex][/tex] is [tex]$\frac{n^2-1}{12}$[/tex].

Hint:
[tex]\[ 1^2 + 2^2 + 3^2 + \ldots + n^2 = \frac{n(n+1)(2n+1)}{6} \][/tex]



Answer :

To find the variance of the uniform discrete random variable [tex]\(X\)[/tex] with possible values [tex]\(1, 2, \ldots, n\)[/tex], let's follow these steps:

1. Calculate the Mean [tex]\( \mu \)[/tex] of [tex]\(X\)[/tex]:
The mean (or expected value) of a uniform discrete random variable [tex]\(X\)[/tex], taking values from [tex]\(1\)[/tex] to [tex]\(n\)[/tex], is given by:
[tex]\[ \mu = E(X) = \frac{1 + 2 + \cdots + n}{n} \][/tex]

Using the formula for the sum of the first [tex]\(n\)[/tex] natural numbers:
[tex]\[ \sum_{k=1}^{n} k = \frac{n(n+1)}{2} \][/tex]
Therefore,
[tex]\[ E(X) = \frac{1 + 2 + \cdots + n}{n} = \frac{\frac{n(n+1)}{2}}{n} = \frac{n+1}{2} \][/tex]

Hence, the mean [tex]\( \mu \)[/tex] is:
[tex]\[ \mu = \frac{n+1}{2} \][/tex]

2. Calculate [tex]\( E(X^2) \)[/tex]:
We need the expected value of [tex]\(X^2\)[/tex]:
[tex]\[ E(X^2) = \frac{1^2 + 2^2 + \cdots + n^2}{n} \][/tex]

Using the given hint for the sum of squares:
[tex]\[ \sum_{k=1}^{n} k^2 = \frac{n(n+1)(2n+1)}{6} \][/tex]
So,
[tex]\[ E(X^2) = \frac{1^2 + 2^2 + \cdots + n^2}{n} = \frac{\frac{n(n+1)(2n+1)}{6}}{n} = \frac{(n+1)(2n+1)}{6} \][/tex]

3. Calculate the Variance [tex]\( \text{Var}(X) \)[/tex]:
The variance of [tex]\(X\)[/tex] is given by:
[tex]\[ \text{Var}(X) = E(X^2) - [E(X)]^2 \][/tex]

Substitute [tex]\( E(X) \)[/tex] and [tex]\( E(X^2) \)[/tex] into the variance formula:
[tex]\[ \text{Var}(X) = \frac{(n+1)(2n+1)}{6} - \left( \frac{n+1}{2} \right)^2 \][/tex]

4. Simplify the Expression:
First, calculate [tex]\( \left( \frac{n+1}{2} \right)^2 \)[/tex]:
[tex]\[ \left( \frac{n+1}{2} \right)^2 = \frac{(n+1)^2}{4} \][/tex]

Now, let's put everything together:
[tex]\[ \text{Var}(X) = \frac{(n+1)(2n+1)}{6} - \frac{(n+1)^2}{4} \][/tex]

To combine the terms, we need a common denominator, which is 12:
[tex]\[ \text{Var}(X) = \frac{2(n+1)(2n+1)}{12} - \frac{3(n+1)^2}{12} \][/tex]

Simplify the numerator:
[tex]\[ \text{Var}(X) = \frac{2(n+1)(2n+1) - 3(n+1)^2}{12} \][/tex]

Factor out [tex]\( (n+1) \)[/tex]:
[tex]\[ \text{Var}(X) = \frac{(n+1) [2(2n+1) - 3(n+1)]}{12} \][/tex]

Simplify inside the brackets:
[tex]\[ 2(2n+1) - 3(n+1) = 4n + 2 - 3n - 3 = n - 1 \][/tex]

Thus,
[tex]\[ \text{Var}(X) = \frac{(n+1)(n-1)}{12} = \frac{n^2 - 1}{12} \][/tex]

Hence, the variance of [tex]\(X\)[/tex] is:
[tex]\[ \boxed{\frac{n^2 - 1}{12}} \][/tex]