This is a gauss trick for summing numbers from 1 to n:

First formula
However, the amount you want to calculate starts with 2 , not 1 , so you must subtract the first term (i.e. 1) from the formula:

Second formula
Essentially, you calculate the sum from 1 to (n-1). If you replace n gauss trick by n-1 , you get the second formula that they use.
You can also see this with index conversion:

As you can see, I adjusted the boundaries of the sum: both the upper and lower boundaries of the sum were reduced by 1. Effectively, this reduces all terms in the sum by 1, to fix this, you have to add 1 to the term under Σ: (j-1) + 1 = j .
source share