I'm not so good with manipulating summations, and recently going over some questions, I had some problems in understanding how some summation related answers were derived. Here are the two problems. It would be great if anyone could explain to me how these work in detail:
First Problem: fair value of a hat-drawing game
Here in this problem, in Yuval Filmus' solution, he turns the term $\frac{\sum_{t=X}^{100} t}{100}$ into $\frac{(100-X+1)(100+X)}{200}$
I am quite confused as to how he ended up getting this. I had gotten
$\frac{\sum_{t=X}^{100} t}{100} = \frac{\sum_{t=0}^{100-X} (t + X)}{100} = \frac{(\sum_{t=0}^{100-X}t) + (\sum_{t=0}^{100-X}X)}{100} = \frac{(100 - X + 1)(100-X)(\frac{1}{2}) + (100-X)(X)}{100} = \frac{(100-X)(100-X+1+2X)}{200}=\frac{(100-X)(100+X+1)}{200}$
Can anyone tell me where I went wrong?
Second Problem: Expected Value of the Difference between 2 Dice
In this problem I just straight up don't understand how the math works. Can anyone explain (or point me to some resources that I could read) how something like this comes about:
$\sum_{i=1}^n \sum_{j=1}^n \dfrac{|i-j|}{n^2} = 2 \sum_{i=1}^n \sum_{j=1}^i \frac{i-j}{n^2} = \frac{n^2-1}{3n}$
I neither understand how the summation formula works for absolute value nor how he got rid of the summations at the end.
Thanks!