For the following problem :
$$ \begin{aligned} & \min _{\mathbf{x} \in \mathbb{R}^n}\|\mathbf{y}-\mathbf{A} \mathbf{x}\|_2^2 \\ & \text { subject to } \mathbf{q}_1^T \mathbf{x}=1 \end{aligned} $$ where $\mathbf{A} \in \mathbb{R}^{m \times n}$ has full column rank, and $\mathbf{q}_1 \in \mathbb{R}^n$ has $\left\|\mathbf{q}_1\right\|_2=1$. Use LS to show that the solution to the above problem is $$ \mathbf{x}^*=\mathbf{q}_1+\mathbf{Q}_2\left(\mathbf{Q}_2^T \mathbf{A}^T \mathbf{A} \mathbf{Q}_2\right)^{-1} \mathbf{Q}_2^T \mathbf{A}^T\left(\mathbf{y}-\mathbf{A} \mathbf{q}_1\right) $$ where $\mathbf{Q}_2 \in \mathbb{R}^{n \times(n-1)}$ is any matrix such that $\left[\begin{array}{ll}\mathbf{q}_1 & \mathbf{Q}_2\end{array}\right]$ is an orthogonal matrix. $
I have used the Lagrange Multiplier technique to obtain
$$L(x,\lambda) = \lVert y-Ax \rVert^2 + \lambda(q_1x-1)$$
$$\nabla_xL(x,\lambda) = \lambda q_1 - 2A^Ty-2A^TAx$$ $$\nabla_\lambda L(x,\lambda) = q_1 - 1 $$
According to KKT they have to be equal to zero to obtain a set of Linear system of equations
\begin{equation} \begin{bmatrix} 2A^TA & q_1 \\ q_1 & 0 \end{bmatrix} \begin{bmatrix} x_1\\ \lambda \end{bmatrix} = \begin{bmatrix} 2A^Ty\\ 1 \end{bmatrix} \end{equation}
Solving for $x_1$ we get
$$ x = (A^TA)^{-1}(A^Ty - \lambda q_1/2) $$
using the fact that $$q_1 x = 1$$
$$q_1 x = 1$$ $$q_1 (A^TA)^{-1}(A^Ty - \lambda q_1/2) = 1$$
$$q_1 (A^TA)^{-1}A^Ty -q_1 (A^TA)^{-1} \lambda q_1/2 = 1$$
$$ q_1 (A^TA)^{-1} \lambda q_1 *(1/2) = -(1-q_1 (A^TA)^{-1}A^Ty)$$
$$ \lambda = -2(q_1 (A^TA)^{-1} q_1)^{-1}(1-q_1 (A^TA)^{-1}A^Ty)$$
but obviously this is wrong since these matrices are not invertible, where I am I going wrong any help is greatly appreciated.