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?

$\endgroup$
  • 2
    $\begingroup$ 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$ $\endgroup$ – Stefan Dec 6 '12 at 14:23
11
$\begingroup$

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.

$\endgroup$
  • 1
    $\begingroup$ Thank you! I appreciate the detailed explanation. $\endgroup$ – user1728853 Dec 6 '12 at 14:31
4
$\begingroup$

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$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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