Decomposition of a linear map into scale/rotation/shear matrices

When I have a linear map

$$ A = \pmatrix{a & b \\ c &d} $$

It obviously has 4 degrees of freedom. I would now like to decompose it into scale, rotation and sheer components:

$$ A = BCD = \pmatrix{s_1 & 0 \\ 0 & s_2}\pmatrix{\cos \alpha & -\sin \alpha \\ \sin \alpha & \cos \alpha} \pmatrix{1 & s_3 \\ s_4 & 1} $$

Or a similar decomposition. My problem here is, that I know have 5 degrees of freedom, so at least one variable must be a function of the others.

I suspect that there $BC$ isn't uniquely defined this way and shear can be expressed in one dimension combined with the correct rotation, but I do not know what's the actual decomposition I am looking for.

Some resources on shear maps suggest that your define horizontal $s_4=0$ or vertical ($s_3=0$) shear maps, so it is area preserving. But my map $A$ is a general transformation between two arbitrary (non-degenerate) triangles, so there are no such constraints and most transformations will need a non-area-preserving term.


A transformation which is a combination of scaling, rotation, shear, and translation is affine and conserves the parallelism. Your case is a special case where the translation is null. You can eliminate one parameter by applying the conservation of parallelism.