# Create transformation matrix from scale and angle.

Suppose I have an angle e.g. 180 degrees, and I know that an image scales to 1.5 of its size, how do I map these to a 2D transformation matrix? Thanks!

-
You are repeating yourself: math.stackexchange.com/q/107819/19341 – draks ... Feb 10 '12 at 19:00

A rotation matrix (which rotates a vector an angle $\theta$ in the plane) is given by $$R = \begin{bmatrix} \cos \theta & -\sin\theta \\ \sin \theta & \cos \theta \end{bmatrix}$$ (see http://en.wikipedia.org/wiki/Rotation_matrix). To scale by a factor $\alpha$ (i.e. multiply both components of a vector by $\alpha$), apply the transformation $$S = \alpha I = \begin{bmatrix} \alpha & 0 \\ 0 & \alpha \end{bmatrix}$$ The desired matrix is obtained by multiplying these together, i.e. $A = RS$ (or, equivalently, $A = SR$, since $S$ commutes with every other matrix); the result is easily seen to be $$A = SR = RS = \begin{bmatrix} \alpha \cos \theta & -\alpha \sin \theta \\ \alpha \sin \theta & \alpha \cos \theta \end{bmatrix}$$ If you want to scale by a factor $\alpha$ in the $x$-direction and a factor $\beta$ in the $y$-direction, you would use $$S' = \begin{bmatrix} \alpha & 0 \\ 0 & \beta \end{bmatrix}$$ instead, and multiply as before, but now the order matters (in general, you have $R S' \neq S'R$).