$$ \begin{pmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{pmatrix} $$

How was this matrix derived? I know how to use it, but where did it come from? Can someone prove why this matrix represents a rotation about the origin by an angle theta?

  • 1
    $\begingroup$ Draw a figure with normal and rotated axes and a point (x,y). See if you can drive the new coordinates wrt the old using simple trigonometry. $\endgroup$
    – Shailesh
    Aug 21, 2015 at 1:46

4 Answers 4


Consider what happens when we take a point $(x,y)$ and rotate it by an angle of $\theta$.

enter image description here

Using polar coordinates, we can write $(x,y) = (r\cos \phi,r\sin \phi)$ where $r$ is the distance from $(x,y)$ to the origin and $\phi$ is the angle made by the line from the origin to $(x,y)$ and the positive $x$-axis.

After rotating $(x,y)$ by an angle of $\theta$, the new point is still $r$ units away from the origin, but now, the angle made by the line from the origin to $(x',y')$ and the positive $x$-axis increases by $\theta$. Hence, $(x',y') = (r\cos(\phi+\theta),r\sin(\phi+\theta))$.

Now, let's use the cosine and sine sum of angle formulas to write $x'$ and $y'$ in terms of $x$ and $y$:

$$x' = r\cos(\phi+\theta) = r\cos\phi\cos\theta - r\sin\phi\sin\theta = x\cos\theta - y\sin\theta$$

$$y' = r\sin(\phi+\theta) = r\sin\phi\cos\theta + r\cos\phi\sin\theta = y\cos\theta + x\sin\theta$$

Putting this into matrix form gives us:

$$\begin{pmatrix}x' \\ y'\end{pmatrix} = \begin{pmatrix}\cos\theta & -\sin\theta\\ \sin\theta & \cos\theta\end{pmatrix}\begin{pmatrix}x \\ y\end{pmatrix}$$

Hence, the matrix which rotates a point by an angle of $\theta$ counterclockwise is $\begin{pmatrix}\cos\theta & -\sin\theta\\ \sin\theta & \cos\theta\end{pmatrix}$.

Remark: To add to what David C. Ullrich suggested, notice that the columns of this matrix $\begin{pmatrix}\cos\theta \\ \sin\theta \end{pmatrix}$ and $\begin{pmatrix}-\sin\theta\\ \cos\theta\end{pmatrix}$ are precisely the result of rotating the vectors $\begin{pmatrix}1 \\ 0 \end{pmatrix}$ and $\begin{pmatrix}0 \\ 1 \end{pmatrix}$ counterclockwise about the origin by an angle of $\theta$. This same property holds for other linear transformations. Specifically, the $j$-th column of the matrix of a transformation is the result of applying the transformation to the $j$-th basis vector.

  • $\begingroup$ Awesome answer. For rotating curves, it would be useful to note that $(x, y)$ can be thought of as the point obtained by rotating $(x', y') $ by *negative* $\theta$. Similar expressions could thus be obtained for x and y, which can be substituted into the original curve equation to obtain the rotated curve. $\endgroup$
    – harry
    Sep 18, 2021 at 6:11

Say $R_\theta(x,y)$ is $(x,y)$ rotated through an angle $\theta$. So $R_\theta$ is a map from $\Bbb R^2$ to itself.

First show that $R_\theta$ is linear. Showing that $R_\theta(cv)=cR_\theta(v)$ is more or less obvious. Showing that $R_\theta(v+w)=R_\theta(v)+R_\theta(w)$ uses the "definition" of the sum of two vectors in terms of those little parallelogram things. (If you rotate a parallelogram you get a parallelogram...)

So there is a matrix $M$ such that $R_\theta$ is given by multiplication by $M$. Now given a linear transformation $T:\Bbb R^2\to\Bbb R^2$ there's a formula somewhere in the book that says what the corresponding matrix is, in terms of $T((1,0))$ and $T((0,1))$. So you need to figure out $R_\theta(1,0)$ and $R_\theta(0,1)$. Plug them into that formula and out comes the matrix you want.


Consider an orthonormal basis ${\{v_1,v_2\}}$ in the plane. Say any object (e.g. a vector, shape etc.) in the plane is defined with respect to this basis - so if we can rotate the basis vectors through the angle $\theta$ anticlockwise, this will transform any such defined objects in the same way.

Firstly, note that the operation of rotation through $\theta$ about origin $O$ (let us call this operation $T$) is a linear transformation i.e. $T(\vec{v}+\vec{w})=T(\vec{v})+T(\vec{w})$ and $T(\alpha\vec{v})=\alpha T(\vec{v})$ for $\vec{v},\vec{w}\in\mathbb{R^2}, \alpha \in \mathbb{R}$. So we have linear $T:\mathbb{R^2}\rightarrow\mathbb{R^2}$. We then know that $T$ can be represented in matrix form as $(T(v_1),T(v_2))$ where $T(v_i)$, $i\in\{1,2\}$ is the transformed column vector. Then $T((x,y)^t)=xT(v_1)+yT(v_2), (x,y)\in\mathbb{R^2}$.

Any orthonormal basis ${\{v_1,v_2\}}$ corresponds exactly to the radial vector $\vec{e_r}=(cos\phi,sin\phi)$ and tangent vector $\vec{e_\perp}=(-sin\phi,cos\phi)$ of the unit circle with centre $O$ for some particular value of $\phi$. If we want to rotate this orthonormal pair of vectors through an angle of $\theta$, we perform $T(\vec{e_r})$ and $T(\vec{e_\perp})$. Well this is $T(\vec{e_r})=(cos(\phi+\theta),sin(\phi+\theta))$ and $T(\vec{e_\perp})=(-sin(\phi+\theta),cos(\phi+\theta))$. So we get,

$T = \begin{pmatrix} cos(\theta+\phi) & -sin(\theta+\phi) \\ sin(\theta+\phi) & cos(\theta+\phi) \end{pmatrix}$

Finally, note that when performing a rotation, we always consider the initial orthonormal basis via which we are working to be fixed at $\theta=0$ since this is our arbitrary way of navigating the plane and we do not consider the frame to be rotated to start with i.e. ${\{v_1,v_2\}}=\{\vec{i},\vec{j}\}$ (the natural/canonical basis), and this gives us our rotation matrix in the plane. Note that if we wish to rotate through $\theta$ in the clockwise direction instead (the non-canonical direction), all we have to do is set $\theta\rightarrow-\theta$ in $T$.

N.B. I have used $T$ to denote the rotation matrix here stemming from the fact that it is a linear transformation - but we usually use $R$ for rotation, $T$ for translation and $S$ for reflection (odd one out, originates from German verb strahlen).


I came up with a visual derivation of the equations for rotation in 2D:

Visual Derivation of Equations for Rotation in 2D

Or alternatively in SVG vector format: https://upload.wikimedia.org/wikipedia/commons/b/b7/Visual_Derivation_of_Equations_For_Rotation_In_2D.svg

Coordinate $(x, y)$ is the top-right corner of the original rectangle in salmon pink, while the coordinate $(x', y')$ rotated by angle theta appears at the top of the rotated red rectangle.

The components of $x'$ are $x \cdot \cos(\theta) - y \cdot \sin(\theta)$ marked in green, while the components of $y'$ are $y \cdot \cos(\theta) + x \cdot \sin(\theta)$ marked in blue.

This can be rewritten in matrix format as discussed in wltrup and JimmyK4542's post:

$$\begin{pmatrix}x' \\ y'\end{pmatrix} = \begin{pmatrix}\cos\theta & -\sin\theta\\ \sin\theta & \cos\theta\end{pmatrix}\begin{pmatrix}x \\ y\end{pmatrix}$$

Alternatively, there is an algebraic proof at: http://www.sunshine2k.de/articles/RotationDerivation.pdf


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .