# Summation simplification explanation

I'm trying to understand summation for my algorithm course and it has been a while since I took discrete math. Could any body please explain how does summation simplification work from the problem below? How did it got the result? a detailed step-by-step explanation will help me a lot. Thank you.

$$\sum_{i=1}^n (n-i+1) = \frac12n(n+1)$$

You may observe that $$\sum_{i=1}^n i=\sum_{i=1}^n (n+1-i), \qquad (i \to n+1-i) \tag1$$ giving $$\sum_{i=1}^n i=\sum_{i=1}^n (n+1)-\sum_{i=1}^n i$$ or \begin{align} 2 \times\sum_{i=1}^n i&=(n+1)\sum_{i=1}^n 1=(n+1)n \end{align} to obtain $$\sum_{i=1}^n i=\frac{n(n+1)}2,$$ you conclude using $(1)$.