Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have a vector of numbers, $x_0, x_1, x_2, \dots, x_n$. I'm trying to figure out how I can denote the sum of the last 3 numbers in the vector. For example, consider the vector:

x = [1, 2, 3, 4, 5, 6]

I'm looking for the notation that produces, $4+5+6 = 15$

Is this correct?

$$ \sum_{i=0}^n x_{n-i} $$

share|improve this question
The $n$ over the $\Sigma$ should be replaced by $2$. As it is now it is not even well-defined unless the vector starts with $x_0$. –  Stefan Hamcke Sep 2 '13 at 16:17
Thanks, I updated the question with an example problem, which should make things clearer. –  turtle Sep 2 '13 at 16:22
@turtle: Stefan's comment about replacing the $n$ at the top of the sum with $2$ is still correct. –  Zev Chonoles Sep 2 '13 at 16:26

3 Answers 3

up vote 3 down vote accepted

Your suggestion is $$ \sum_{i=0}^{n}x_{n-i}=x_{n}+x_{n-1}+\ldots+x_{0}, $$ which is equal to the sum of all terms. Instead, use $$ \sum_{i=0}^{m-1}x_{n-i}=x_{n}+x_{n-1}+\ldots+x_{n-\left(m-1\right)} $$ to get the sum of the last $m$ terms in the vector. For example, for the last $3$ terms, $m=3$ and $$ \sum_{i=0}^{2}x_{n-i}=x_{n}+x_{n-1}+x_{n-2}, $$ as desired.

share|improve this answer

Since your vector $x$ is a vector, you can represent linear quantities in terms of matrix multiplication. I will write your vector as a column $x = \left[ \begin{smallmatrix} x_1 \\ \vdots \\ x_n \end{smallmatrix}\right]$, so that I can multiply it on the left by operators.

Consider the matrix $$ A = \left[ \begin{matrix} 1 & 1 & \cdots & 1 \\ 0 & 1 & \ddots & \vdots \\ \vdots & \ddots & \ddots & 1 \\ 0 & \cdots & 0 & 1 \end{matrix} \right] $$ which consists of $1$s on and above the diagonal, and $0$s below the diagonal. Then the product $Ax$ is the vector $$ Ax = \left[ \begin{matrix} x_1 + x_2 + \cdots + x_n \\ x_2 + \cdots + x_n \\ \ddots \\ x_{n-1} + x_n \\ x_n \end{matrix}\right] $$ consisting of all the answers to your question.

If you want, say, the $j$th entry in the vector $Ax$, then you can use the $j$th row $A_j$ of $A$ in place of $A$ itself. This is the row with $j-1$ zeros and $n-j+1$ ones. So in your particular case with $n=6$ and $n-j+1 = 3$, you want the 4th row:

$$ A_4 x = \left[ \begin{matrix} 0 & 0 & 0 & 1 & 1 & 1 \end{matrix}\right] \left[ \begin{matrix} x_1 \\ x_2 \\ x_3 \\ x_4 \\ x_5 \\ x_6 \end{matrix}\right] = x_4 + x_5 + x_6 $$

Here I have adopted the standard abuse of notation in which $1\times 1$ matrices are identified with numbers.

Of course, this answer requires explaining lots of extra notation. It's good if you're planning on doing a lot of manipulation with such sums, but bad if you're just trying to communicate to someone "$x_4 + x_5 + x_6$" or even "$x_m + x_{m+1} + \cdots + x_n$", either of which is completely fine notation.

share|improve this answer

There is nothing special about $i = 0$ so while

$$\sum_{i = 0}^{2} x_{n-i} = x_n + x_{n-1}+x_{n-2}$$

Will give you the sum you want you could also write

$$\sum_{i = n-2}^{n} x_i = x_{n-2}+x_{n-1}+x_n$$

and get the same result.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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