# SVD of orthogonal matrix and multiplying the left and right singular matrices?

I came across some code that takes some orthogonal matrix $R$ and computes the SVD of it $U, S, V^T = SVD(R)$ and then they compute the quantity $UV$ with the comment: Transformation of R into - in Frobenius sense - next orthonormal matrix. I'm trying to figure out what this means, and why they did this.

Not sure if it's relevant to this question, but this code tries recovering a rotation and translation from a homography matrix.

Thanks!

• If you post more code maybe I can help. So far the only thing I notice is that since $R$ is ortogonal and $R = U \Sigma V^t$, than $\Sigma$ is full rank with diagonals $\pm 1$ since an ortogonal matriz preserves norm. Then $\Sigma ^2 = I$. Using it $R = U \Sigma V^t \to RV = U \Sigma \to RV\Sigma = U \to RV\Sigma V = UV$, it helps? – Lucas Resende Jun 13 '18 at 2:36
• @LucasResende thanks. I have linked the full script in my original post. So it seems like you are saying they just for back the same R? Not sure what the point of this is – Carpetfizz Jun 13 '18 at 2:38

My impression is as follows: before they "transform $R$ to the nearest orthogonal matrix", $R$ might not be exactly orthogonal (my guess is that this is a result of errors due to rounding or approximation along the way). In order to have an $R$ which is exactly orthogonal, the use the $R$ that they found and produce the nearest (exactly) orthogonal matrix.