## Linear Algebra and Its Applications, Exercise 3.4.22

Exercise 3.4.22. Given an arbitrary function $y$ find the coefficient $b_1$ that minimizes the quantity

$\|b_1\sin x - y\|^2 = \int_0^{2\pi} (b_1\sin x - y(x))^2 \;\mathrm{d}x$

(Use the method of setting the derivative to zero.) How does this value of $b_1$ compare with the Fourier coefficient $b_1$? What is $b_1$ if $y(x) = \cos x$?

Answer: We are looking for a value of $b_1$ that minimizes the expression on the right, so we need to differentiate with respect to $b_1$. Expanding the right-hand side of the equation above, we have

$\int_0^{2\pi} (b_1\sin x - y(x))^2 \;\mathrm{d}x = \int_0^{2\pi} [b_1^2\sin^2 x - 2b_1y(x)\sin x + y(x)^2] \;\mathrm{d}x$

$= \int_0^{2\pi} b_1^2\sin^2 x \;\mathrm{d}x - 2 \int_0^{2\pi} b_1y(x)\sin x \;\mathrm{d}x + \int_0^{2\pi} y(x)^2 \;\mathrm{d}x$

Since $b_1$ is not dependent on $x$ we can pull it out of the integral, so that

$\int_0^{2\pi} (b_1\sin x - y(x))^2 \;\mathrm{d}x = b_1^2 \int_0^{2\pi} \sin^2 x \;\mathrm{d}x - 2b_1 \int_0^{2\pi} y(x) \sin x \;\mathrm{d}x + \int_0^{2\pi} y(x)^2 \;\mathrm{d}x$

Differentiating with respect to $b_1$ we have

$\frac{\mathrm{d}}{\mathrm{d}b_1} \int_0^{2\pi} (b_1\sin x - y(x))^2 \;\mathrm{d}x$

$\frac{\mathrm{d}}{\mathrm{d}b_1} \left[ b_1^2 \int_0^{2\pi} \sin^2 x \;\mathrm{d}x - 2b_1 \int_0^{2\pi} y(x) \sin x \;\mathrm{d}x + \int_0^{2\pi} y(x)^2 \;\mathrm{d}x \right]$

$= 2b_1 \int_0^{2\pi} \sin^2 x \;\mathrm{d}x - 2 \int_0^{2\pi} y(x) \sin x \;\mathrm{d}x$

Equating the derivative to zero gives us

$2b_1 \int_0^{2\pi} \sin^2 x \;\mathrm{d}x = 2 \int_0^{2\pi} y(x) \sin x \;\mathrm{d}x$

or

$b_1 = \left( \int_0^{2\pi} y(x) \sin x \;\mathrm{d}x \right) / \left( \int_0^{2\pi} \sin^2 x \;\mathrm{d}x \right)$

Note that this is identical to the expression for the Fourier coefficient $b_1$ on page 178; the numerator is the dot product of $y(x)$ with $\sin x$ and the denominator is the dot product of $\sin x$ with itself.

If $y(x) = \cos x$ then the numerator of $b_1$ becomes

$\int_0^{2\pi} \cos x \sin x \;\mathrm{d}x = 0$

since $\cos x$ and $\sin x$ are orthogonal, and we therefore have $b_1 = 0$.

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, Fifth Edition and the accompanying free online course, and Dr Strang’s other books.

This entry was posted in Uncategorized. Bookmark the permalink.