Sums of integer numbers using the Gauss’s trick

Maths is fun. Always nice tricks make our day. Do you recall Gauss’s trick? If the difference between consecutive numbers is always the same, we can use the trick by adding the first and final terms and then multiplying by half the number of terms! Isn’t beautiful?

Sum of consecutive odd numbers:
1+3+\cdots + \left (2n-1 \right ) = \frac{n}{2}\left (1 +2n-1 \right )= n^{2}

Sum of consecutive even numbers:
2+4+\cdots + 2n = \frac{n}{2}\left (2 +2n \right )= n\left ( n+1 \right )

Sum of consecutive numbers (or triangular numbers):
1+2+\cdots + n = \frac{n\left ( n + 1 \right )}{2}

Sum of consecutive cubes:
1^{3}+2^{3}+3^{3}\cdots + n^{3} = \frac{n^{2}}{4}\left ( n+1 \right )^{2}

And last but not list, the alternating sum of squares:
n^{2}-\left (n-1 \right )^{2}+\cdots +\left ( -1 \right )^{n-1}1^{2}=\frac{n}{2}\left ( n+1 \right )