3
$\begingroup$

Lets say I have some numbers:

[1, 3, 5, 1, 10, 8]

What is the proper mathematical notation for the following operation?

$ (1-3) + (3-5) + (5-1) + (1-10) + (10-8) $

Here is what I was trying:

$ \sum_{i=1}^{N} p_i - p_j$

Is this correct? If now, what is the best way to write this?

  • 2
    What is $j$? It seems to me that you wat to sum up the differences of $p_i$ and $p_{i+1}$, not $p_j$2012-12-06

2 Answers 2

11

Your $p_j$ doesn't make sense because you don't have $j$ anywhere else. But you're close. Suppose your numbers are $p_1, p_2, \ldots, p_N$. Then the expression you want is

$\sum_{i=1}^{N-1} p_{i} - p_{i+1} $

Here if $p_i$ is one of the numbers in the sequence, then $p_{i+1}$ is the next number. So it says that from each number $p_i$, we subtract the next number $p_{i+1}$, and then the $\sum$ says to add up all the differences.

Note that we add only up to $i=N-1$, since after that there is no next number to subtract from: when $i=N-1$, the $p_{i}-p_{i+1}$ expression becomes $p_{N-1} - p_{N}$, and we are subtracting the ḷast number from the next-to-last one.

As Chris Eagle noted, the sum "telescopes" and simplifies to $p_1 - p_N,$ so you could also write it that way, but that represents a different (and simpler) calculation that happens to always produce the same result.

  • 1
    Thank you! I appreciate the detailed explanation.2012-12-06
4

If there are $N$ numbers in the sequence, and we call the $i$th number $p_i$, then your operation just gives $p_1-p_N$.