[Math] Linear Algebra: Difference Matrix

linear algebraterminology

enter image description here

The above part of my linear algebra is giving me trouble. It says:

This A is a "difference matrix"…

I have colored in yellow what I think the book is meaning by the difference matrix. It is a difference matrix because it only has subtraction occurring. Is this true?

Best Answer

The way I think of a difference matrix is to first start with the identity matrix:

$$\begin{bmatrix} 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1 \end{bmatrix}$$

Multiplied against the vector $x$ will return $x$.

$$\begin{bmatrix} x_{1}\\ x_{2}\\ x_{3} \end{bmatrix}$$

But if we want to end up with each component of $x$ being the difference between itself and the preceding component, we want to end up with something like this:

$$\begin{bmatrix} x_{1}\\ x_{2} - x_{1}\\ x_{3} - x_{2} \end{bmatrix}$$

We can do that easily by modifying the identity matrix so that it picks up the previous $x_{i}$ as a negative. Here's the modified identity matrix. Notice the positions of the $-1$.

$$\begin{bmatrix} 1 & 0 & 0\\ -1 & 1 & 0\\ 0 & -1 & 1 \end{bmatrix}$$

That is your difference matrix.

If you wanted a centered difference matrix, we want to end up with:

$$\begin{bmatrix} x_{2}\\ x_{3} - x_{1}\\ -x_{2} \end{bmatrix}$$

Notice we returned to $x_{2}$ in the bottom line but as a negative. That's just because for the last row, we're taking "nothing" minus $x_{2}$ as there are no more components left in the matrix, just as we took $x_{3} - x_{1}$ above it. Another way to look at this:

$$\begin{bmatrix} x_{2} - 0\\ x_{3} - x_{1}\\ 0 - x_{2} \end{bmatrix}$$

Now let's look at our identity matrix. Before we start plugging in $-1$s, let's realize we need to offset the components such that we start with $x_{2}$ not $x_{1}$ as we did with the difference matrix.

$$\begin{bmatrix} 0 & 1 & 0\\ 0 & 0 & 1\\ 0 & 0 & 0 \end{bmatrix}$$

Now for the $-1$s, we need to skip a term, so you'll see $0$ gaps between the 1s and -1s.

$$\begin{bmatrix} 0 & 1 & 0\\ -1 & 0 & 1\\ 0 & -1 & 0 \end{bmatrix}$$

And there you have your centered difference matrix.