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?
$\endgroup$ 25 Answers
$\begingroup$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.
$\endgroup$ 2 $\begingroup$No, the difference matrix is $A$. This is called thus because it gives as a result a vector which components are the difference between consecutive terms of the initial vector (with the convention that $x_0=0$).
$\endgroup$ 3 $\begingroup$I think you are using Introduction to Linear Algebra by Gilbert Strang right(not sure though)? In that textbook it explains it as the matrix that operates on a matrix x to make b such that
$$x=\begin{bmatrix} x_1\\ x_2\\ x_3 \end{bmatrix}$$
and$$b=\begin{bmatrix} x_1\\ x_2-x_1\\ x_3-x_2 \end{bmatrix} $$
If you think that difference matrix A as a linear combination, it is obviously
A=$$ \begin{bmatrix} 1 & 0 & 0\\ -1 & 1 & 0\\ 0 & -1 & 1 \end{bmatrix} $$
It is also the inverse matrix of the sum matrix $A^{-1}$:$$\begin{bmatrix} 1 & 0 & 0\\ 1 & 1 & 0\\ 1 & 1 & 1 \end{bmatrix} $$
That works out like sum and difference, just like the sum and difference in normal arithmetics. The sum of difference gives back the original matrix.
The analogy that textbook used is integration and differentiation, which is great in my opinion. Think of sum matrix as integration and difference matrix as differentiation. The integral of a derivative gives back the original function.
Hope it helps.
$\endgroup$ $\begingroup$I think the author (author of "Introduction to linear algebra") wants to say:
this specific matrix $$ \left[ \begin{matrix} 1 & 0 & 0 \\ -1 & 1 & 0 \\ 0 & -1 & 1 \end{matrix} \right] \tag{1} $$is called a difference matrix. Say there is an input vector x:$$ x = \left[ \begin{matrix} x_1 \\ x_2 \\ x_3 \end{matrix} \right] \tag{2} $$
when this matrix acts on the vector, Ax gives the output vector b:$$ Ax = b = \left[ \begin{matrix} x_1 \\ x_2-x_1 \\ x_3-x_2 \end{matrix} \right] \tag{3} $$notice that b has a "difference pattern", which gives the difference of $x_1 $ and $x_0$ (think $x_0 $ is $0$),$x_2$ and $x_1$,$x_3 $ and $x_2$.
And what the difference matrix does is simultaneously give the difference of numbers in input vector.
$\endgroup$ $\begingroup$This Difference Matrix is an idea based on the Purpose or Application of this matrix.
You can think this in another way:
Q: I want to have matrix M which can transform an existed vector V into VT which satisfies:
V: $$\left[ \begin{matrix} v1 \\ v2 \\ v3 \\ \end{matrix} \right]$$
VT: $$\left[ \begin{matrix} v1 \\ v2-v1 \\ v3-v2 \\ \end{matrix} \right]$$
A: This matrix M is exactly the difference matrix from textbook.
OK, since we knew this. Next time when somebody ask you the same question, you can just show the answer...
Same idea, we can define new things, e.g., reversal matrix (maybe not a good name) as:
Q: I want to have matrix M which can transform an existed vector V into VT which satisfies:
V: $$\left[ \begin{matrix} v1 \\ v2 \\ v3 \\ \end{matrix} \right]$$
VT: $$\left[ \begin{matrix} -v1 \\ -v2 \\ -v3 \\ \end{matrix} \right]$$
This time, you can guess what the answer is...reversal matrix.