Subjects Linear Algebra

Matrix Least Squares

Step-by-step solutions with LaTeX - clean, fast, and student-friendly.

Search Solutions

Matrix Least Squares


1. **State the problem:** Given velocity vectors $\mathbf{V}_A = 400\mathbf{i} + 100\mathbf{j}$ km/hr (where $\mathbf{i}$ points east and $\mathbf{j}$ points north), $\mathbf{V}_W = 60\mathbf{i} + 80\mathbf{j}$ km/hr, position vectors $\mathbf{r}_S = 10\mathbf{i} + 30\mathbf{j}$ km and $\mathbf{r}_P = 20\mathbf{i} + 10\mathbf{j}$ km, and matrices $$A = \begin{bmatrix} 2 & 1 \\ 3 & 2 \\ 1 & 2 \end{bmatrix}, \quad B = \begin{bmatrix} 100 \\ 180 \\ 80 \end{bmatrix},$$ solve the system or analyze the given vectors and matrices as required. 2. **Understand the components:** - $\mathbf{V}_A$ and $\mathbf{V}_W$ are velocity vectors in 2D. - $\mathbf{r}_S$ and $\mathbf{r}_P$ are position vectors in 2D. - $A$ is a $3 \times 2$ matrix and $B$ is a $3 \times 1$ vector. 3. **Possible tasks:** - Vector addition or subtraction. - Matrix equation solving: $A\mathbf{x} = B$ where $\mathbf{x}$ is a $2 \times 1$ vector. 4. **Solve the matrix equation $A\mathbf{x} = B$:** We want to find $\mathbf{x} = \begin{bmatrix} x_1 \\ x_2 \end{bmatrix}$ such that $$\begin{bmatrix} 2 & 1 \\ 3 & 2 \\ 1 & 2 \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} = \begin{bmatrix} 100 \\ 180 \\ 80 \end{bmatrix}.$$ This gives the system: 1. $2x_1 + x_2 = 100$ 2. $3x_1 + 2x_2 = 180$ 3. $x_1 + 2x_2 = 80$ 5. **Solve equations 1 and 2 first:** From (1): $x_2 = 100 - 2x_1$ Substitute into (2): $$3x_1 + 2(100 - 2x_1) = 180$$ $$3x_1 + 200 - 4x_1 = 180$$ $$-x_1 + 200 = 180$$ $$-x_1 = -20 \Rightarrow x_1 = 20$$ 6. **Find $x_2$ using $x_1=20$ in (1):** $$x_2 = 100 - 2(20) = 100 - 40 = 60$$ 7. **Check with equation (3):** $$20 + 2(60) = 20 + 120 = 140 \neq 80$$ Since the third equation is inconsistent, the system is overdetermined and has no exact solution. 8. **Find least squares solution:** The least squares solution minimizes $\|A\mathbf{x} - B\|^2$. Compute $A^T A$ and $A^T B$: $$A^T A = \begin{bmatrix} 2 & 3 & 1 \\ 1 & 2 & 2 \end{bmatrix} \begin{bmatrix} 2 & 1 \\ 3 & 2 \\ 1 & 2 \end{bmatrix} = \begin{bmatrix} 14 & 11 \\ 11 & 9 \end{bmatrix}$$ $$A^T B = \begin{bmatrix} 2 & 3 & 1 \\ 1 & 2 & 2 \end{bmatrix} \begin{bmatrix} 100 \\ 180 \\ 80 \end{bmatrix} = \begin{bmatrix} 2\times100 + 3\times180 + 1\times80 \\ 1\times100 + 2\times180 + 2\times80 \end{bmatrix} = \begin{bmatrix} 860 \\ 620 \end{bmatrix}$$ 9. **Solve $A^T A \mathbf{x} = A^T B$:** $$\begin{bmatrix} 14 & 11 \\ 11 & 9 \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} = \begin{bmatrix} 860 \\ 620 \end{bmatrix}$$ Use Cramer's rule or matrix inverse: Determinant: $$\det = 14 \times 9 - 11 \times 11 = 126 - 121 = 5$$ $$x_1 = \frac{1}{5} \begin{vmatrix} 860 & 11 \\ 620 & 9 \end{vmatrix} = \frac{860 \times 9 - 11 \times 620}{5} = \frac{7740 - 6820}{5} = \frac{920}{5} = 184$$ $$x_2 = \frac{1}{5} \begin{vmatrix} 14 & 860 \\ 11 & 620 \end{vmatrix} = \frac{14 \times 620 - 860 \times 11}{5} = \frac{8680 - 9460}{5} = \frac{-780}{5} = -156$$ 10. **Final least squares solution:** $$\boxed{\mathbf{x} = \begin{bmatrix} 184 \\ -156 \end{bmatrix}}$$ This vector $\mathbf{x}$ best fits the system in the least squares sense. --- **Summary:** - The system $A\mathbf{x} = B$ has no exact solution. - The least squares solution is $\mathbf{x} = \begin{bmatrix} 184 \\ -156 \end{bmatrix}$.