Least squares problem regarding distance between two vectors in $\mathbb{R}^3$

148 Views Asked by At

I'm solving an exercise problem and was facing some confusion regarding how to solve it. The problem is (roughly translated to English):

Given the following:

$$\mathbf{A} = \begin{bmatrix} 2 & 0 \\ 1 & 1 \\ 0 & 1 \end{bmatrix},\ \mathbf{w} = \begin{bmatrix} 1 \\ 1 \\ 1 \end{bmatrix}$$

There exists no vector $\mathbf{x} = (x, y)$ that satisfies $\mathbf{A} \mathbf{x} = \mathbf{w}$. Find the values of $x$ and $y$ that minimize the distance between $\mathbf{A}\mathbf{x}$ and $\mathbf{w}$ in $\mathbb{R}^3$.

My Approach

The result of $\mathbf{A}\mathbf{x}$ is $(2x, x + y, y)$. Since we're minimizing distance in $\mathbb{R}^3$ I thought that finding the minima for the following would do the trick:

$$ \begin{align} d & = (2x - 1)^2 + (x + y - 1)^2 + (y - 1)^2 \\ & = 5x^2 - 6x + 2xy + 2y^2 - 4y + 2 \end{align} $$

This is where my confusion mainly stems from, but in order to get the values for both the $x$ and $y$ coordinates, I obtained the partial derivatives of the above equation and set them to $0$.

$$ \begin{align} & \frac{\partial d}{\partial x} = 10x - 6 + 2y \\ & \frac{\partial d}{\partial y} = \phantom{0}2x + 4y - 4 \end{align} $$

Setting both of these to $0$ and solving gives us:

$$ x = \frac{4}{9},\ y = \frac{7}{9} $$

Is this approach correct? Any tips are appreciated. Thanks.

2

There are 2 best solutions below

0
On BEST ANSWER

Yes, your approach is completely correct.

For what it's worth, we can systematically obtain "least squares" solutions to such equations by solving the equation $A^TA \mathbf x = A^T \mathbf w$.

0
On

This approach is indeed correct.

You can justify that the point you find is a minimum by the following:

The function $d$ of $(x,y)$ you have found is differentiable and goes to infinity as $\|(x,y)\|$ goes to infinity so it necessarily has a minimum and at a minimum the partial derivatives are zero. Since you have proven there is a unique point at which the partial derivatives are zero, this point is necessarily a minimum.