Linear Matrix Least Squares with Linear Equality Constraint - Minimize $ {\left\| A - B \right\|}_{F}^{2} $ Subject to $ B x = v $

The beginning looks fine. However, note that you need one Lagrange multiplier per constraint. Thus you need a vector $\lambda$.

The function to minimize is then $$\operatorname{tr}(A^T-B^T)(A-B) - \lambda^T (B x -v). $$

Taking the gradient with respect to $B$, we arrive at $$2 (B-A)- \lambda x^T =0. $$

We can solve this for $B$ with the result $$ B = A + \frac12 \lambda x^T\;.$$

The Lagrange multiplier have to be determined such that the constraints are fulfilled, e.g., $$B x = Ax + \frac12 \lambda x^Tx = v\;.$$ This leads to $$ \lambda = \frac{2}{x^T x}(v -Ax)$$ and thus to the explicit solution $$ B = A + \frac{1}{\Vert x \Vert^2} (v -Ax) x^T $$


Find orthogonal matrices $U,V$ such that $V^{-1}x\sim e_1$, $Uv\sim e_1$. As $ \|A-B\|_2=\|U(A-B)V\|_2$, we now want to find $B'=UBV$ with $B'e_1=\lambda e_1$ such that $\|A-B\|_2$ is minimized, where $A'=UAV$. As the first column of $B'$ is uniquely determined whereas all other entries of $B'$ are free to our likings, we make all entries of $B'$ in columns $2,\ldots, n$ equal to the corresponding entries of $A'$. Thus $B'y=A'y$ for all $y\perp e_1$.

Unfolding this result to the original matrices, we see that $By=Ay$ for all $y\perp x$. Thus $B$ must be of the form $$B=A+wx^T$$ where $w$ is adjusted to guarantee $Bx=v$. From $$v=Bx=Ax+wx^Tx=Ax+\|x\|^2w,$$ we find $w=\frac1{\|x\|^2}(v-Ax)$ and thus finally arrive at $$B = A+\frac{(v-Ax)x^T}{\|x\|^2}. $$