Factorizing a rotation matrix into a product of stretch and shear matrices In a video which shows how to rotate a picture in Microsoft Paint by any given angle (usually you can only rotate by 90 degrees in Paint), it is shown how to do a rotation by $\alpha$ doing the following operations:


*

*Horziontal skew by $\alpha$

*Vertical stretch by $\frac{1}{\cos^2(\alpha)}$

*Vertical skew by $-\alpha$

*Horizontal and vertical stretch by $\cos(\alpha)$


So in terms of matrices, we have
$\begin{pmatrix}\cos(\alpha)&\sin(\alpha)\\-\sin(\alpha)&\cos(\alpha)\end{pmatrix}=\begin{pmatrix}\cos(\alpha)&0\\ 0&\cos(\alpha) \end{pmatrix}\begin{pmatrix}1&0\\ \tan(-\alpha)&1 \end{pmatrix}\begin{pmatrix}1&0\\0& \frac{1}{\cos^2(\alpha)} \end{pmatrix}\begin{pmatrix}1&\tan(\alpha)\\0&1 \end{pmatrix}.$
Are there general factorization results of this kind (e.g. for non-rotation matrices? In which sense is this factorization unique for a rotation matrix? 
 A: Any $2\times2$ matrix $\pmatrix{a&b\\c&d}$ with $a\ne0$ can be factored into the triple product $$\pmatrix{1&0\\x&1}\pmatrix{r&0\\0&s}\pmatrix{1&y\\0&1}.$$ This is easily shown by multiplying it out and solving for the four parameters: $$\pmatrix{a&b\\c&d}=\pmatrix{r&ry\\rx&rxy+s}$$ $\therefore$ $r=a$, $x=c/a$, $y=b/a$ and $s=(ad-bc)/a$. The decomposition in your question is an instance of this triple product with $\cos\alpha$ pulled out of the central diagonal matrix into a separate factor.  
There are other interesting triple-product decompositions as well. For example, in Gaussian optics optical systems that have the same medium at both ends can be described via $2\times2$ unimodular (determinant $1$) matrices. If $c\ne0$ (i.e., the system is what’s called non-telescopic), then such a matrix can be decomposed into the product $$\begin{pmatrix}1&t\\0&1\end{pmatrix}\begin{pmatrix}1&0\\c&1\end{pmatrix}\begin{pmatrix}1&s\\0&1\end{pmatrix}$$ from which one can derive the fact that any such optical system, no matter how complex, can be described simply in terms of three quantities—the location of the two so-called principal planes and effective focal length.
