# Finding the closest special orthogonal matrix in Frobenius norm sense

Given a $$3\times3$$ matrix $$M$$, if we would like to get the closest $$\mathrm{SO}(3)$$ matrix $$R$$ that minimizes $$$$\|R-M\|_F$$$$

then $$R$$ = $$UV^{T}$$ where $$U$$ and $$V^{T}$$ are the orthogonal matrices from the singular value decompositon of $$M$$. i.e. $$M = U\Sigma V^{T}$$ as explained in this answer. When $$UV$$ is not a "special" orthogonal matrix i.e. $$det(UV^{T}) = -1$$ we replace the singular vector $$u_3$$ by $$-u_3$$.

My question is why only $$u_3$$ and why not any other column of $$U$$ or row of $$V^{T}$$?

(Posting this as a question instead of a comment since I don't have enough reputation yet, sorry!)

New contributor
Karnik Ram is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
• You must mean $\det(UV^{T}) = -1$ – Jean Marie Becker Aug 14 at 16:03
• Oops, yes thanks! – Karnik Ram Aug 14 at 17:09

By right-multiplying both $$R$$ and $$M$$ by $$V$$ and left-multiplying by $$U^T$$ you are leaving the objective invariant. Now the new $$M$$ is diagonal (actually, it's $$\Sigma$$), and it's not hard to convince yourself that so should the new $$R$$ be. If $$\det(UV^T) = -1$$, then the constraint means $$R$$ is a diagonal matrix with $$\pm 1$$ as its diagonal entries, and an odd number of $$-1$$s. Since $$\Sigma$$ is nonnegative, the choice that minimizes the distance is to make the entry corresponding to the smallest diagonal entry in $$\Sigma$$ the sole $$-1$$.
• Thanks for your answer! I am able to convince myself that the new rotation $R'$ (after left-multiplying and right-multiplying $R$) should be diagonal, but I am unable to understand why it should have a determinant of -1. I think the old rotation, $R$, should have a determinant of -1 (to make $det(U^{T}RV) = 1$ when det(UV^{T} = -1), but then it need not be diagonal? – Karnik Ram 2 days ago
• The old rotation R is what you constrain to be in SO(3), so it needs to be determinant 1. If you let $R' = U^T R V$, then you need $\det R' = -1$. – Yoav Kallus 2 days ago
• Thanks! I get it now. And negating the last element of $\Sigma$ is equivalent to negating the smallest singular vector of $U$. And we know $R = UV^{T}$. But what seems a little unintuitive to me here is that we're modifying our input $M$ itself to minimize the objective. – Karnik Ram 2 days ago