Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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!

share|improve this question
You are repeating yourself: math.stackexchange.com/q/107819/19341 –  draks ... Feb 10 '12 at 19:00

1 Answer 1

up vote 1 down vote accepted

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$).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.