Use Sage to do your computations for you.
See
Appendix B.7: Best approximation.
In each of the following:
- Compute \(\operatorname{proj}_U \mathbf{v}\) relative to the provided inner product.
- Determine the (shortest) distance from \(\mathbf{v}\) to \(U\).
-
\(V = \mathbb{R}^3\) using the standard inner product;
\(U\) is the plane \(2x + 3y - z = 0\);
\(\mathbf{v} = (5,2,-4)\).
-
\(V = \mathbb{R}^4\) using the standard inner product;
\(U\) is the intersection of the hyperplanes \(2w + 3x - y + z = 0\) and \(w - x + y - 3z = 0\);
\(\mathbf{v} = (1,1,2,2)\).
-
\(V = \mathrm{M}_{3 \times 3} (\mathbb{R})\) using the standard inner product \(\langle A, B \rangle = \operatorname{trace} (B^{\mathrm{T}} A)\);
\(U\) is the space of diagonal matrices;
\(\mathbf{v}\) is the "anti-identity" \[ \mathbf{v} = \begin{bmatrix} 0 & 0 & 1 \\ 0 & 1 & 0 \\ 1 & 0 & 0 \end{bmatrix} \text{.} \]
-
In the subspace \(V = \operatorname{Span} \{1,x,x^2,x^3,e^x\}\) of the space \(C[0,1]\)
(the space of continuous functions on the interval \(0 \le x \le 1\))
with inner product \[ \langle f, g \rangle = \int_0^1 f(x) g(x) \, dx \text{;} \]
\(U\) is \(\mathrm{P}_3(\mathbb{R})\); \(\mathbf{v} = e^x \).
-
\(V = \mathbb{C}^3\) using the standard complex inner product;
\(U\) is the plane \(2\mathrm{i} x + 3 y - (1 + \mathrm{i}) z = 0\);
\(\mathbf{v} = (\mathrm{i},1,2\mathrm{i})\).
-
\(V = \mathrm{M}_{3 \times 3} (\mathbb{C})\) using the standard inner product \(\langle A, B \rangle = \operatorname{trace} (B^{\ast} A)\);
\(U\) is the space of diagonal matrices;
\(\mathbf{v}\) is the Hermitian matrix
\[ \mathbf{v} = \begin{bmatrix} 0 & 0 & 1 + \mathrm{i} \\ 0 & 1 & 0 \\ 1 - \mathrm{i} & 0 & 0 \end{bmatrix} \text{.} \]
Answers