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.