Mathematics II Ā· Unit 8 Ā· 5 hrs
Orthogonality and Least Squares
Exam-focused notes for Orthogonality and Least Squares (Mathematics II, MTH168): what the TU syllabus asks and how it has actually been tested, with 14 solved past questions from this unit.
Orthogonality and Least Squares in short
This chapter adds geometry, length, angle, and perpendicularity, to the algebra of vectors, and uses it to solve the practical problem of finding the "best" approximate solution when a linear system $A\mathbf{x} = \mathbf{b}$ has no exact solution.
What this unit covers
- Inner product, Length, and orthoganility
- Orthogonal sets
- Orthogonal projections
- The Gram-Schmidt process
- Least squares problems
- Application to linear models
- Inner product spaces
- Applications of inner product spaces
Least squares problems
2080 Ā· 10 marks
Find the least square solution of $Ax = c$ where
$$A = \begin{bmatrix} 1 & -3 & 3 \ 1 & 5 & 1 \ 1 & 7 & 2 \end{bmatrix}, \quad c = \begin{bmatrix} 5 \ -3 \ 5 \end{bmatrix}$$
and compute the associated least square error. [10+0]
2080 Ā· 5 marks
Find the equation $y = a_0 + a_1 x$ of the least squares line that best fits the data points (2,1), (5,2), (7,3), (8,3). [5]
Show solved answerHide answer
Least Squares Line: $y = a_0 + a_1x$
Given data
Points: $(2,1), (5,2), (7,3), (8,3)$, with $n = 4$.
Normal Equations
$$\sum y = na_0 + a_1\sum x$$ $$\sum xy = a_0\sum x + a_1\sum x^2$$
Computing Sums
| $x$ | $y$ | $x^2$ | $xy$ |
|---|---|---|---|
| 2 | 1 | 4 | 2 |
| 5 | 2 | 25 | 10 |
| 7 | 3 | 49 | 21 |
| 8 | 3 | 64 | 24 |
| $\sum x=22$ | $\sum y=9$ | $\sum x^2=142$ | $\sum xy=57$ |
Substituting
$$9 = 4a_0 + 22a_1 \quad (1)$$ $$57 = 22a_0 + 142a_1 \quad (2)$$
Solving
Multiply (1) by 22, (2) by 4:
$$198 = 88a_0 + 484a_1 \quad (3)$$ $$228 = 88a_0 + 568a_1 \quad (4)$$
Subtract (3) from (4):
$$30 = 84a_1 \implies a_1 = \frac{30}{84} = \frac{5}{14} \approx 0.357$$
Substitute into (1):
$$9 = 4a_0 + 22\cdot\frac{5}{14} = 4a_0 + \frac{55}{7}$$ $$4a_0 = 9 - \frac{55}{7} = \frac{8}{7} \implies a_0 = \frac{2}{7} \approx 0.286$$
Result
$$\boxed{y = \frac{2}{7} + \frac{5}{14}x \approx 0.286 + 0.357x}$$
2079 Ā· 10 marks
Find the equation $y = a_0 + a_1 x$ of the least square line that best fits the data points (0, 1), (1, 1), (1, 1), (2, 2), (3, 2).[10]
2078 Ā· 10 marks
Find a least square solution of the inconsistent system $Ax=b$ for
$$A = \begin{bmatrix} -1 & 2 \ 2 & -3 \ -1 & 3 \end{bmatrix}, \quad b = \begin{bmatrix} 4 \ 2 \ 1 \end{bmatrix}$$
[10]
2076 Ā· 10 marks
Find the least-square solution of $Ax = b$ for
$$A = \begin{bmatrix} 1 & -6 \ 1 & -2 \ 1 & 1 \ 1 & 7 \end{bmatrix} \text{ and } b = \begin{bmatrix} -1 \ 2 \ 1 \ 6 \end{bmatrix}$$
[10]
2075 Ā· 10 marks
Find the least-square solution of $Ax = b$ for
$$A = \begin{bmatrix} 1 & 3 & 5 \ 1 & 1 & 0 \ 1 & 1 & 2 \ 1 & 3 & 3 \end{bmatrix}, \quad b = \begin{pmatrix} 3 \ 5 \ 7 \ 3 \end{pmatrix}$$
[10]
2080.1 Ā· 10 marks
Find the least square solution of $Ax = b$ where and compute the associated least square error.
$$A = \begin{bmatrix} 1 & -3 & -3 \ 1 & 5 & 1 \ 1 & 7 & 2 \end{bmatrix}, \quad b = \begin{bmatrix} 5 \ -3 \ -5 \end{bmatrix}$$
[10]
Inner product, Length, and orthoganility
2080 Ā· 5 marks
Prove that the two vectors u and v are perpendicular to each other if and only if the line through u is perpendicular bisector of the line segment from -u to v. [5]
2079 Ā· 5 marks
Define unit vector. Find a unit vector of u = (0, -2, 2, -3) in the direction of u. [5]
Show solved answerHide answer
Given
- Vector $\mathbf{u} = (0, -2, 2, -3)$ in $\mathbb{R}^4$
- Task: Define unit vector; find unit vector in the direction of $\mathbf{u}$.
Solution
Definition of Unit Vector
A unit vector is a vector whose length (norm) is equal to $1$. For any nonzero vector $\mathbf{v} \in \mathbb{R}^n$, the unit vector in its direction is obtained by dividing the vector by its norm:
$$\hat{v} = \frac{\mathbf{v}}{|\mathbf{v}|}, \qquad |\mathbf{v}| = \sqrt{v_1^2 + v_2^2 + \cdots + v_n^2}$$
Finding the Unit Vector of $\mathbf{u} = (0, -2, 2, -3)$
Step 1: Compute the norm
$$|\mathbf{u}| = \sqrt{(0)^2 + (-2)^2 + (2)^2 + (-3)^2} = \sqrt{0 + 4 + 4 + 9} = \sqrt{17}$$
Step 2: Divide by the norm
$$\hat{u} = \frac{\mathbf{u}}{|\mathbf{u}|} = \frac{1}{\sqrt{17}}(0, -2, 2, -3)$$
$$\boxed{\hat{u} = \left(0,\ \frac{-2}{\sqrt{17}},\ \frac{2}{\sqrt{17}},\ \frac{-3}{\sqrt{17}}\right)}$$
Step 3: Verification
$$|\hat{u}| = \sqrt{0 + \frac{4}{17} + \frac{4}{17} + \frac{9}{17}} = \sqrt{\frac{17}{17}} = 1 \checkmark$$
The vector $\hat{u}$ has norm $1$ and points in the direction of $\mathbf{u}$, so it is the required unit vector.
2078 Ā· 5 marks
Find a unit vector $v$ of $u = (1, -2, 2, 3)$ in the direction of $u$. [5]
Show solved answerHide answer
Unit Vector of u = (1, ā2, 2, 3)
Given
$$u = (1,\ -2,\ 2,\ 3)$$
Step 2: Definition
The unit vector in the direction of $u$ is:
$$\hat{u} = \frac{u}{|u|}, \qquad |u| = \sqrt{u_1^2 + u_2^2 + u_3^2 + u_4^2}$$
Step 3: Compute the norm
$$|u| = \sqrt{(1)^2 + (-2)^2 + (2)^2 + (3)^2} = \sqrt{1 + 4 + 4 + 9} = \sqrt{18} = 3\sqrt{2}$$
Step 4: Compute the unit vector
$$\hat{u} = \frac{1}{3\sqrt{2}}(1,\ -2,\ 2,\ 3) = \left(\frac{1}{3\sqrt{2}},\ \frac{-2}{3\sqrt{2}},\ \frac{2}{3\sqrt{2}},\ \frac{3}{3\sqrt{2}}\right)$$
Rationalizing:
$$\hat{u} = \left(\frac{\sqrt{2}}{6},\ \frac{-\sqrt{2}}{3},\ \frac{\sqrt{2}}{3},\ \frac{\sqrt{2}}{2}\right)$$
Check
$$|\hat{u}| = \sqrt{\frac{1}{18} + \frac{4}{18} + \frac{4}{18} + \frac{9}{18}} = \sqrt{\frac{18}{18}} = 1 \checkmark$$
Hence the unit vector is confirmed.
2078 Ā· 5 marks
Prove that the two vectors uuu and vvv are perpendicular to each other if and only if the line through uuu is perpendicular bisector of the line segment from āu-uāu to vvv. [5]
2075 Ā· 5 marks
State and prove the Pythagorean theorem of two vectors and verify this for u = (1, -1) and v = (1, 1). [5]
2080.1 Ā· 5 marks
Let u = (1, -2, 2, 0). Find a unit vector of v in the same direction of u. [5]
The Gram-Schmidt process
2076 Ā· 5 marks
Find the QR factorization of the matrix $\begin{bmatrix} 2 & 1 \ 3 & -1 \end{bmatrix}$ [5]
Show solved answerHide answer
QR Factorization of $A = \begin{bmatrix} 2 & 1 \ 3 & -1 \end{bmatrix}$
Given
$$A = \begin{bmatrix} 2 & 1 \ 3 & -1 \end{bmatrix}$$
Columns: $$\mathbf{a_1} = \begin{bmatrix} 2 \ 3 \end{bmatrix}, \qquad \mathbf{a_2} = \begin{bmatrix} 1 \ -1 \end{bmatrix}$$
Goal: find orthogonal $Q$ and upper-triangular $R$ with $A = QR$.
Solution
First orthogonal vector
$$\mathbf{u_1} = \mathbf{a_1} = \begin{bmatrix} 2 \ 3 \end{bmatrix}, \qquad |\mathbf{u_1}| = \sqrt{4+9} = \sqrt{13}$$
$$\mathbf{q_1} = \frac{1}{\sqrt{13}}\begin{bmatrix} 2 \ 3 \end{bmatrix}$$
Second orthogonal vector
$$\mathbf{a_2}\cdot\mathbf{u_1} = (1)(2)+(-1)(3) = -1, \qquad \mathbf{u_1}\cdot\mathbf{u_1} = 13$$
$$\mathbf{u_2} = \mathbf{a_2} - \frac{-1}{13}\mathbf{u_1} = \begin{bmatrix} 1 \ -1 \end{bmatrix} + \frac{1}{13}\begin{bmatrix} 2 \ 3 \end{bmatrix} = \begin{bmatrix} \tfrac{15}{13} \ -\tfrac{10}{13} \end{bmatrix}$$
$$|\mathbf{u_2}| = \frac{1}{13}\sqrt{225+100} = \frac{\sqrt{325}}{13} = \frac{5\sqrt{13}}{13} = \frac{5}{\sqrt{13}}$$
$$\mathbf{q_2} = \frac{\mathbf{u_2}}{|\mathbf{u_2}|} = \frac{1}{\sqrt{13}}\begin{bmatrix} 3 \ -2 \end{bmatrix}$$
Matrix Q
$$Q = \frac{1}{\sqrt{13}}\begin{bmatrix} 2 & 3 \ 3 & -2 \end{bmatrix}$$
Matrix R
$$R = Q^{T}A = \frac{1}{\sqrt{13}}\begin{bmatrix} 2 & 3 \ 3 & -2 \end{bmatrix}\begin{bmatrix} 2 & 1 \ 3 & -1 \end{bmatrix}$$
Compute the entries:
- $(1,1): \frac{1}{\sqrt{13}}(2\cdot2 + 3\cdot3) = \frac{13}{\sqrt{13}} = \sqrt{13}$
- $(1,2): \frac{1}{\sqrt{13}}(2\cdot1 + 3\cdot(-1)) = \frac{-1}{\sqrt{13}}$
- $(2,1): \frac{1}{\sqrt{13}}(3\cdot2 + (-2)\cdot3) = 0$
- $(2,2): \frac{1}{\sqrt{13}}(3\cdot1 + (-2)(-1)) = \frac{5}{\sqrt{13}}$
$$\boxed{R = \begin{bmatrix} \sqrt{13} & -\dfrac{1}{\sqrt{13}} \[2mm] 0 & \dfrac{5}{\sqrt{13}} \end{bmatrix}}$$
Final Answer
$$Q = \frac{1}{\sqrt{13}}\begin{bmatrix} 2 & 3 \ 3 & -2 \end{bmatrix}, \qquad R = \begin{bmatrix} \sqrt{13} & -\tfrac{1}{\sqrt{13}} \ 0 & \tfrac{5}{\sqrt{13}} \end{bmatrix}$$
Verification
$$QR = \frac{1}{\sqrt{13}}\begin{bmatrix} 2 & 3 \ 3 & -2 \end{bmatrix}\cdot\frac{1}{\sqrt{13}}\begin{bmatrix} 13 & -1 \ 0 & 5 \end{bmatrix} = \frac{1}{13}\begin{bmatrix} 26 & 13 \ 39 & -13 \end{bmatrix} = \begin{bmatrix} 2 & 1 \ 3 & -1 \end{bmatrix} = A \checkmark$$
The completed values are $R_{11}=\sqrt{13}$, $R_{12}=-1/\sqrt{13}$, $R_{21}=0$ and $R_{22}=5/\sqrt{13}$.
Make Unit 8 stick
Practice MTH168 with flashcards & quizzes