Linear Algebra and Its Applications, Exercise 1.7.4

Exercise 1.7.4. For the differential equation with f(x) = 4\pi^2 \sin 2\pi x the corresponding difference equation is

\begin{bmatrix} 2&-1&0 \\ -1&2&-1 \\ 0&-1&2 \end{bmatrix} \begin{bmatrix} u_1 \\ u_2 \\ u_3 \end{bmatrix} = \frac{\pi^2}{4} \begin{bmatrix} 1 \\ 0 \\ -1 \end{bmatrix}

for h = \frac{1}{4}. Solve the above equation for u_1, u_2, u_3 and compare their values to the true solution u = \sin 4\pi x at x = \frac{1}{4}x = \frac{1}{2} and x = \frac{3}{4}.

Answer: We do Gaussian elimination on the difference matrix and the right-hand side:

\begin{bmatrix} 2&-1&0 \\ -1&2&-1 \\ 0&-1&2 \end{bmatrix} \quad \frac{\pi^2}{4} \begin{bmatrix} 1 \\ 0 \\ -1 \end{bmatrix} \rightarrow \begin{bmatrix} 2&-1&0 \\ 0&\frac{3}{2} &-1 \\ 0&-1&2 \end{bmatrix} \quad \frac{\pi^2}{4} \begin{bmatrix} 1 \\ \frac{1}{2} \\ -1 \end{bmatrix}

\rightarrow \begin{bmatrix} 2&-1&0 \\ 0&\frac{3}{2} &-1 \\ 0&0&\frac{4}{3} \end{bmatrix} \quad \frac{\pi^2}{4} \begin{bmatrix} 1 \\ \frac{1}{2} \\ -\frac{2}{3} \end{bmatrix}

Solving for u_3 we have

\frac{4}{3}u_3 = \frac{\pi^2}{4}(-\frac{2}{3}) \rightarrow u_3 = \frac{3}{4} \frac{\pi^2}{4} (-\frac{2}{3}) = -\frac{\pi^2}{8} \approx -1.23

Solving for u_2 we have

\frac{3}{2}u_2 - u_3 = \frac{\pi^2}{4} \frac{1}{2} \rightarrow \frac{3}{2}u_2 = \frac{\pi^2}{8} - \frac{\pi^2}{8} = 0 \rightarrow u_2 = 0

Finally we solve for u_1:

2u_1 - u_2 = \frac{\pi^2}{4} \rightarrow 2u_1 = \frac{\pi^2}{4} + 0 \rightarrow u_1 = \frac{\pi^2}{8} \approx 1.23

For the exact solution u(x) = \sin 2\pi x we have

u(\frac{1}{4}) = \sin 2 \pi \frac{1}{4} = \sin \frac{\pi}{2} = 1

u(\frac{1}{2}) = \sin 2 \pi \frac{1}{2} = \sin \pi = 0

u(\frac{3}{4}) = \sin 2 \pi \frac{3}{4} = \sin \frac{3\pi}{2} = 1

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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s