# Calculating variance of Discrete Uniform distribution when its interval changes

I am not excited about grading exams. I would rather jam a dull stick into my leg. I will therefore randomly assign your grade by picking an integer uniformly from 77 to 100 (inclusively).

(a) What is the probability that you score 80-89 inclusively?

(b) What is your expected score on the exam?

(c) What is the variance of scores on this exam?

$n=100-77+1=24$

(a) There are 24 different grade possibilities and 10 scores between 80-89. So the solution is 10/24.

(b) (c) I had a question. There's a formula for discrete uniform:

$E[X]= \cfrac{(n+1)}{2}\tag{1}$

$Var[X]=\cfrac{n^2-1}{12}\tag{2}$

I thought both of these equations would only be valid if the grade assignments ranged from 1 to 100, inclusively.

Indeed Equation (1) cannot be used for part (b), but Equation (2) can be used for part (c). Why can equation (2) be used to calculate the variance when the grade range is only from 77-100. I rederived these formula's and in the derivation, I assumed $X \ge 1$.

-
We answer the only specific question you asked. An important property of the variance is shift-invariance. Let $X$ be a random variable, and let $Y=X+k$ where $k$ is a constant. Then $\operatorname{Var}(Y)=\operatorname{Var}(X)$. How much a random variable bounces around is not affected if you add say $300$ to each value.
So you can shift the grade range $77$ to $100$ downwards by $76$ without changing the variance.
Of course the mean does change, it goes down by $76$.