If I have matrices $\mathbf A$ and $\mathbf B$ then what is $\mathbf x$ to minimize $\|\mathbf A- \mathbf{B} x\|_F$?

  • $\begingroup$ @Naga Sorry, I want a scalar x. I think if I would have wanted a matrix then it would be like procrustes scaling. $\endgroup$
    – mathcast
    Dec 3, 2010 at 15:12
  • $\begingroup$ so what if A is mxm and B is mxp will the above still apply? $\endgroup$
    – user10397
    May 3, 2011 at 2:26

2 Answers 2


The problem is equivalent to minimizing $\|A - xB\|_F^2$, which is in turn: $\min_{x} \sum_{i, j}(A_{ij}-xB_{ij})^2$ This is a simple quadratic in $x$, whose minimizer is obtained by setting the derivative to 0.


The Frobenius norm is the regular vector Euclidean norm when $A$ and $B$ are viewed as $n^2$-dimensional vectors. So the $xB$ minimizing $||A - xB||_F$ would be the vector projection of $A$ on $B$, given by $(A \cdot {B \over ||B||_F}) B$, where $\cdot$ is the $n^2$ dimensional dot product. Hence $x$ is given by $A \cdot {B \over ||B||_F}$.

  • $\begingroup$ Dear @Zarrax, one question please: In your last equation (the solution of $x$), does the Frobenius norm denote the Euclidean norm? I ask because you consider $n^2$-dimensional vectors in your approach. Thanks a lot! $\endgroup$ Sep 27, 2014 at 12:34
  • $\begingroup$ In addition to my previous comment, and if this is true, If I set $B=I_n$, then what I found for the solution $x$ is: $x=\frac{1}{\sqrt{n}}\sum_{i=1}^n a_{ii}$. May you verify whether this is correct or not! Thanks once again! $\endgroup$ Sep 27, 2014 at 15:28

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.