So I have a problem in the form of $y = Ax$, where $A$ is a matrix and $x$ and $y$ are vectors. $A$ is a skinny matrix and I would like to do a least squares solution to solve for $x$. Let's say though that $x$ has $10$ rows. In my solution I require that the first say $3$ elements of $x = [A;B;C]$. Does anyone have any thoughts on how I can perform a least squares solution with the constraint that the first $3$ rows of my solution are already defined?



1 Answer 1


Partition $A$ as $A=\begin{bmatrix} A_1 & A_2\end{bmatrix}$, and $x = (x_1, x_2)^T$. Then $Ax = A_1 x_1 +A_2 x_2$, and the problem becomes $\min_{x_2} \|Ax-y\|^2 = \min_{x_2} \|A_2x_2-(y-A_1 x_1) \|^2$, that is, an unconstrained least squares problem over $x_2$ with the $y$ vector replaced by $y-A_1 x_1$.

  • $\begingroup$ Thanks, so much for your help. This makes sense! $\endgroup$
    – PumpkinPie
    Oct 23, 2014 at 5:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.