Derivation of Variance of Discrete Uniform Distribution over custom interval I'm trying to prove that the variance of a discrete uniform distribution is equal to $\cfrac{(b-a+1)^2-1}{12}$. I've looked at other proofs, and it makes sense to me that in the case where the distribution starts at 1 and goes to n, the variance is equal to $\cfrac{(n)^2-1}{12}$. I want to find the variance of $unif(a,b)$, that is a uniform distribution that goes from $a$ to $b$, where $a<b$ and $a$ does not necessarily equal 1.
I also realize that you can add / subtract to the distribution, and the variance will not change; hence, you can simply plug in the value $n=b-a+1$. However, I was wondering if there was any way to directly derive the first form of the variance using the property that $V(X) = E(X^2)-\mu^2$. This is the work I've done thus far, but I'm at an impasse. Additionally, is there a easier way to extend the result for the variance of $unif(1,n)$ to $unif(a,b)$? I suppose an easier way would be to show that the $\mathbb{V}(X) = \mathbb{V}(X+a)$, where $a$ is a constant, and then plug in the new range $(b-a+1)$
$
    \begin{split}
      \mathbb{V}(X) &= \mathbb{E}(X-\mu)^2
      \\
      &= \mathbb{E}(X^2) - \mu^2
      \\
      &= \frac{1}{b-a+1}\sum_{x=a}^{b}x^2 - \frac{(a+b)^2}{4}
      \\
      &= \frac{1}{b-a+1} \left(\frac{(b)(b+1)(2b+1) - (a-1)((a-1)+1)(2(a-1)+1)}{6}\right) -
      \frac{(a+b)^2}{4}
      \\
      &= \frac{1}{b-a+1} \left(\frac{(b)(b+1)(2b+1)-(a-1)(a)(2a-1)}{6}\right)-
      \frac{(a+b)^2}{4}
      \\
      &= \frac{1}{b-a+1} \left(\frac{(2b^3+3b^2+b)-(2a^3-3a^2+a)}{6}\right) -
      \frac{(a+b)^2}{4}
      \\
      &= \frac{1}{b-a+1} \frac{(4b^3+6b^2+2b)-(4a^3-6a^2+2a)-(3a^2+6ab+3b^2)}{12}
      \\
      &= \frac{1}{b-a+1} \frac{4b^3+3b^2+2b-4a^3+3a^2-2a-6ab}{12}
      \\
      &= \dots
      \\
      &= \frac{(b-a+1)^2-1}{12}
    \end{split}
$

So much time has passed, but at least now we know it can be done: https://en.wikibooks.org/wiki/Statistics/Distributions/Discrete_Uniform
