Exercise 1.7.3. Given the differential equation
what is the finite-difference matrix for (corresponding to a 5 by 5 matrix)? Note that you can replace the boundary condition by (and hence ) and the boundary condition by (and hence ).
Show that the finite-difference matrix applied to the vector yields zero. Similarly, show that for any solution to the original differential equation, is also a solution.
Answer: We can express in finite difference terms as
We have and are thus considering meshpoints . The above equation can then be rewritten as
where is the approximation of at the point .
We already know that so that for the above equation becomes
For the above equation becomes
The equation has a similar form for , , and . Since for the equation becomes
The corresponding 5 by 5 finite-difference matrix is then
If we apply the finite-difference matrix to the constant vector we obtain the following:
Finally, assume that is a solution of and let . Then we have
We also have
So is also a solution if is.
NOTE: This continues a series of posts containing worked out exercises from the (out of print) book Linear Algebra and Its Applications, Third Edition by Gilbert Strang.
If you find these posts useful I encourage you to also check out the more current Linear Algebra and Its Applications, Fourth Edition, Dr Strang’s introductory textbook Introduction to Linear Algebra, Fourth Edition and the accompanying free online course, and Dr Strang’s other books.