{"id":547,"date":"2024-01-15T19:05:55","date_gmt":"2024-01-15T19:05:55","guid":{"rendered":"https:\/\/sinatootoonian.com\/?p=547"},"modified":"2025-12-28T15:34:19","modified_gmt":"2025-12-28T15:34:19","slug":"the-closest-rotation-to-a-scaling","status":"publish","type":"post","link":"https:\/\/sinatootoonian.com\/index.php\/2024\/01\/15\/the-closest-rotation-to-a-scaling\/","title":{"rendered":"The closest rotation to a scaling"},"content":{"rendered":"\n<p>What is the closest rotation to a pure scaling? Intuitively, it should be the null rotation, the identity. One way to see this might be to consider starting with the identity scaling, for which it&#8217;s clearly true. If we then scale along one of the coordinate axes, there doesn&#8217;t seem to be any &#8216;torque&#8217; that would change the closest rotation to some non-identity one. This will be true as we scale the remaining directions one at a time until we arrive at the initial scaling we were interested in. <\/p>\n\n\n\n<p>It&#8217;s also easy to show this mathematically. Let the diagonal matrix $D$ contain our scalings, and let&#8217;s compare it to a rotation matrix $R$. We&#8217;re interested in minimizing the sum-of-squares difference between these two matrices. Now consider a row of $D &#8211; R$, say the first one. The sum-of-squares along this row is $$ (D_{11} &#8211; R_{11})^2 + \\sum_{i=2}^N R_{1i}^2 = (D_{11} &#8211; R_{11})^2 + (1 &#8211; R_{11}^2) = D_{11}^2 + 1 &#8211; 2 D_{11} R_{11},$$ where the first equality is because the rows of $R$ have unit norm. Now this function is decreasing in $R_{11}$ when $D_{11}$ is positive, and increasing when $D_{11}$ is negative, and $R_{11} \\in [-1,1]$, so $R_{11} = \\text{sign}(D_{11})$. Applying the same reasoning to the remaining rows, we arrive at $$ \\argmin_{R \\in SO(N)} \\|R &#8211; D\\|_F^2 = \\text{sign}(D).$$ This agrees with our intuition for positive scalings while also allowing for negative scalings by flipping along the coordinate axes.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is the closest rotation to a pure scaling? Intuitively, it should be the null rotation, the identity. One way to see this might be to consider starting with the identity scaling, for which it&#8217;s clearly true. If we then scale along one of the coordinate axes, there doesn&#8217;t seem to be any &#8216;torque&#8217; that [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1,152],"tags":[3,19],"class_list":["post-547","post","type-post","status-publish","format-standard","hentry","category-blog","category-post","tag-optimization","tag-rotations"],"acf":[],"_links":{"self":[{"href":"https:\/\/sinatootoonian.com\/index.php\/wp-json\/wp\/v2\/posts\/547","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sinatootoonian.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sinatootoonian.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sinatootoonian.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sinatootoonian.com\/index.php\/wp-json\/wp\/v2\/comments?post=547"}],"version-history":[{"count":13,"href":"https:\/\/sinatootoonian.com\/index.php\/wp-json\/wp\/v2\/posts\/547\/revisions"}],"predecessor-version":[{"id":560,"href":"https:\/\/sinatootoonian.com\/index.php\/wp-json\/wp\/v2\/posts\/547\/revisions\/560"}],"wp:attachment":[{"href":"https:\/\/sinatootoonian.com\/index.php\/wp-json\/wp\/v2\/media?parent=547"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sinatootoonian.com\/index.php\/wp-json\/wp\/v2\/categories?post=547"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sinatootoonian.com\/index.php\/wp-json\/wp\/v2\/tags?post=547"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}