## Linear Algebra and Its Applications, Exercise 1.7.5

Exercise 1.7.5. What would the difference matrix in equation (6) look like if the boundary conditions were $u(0) = 1$ and $u(1) = 0$ (instead of $u(0) = 0$ and $u(1) = 0$)?

Answer: The finite difference equation would still be as given in equation (5):

$-u_{j+1} + 2u_j - u_{j-1} = h^2f(jh)$

For $j = 1$ this equation would become

$-u_2 + 2u_1 - u_0 = h^2 f(jh) \rightarrow -u_2 + 2u_1 - 1 = h^2 f(jh)$

$\rightarrow -u_2 + 2u_1 = h^2 f(jh) + 1 = h^2 [f(jh) + \frac{1}{h^2}]$

Since $h = \frac{1}{6}$ the corresponding 5 by 5 finite-difference matrix is then

$\begin{bmatrix} 2&-1&&& \\ -1&2&-1&& \\ &-1&2&-1& \\ &&-1&2&-1 \\ &&&-1&2 \end{bmatrix} \begin{bmatrix} u_1 \\ u_2 \\ u_3 \\ u_4 \\ u_5 \end{bmatrix} = \frac{1}{36} \begin{bmatrix} f(\frac{1}{6}) + 36 \\ f(\frac{2}{6}) \\ f(\frac{3}{6}) \\ f(\frac{4}{6}) \\ f(\frac{5}{6}) \end{bmatrix}$

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.

This entry was posted in linear algebra. Bookmark the permalink.