Can the composition of two 3D transformations (rotation+scaling) be decomposed as a rotation+scaling

linear algebrarigid transformation

Let's say I have two rotations matrices (in 3D) $R_1$ and $R_2$, as well as two scaling (of the form $\text{diag}(s_x,s_y,s_z)$) matrices $S_1$ and $S_2$. Then, I can define two spatial transformations $T_1 = R_1S_1$ and $T_2 = R_2S_2$.

Now, let $T=T_2T_1$. As a composition of spatial transformations, $T$ is still a spatial transformation. However, it is not clear to me if $T$ can in turn be decomposed as $T=RS$, with some rotation $R$ and some scaling $S$.

I am aware of this question and answer, but my question is not "how can I decompose $T$" but rather "can $T$ still be decomposed" ? Obviously, if $T$ cannot be decomposed, there is no point in searching $R$ and $S$ – for example, if there are not unique. If it can, then I know how to do it by using the link above – assuming the answer there is correct.

Best Answer

This isn’t even generally possible in 2D. Take, for example, $S_1=I$, $S_2=\operatorname{diag}(2,1)$ and two 45-degree rotations. We then have $$T = \begin{bmatrix}\frac1{\sqrt2}&-\frac1{\sqrt2}\\\frac1{\sqrt2}&\frac1{\sqrt2}\end{bmatrix} \begin{bmatrix}2&0\\0&1\end{bmatrix} \begin{bmatrix}\frac1{\sqrt2}&-\frac1{\sqrt2}\\\frac1{\sqrt2}&\frac1{\sqrt2}\end{bmatrix} = \begin{bmatrix}\frac12&-\frac32\\\frac32&-\frac12\end{bmatrix}.$$ Now, suppose that this can be decomposed into a scaling along the coordinate axes followed by a rotation. Then there’s some diagonal matrix $D$ such that $TD$ is orthogonal. Setting $D=\operatorname{diag}(a,b)$, this means that we must have $$\begin{bmatrix}\frac12a&\frac32a\\-\frac32b&-\frac12b\end{bmatrix}\begin{bmatrix}\frac12a&-\frac32b\\\frac32a&-\frac12b\end{bmatrix} = \begin{bmatrix}\frac52a^2&-\frac32ab\\-\frac32ab&\frac52b^2\end{bmatrix} = I.$$ There is obviously no solution to this equation.

You do have the polar decomposition available, which lets you decompose $T$ into a scaling along some set of orthogonal directions followed by a rotation, but there’s no guarantee that those scaling directions will coincide with the coordinate axes, as demonstrated above. For that example, we can write $$T = \begin{bmatrix}0&-1\\1&0\end{bmatrix} \begin{bmatrix}\frac32&-\frac12\\-\frac12&\frac32\end{bmatrix}.$$ The right-hand matrix scales by a factor of $2$ in the direction of $(1,-1)$ and by a factor of $1$ in the direction of $(1,1)$, as you can verify by computing eigenvalues and eigenvectors, while the left-hand matrix is a 90-degree rotation.