# Minimize Frobenius norm

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

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

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}$.
• 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! Sep 27, 2014 at 12:34
• 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! Sep 27, 2014 at 15:28