# Matrix Feedback

Take the following series D.

2
5
6
12

I then need to make a new column(and make it a matrix) to subtract the values of the previous like so

2, 3
5, 1
6, 6
12,

until eventually

2, 3, 2, 3
5, 1, 5
6, 6
12,

As you can see the result(r) is 3, given that the series could be of any size what formula would always return the last number. I also couldn't figure out how to use the MathJax with matrices. A one line formula would be very nice something like.
r = ??? D ???

-
Could be $a_n = 2+ 3 n -n(n-1)+\frac76n(n-1)(n-2)$, but could also be quite arbitrary. – Hagen von Eitzen Oct 13 '12 at 19:32
oh sorry, i just realized n :P – Tyler Oct 13 '12 at 19:44

A quick computation for 2, 3 and 4 elements makes me believe you get $$r = \sum_{i=1}^N (-1)^{N-i}\binom{N}{i}d_i$$ In particular you get $$\begin{eqnarray} r &=& d_2 - d_1 & \text{if } N = 2 \\ r &=& d_3 - 2d_2 + d_1 & \text{if } N = 3 \\ r &=& d_4 - 3d_3 + 3d_2 - d_1 & \text{if } N = 4 \end{eqnarray}$$ But beware, as I said, so far that's just an edcutated guess, not a formally proved fact. Having said that, I'd be somewhat surprised if I didn't turn out to hold, though.
(Note that $\binom{N}{i}$ is not a fraction, but a binomial coefficient, pronounced "N over i". See http://en.wikipedia.org/wiki/Binomial_coefficient for more information)