How to prove that $\sum_{i=j}^nn-i = \sum_{i=1}^{n-j}i$? Trying to solve question 2-3 from Skiena's Algorithm Design Manual which asks to find the runtime of the following loop:
for i := 1 to n do
   for j := 1 to i do
      for k := j to i + j do
         for l := 1 to i + j - k do
            r := r + 1

The actual sum used to solve this is $\sum_{i=1}^n\sum_{j=1}^i\sum_{k=j}^{i+j}\sum_{l=1}^{i+j-k}1 = \sum_{i=1}^n\sum_{j=1}^i\sum_{k=j}^{i+j}i+j-k$, but I've tried to focus the question on the step that is confusing me (used i instead of k, n instead of i+j):
$$\sum_{i=j}^nn-i = \sum_{i=1}^{n-j}i$$
Edit: I didn't really ask the right question... I'm wondering how you find the sum on the right (without knowing it) from the sum on the left. It seems that writing out or visualizing the terms like Pedro and Michael did would help seeing the sum on the right from 0 to n-j, I was just hoping for some kind of rule that helps convert from one sum to the other. 
 A: Set $n-i=k,i=n\iff k=0,i=j\iff k=?$  $$\sum_{i=j}^n(n-i)=\sum_{k=0}^{n-j}k=\sum_{k=1}^{n-j}k$$
A: $$
\sum_{i=j}^n (n-i) = \sum_{i=1}^{n-j} i
$$
$$
n=10, \  j=6: \  \left\{ \quad
\begin{align}
& \overbrace{(10-6)}^{i\,=\,6} + \overbrace{(10-7)}^{i\,=\,7} + \overbrace{(10 - 8)}^{i\,=\,8} + \overbrace{(10-9)}^{i\,=\,9} + \overbrace{(10-10)}^{i\,=\,10} \\[10pt]
= {} & \underset{\begin{array}{c} \uparrow \\ i\,=\,1 \end{array}} 1 \!\!\! + 2 + 3 + \!\!\! \underset{\begin{array}{c} \uparrow \\ i\,=\,4 \end{array}}4
\end{align}
\right.
$$
A: Another way yet, using $\sum_{i=a}^b i=\frac{b+a}{2}(b+1-a)$:
\begin{align*}
\sum_{i=j}^n(n-i)&=(\sum_{i=j}^nn)-(\sum_{i=j}^ni)=n(n+1-j)-\frac{(n+j)}{2}(n+1-j)\\
&=\frac{n-j}{2}(n+1-j)
\end{align*}
On the other hand,
\begin{align*}
\sum_{i=1}^{n-j}i=\frac{1+n-j}{2}(n-j+1-1)=\frac{n-j}{2}(n+1-j)
\end{align*}
A: \begin{align*}
 \sum_{i=j}^{n} (n-i) &= \sum_{i=j-j}^{n-j} (n-(i+j))\\
         &= \sum_{i=0}^{n-j} (n-(i+j))\\
         &= \sum_{i=0}^{n-j} k(i), \quad \left( \text{k(i):= n-(i+j)}\right) \\
         &=\sum_{i=0}^{n-j} i  \quad \left(\text{$ k(i)=\widehat{n-j,0}, \,when \,\,\, i=\widehat{0,n-j} $ }\right)\\
         &=\sum_{i=1}^{n-j} i
\end{align*}
A: The trick to manipulating indices is to use general sigma notation rather than the delimited form. This makes the process completely mechanical and reduces the chance of making an error. We get
\begin{align*}
 \sum_{i=j}^{n} (n-i) &= \sum_{j \leqslant i \leqslant n} (n-i)\\
&= \sum_{n-j \geqslant n-i \geqslant n-n} (n-i) \\
&= \sum_{0 \leqslant n-i \leqslant n-j} (n-i) \\
&= \sum_{0 \leqslant i \leqslant n-j} i.
\end{align*}
In the last step $n-i$ was replaced by a new index variable $i$ (note that this is a different $i$), which is valid because as $i$ ranges over all integers, $n-i$ also ranges over all integers: in other words, $i \mapsto n-i$ is a permutation of the integers. You only have to realize that it is a permutation, then it's just a matter of massaging the bounds until you can re-index.
This is really just an application of the commutative law for summation. In the second-to-last line, the sum is $(n-j) + (n-j-1)+\cdots + 0$ (in order of increasing $i$); in the last, it's $0 + \cdots + (n-j)$.
Here's the formal commutative law: For any finite set of integers $I$ and any permutation $p$ of the set of all integers,
$$\sum_{i \in I} a_i = \sum_{p(i) \in I} a_{p(i)}.$$
This might seem like we're just replacing symbols, but you should interpret the sigmas as sums over all integers $i$ in increasing order, so the ordering of terms has been changed. In the derivation above, $I = [0..(n-j)]$ and $p(i) = n - i$: we applied the commutative law "in reverse."
