0
$\begingroup$

The problem is:

Why is $$ \sum_{n=0}^{k}|m-n|=\sum_{n=0}^{m}(m-n)+\sum_{n=m}^{k}(n-m)\;?$$

$\endgroup$

4 Answers 4

4
$\begingroup$

Note that $|m-n|=m-n$ for $n< m$ and $|m-n|=n-m$ for $n\ge m$.The given sum can thus be split as $$ \sum_{n=0}^k|m-n|=\sum_{n=0}^{m-1}|m-n|+\sum_{n=m}^{k}|m-n|=\sum_{n=0}^{m-1}(m-n)+\sum_{n=m}^{k}(n-m).$$ The only remaining difference is that the summand for $n=m$ is missing from the first sum. But since $|m-m|=0$, this doesn't matter.

Implicitly, we used $0\le m\le k$ in the above. But the result also holds for $m>k$ or $m<0$, provided one interpretes sums with lower index greater than upper index accordingly.

$\endgroup$
4
$\begingroup$

Try to understand what it means.

The absolute value $| m - n |$ is $m - n$ when $n \le m$ and $n - m$ when $n \ge m$

$\endgroup$
1
  • $\begingroup$ You can get $\le$ and $\ge$ with \le and \ge, respectively. $\endgroup$ Jan 14, 2015 at 15:45
1
$\begingroup$

Hint. Recall that $$ |u| = \begin{cases} -u, & \text{if $u \leq 0$} \\ u, & \text{if $u \geq 0$} \end{cases} $$ thus $$ |m-n| = \begin{cases} n-m, & \text{if $m \leq n$} \\ m-n, & \text{if $m \geq n$.} \end{cases} $$

$\endgroup$
0
1
$\begingroup$

\begin{align} \sum_{n=0}^{k}|m-n|&= \sum_{n=0, n \le m}^{k}|m-n| + \sum_{n=0, n \ge m}^{k}|m-n| \\ &= \sum_{n=0}^{m}|m-n| + \sum_{n= m }^{k}|m-n|\\ &= \sum_{n=0}^{m}(m-n) + \sum_{n= m}^{k}(n-m) \end{align}

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.