Mean Discrete Uniform Distribution

The aim is to replicate the demonstration than can be found here : 
https://en.wikibooks.org/wiki/Statistics/Distributions/Discrete_Uniform

The discrete uniform distribution (not to be confused with the continuous uniform distribution) is where the probability of equally spaced possible values is equal. Mathematically this means that the probability density function is identical for a finite set of evenly spaced points. An example of would be rolling a fair 6-sided die. In this case there are six, equally like probabilities.

One common normalization is to restrict the possible values to be integers and the spacing between possibilities to be 1. In this setup, the only two parameters of the function are the minimum value (a), the maximum value (b). (Some even normalize it more, setting a=1.) Let n=b-a+1 be the number of possibilities. The probability density function is then (∑_(i=0)^n)f((Subscript[x, i]))×((Subscript[x, i])):

Let . The mean (notated as ) can then be derived as follows:

EXU=(∑_(i=0)^(n-1))((1/n)(a+i))

Simplify[(1/n)((∑_(i=0)^(n-1))a+(∑_(i=0)^(n-1))i)]

Use the Closed Form for Triangular Numbers

(∑_(i=0)^(n-1))i

Simplify[(1/n)(n×a+(((((n-1))^2)+(n-1))/2))]

Simplify[((2n×a +(n^2)-2n+1+n-1)/(2n))]

Simplify[((2 a +n-1)/(2 ))]

(* n=b-a+1 *)

n=b-a+1

Simplify[((2 a +n-1)/(2 ))]

Mean[DiscreteUniformDistribution[{a,b}]]

((a+b)/2)==((a+b)/3)

Expand[%]

With variable, the Expand function indicates that the expression are not equivalent by letting the expression intact instead of ‘True’.

Remove[n]

Simplify[((2 a +n-1)/(2 ))]