I have a double sum of the form $$ \sum_{i=1}^n\sum_{k=1}^i f(k) $$ and I want to change the order of the sums. From drawing some pictures I am fairly confident that $$ \sum_{i=1}^n\sum_{k=1}^i f(k) = \sum_{k=1}^n\sum_{i=1}^k f(n+1-k). $$
Again, writing out the terms, this seems pretty clear, but I am looking for a more precise proof. I tried a change of variable, but I don't seem to be able to find something that works. So my question is: How can I rigorously prove the above formula?
EDIT: Again, I can see that the formula is true by simply writing out the terms and collecting them again. So I can see that I will $n$ terms of $f(1)$ and $n-1$ terms of $f(2)$.
What I am specifically looking for is a rigorous proof that the formula holds. Is there, for example, some way to do this by a change of variables? Or some way of algebraically manipulating the sum?
A derivation can go as follows:
Comment:
In (1) we rewrite the index range to see the relationship between $i$ and $k$ more conveniently.
In (2) we change the order of summation by exchanging the sums.
In (3) we reverse the order of summation of the outer sum by setting the index $k\to n-k+1$.
In (4) we shift the index of the inner sum $i\to i-(n-k)$ to start with $i=1$.
In (5) we factor out $f(n-k+1)$ which does not depend on the index $i$.
In (6) we replace the inner sum by the factor $k$.