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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm learning about the math invovled in PCA. For my purposes here, I'm just trying to understand a 90° rotation matrix. I get the concept of a rotation matrix, but when I look on wikipedia, the Wolfram Mathworld site, etc. I keep seeing the following defined as a 90° counter-clockwise rotation matrix:

|0 -1|
|1  0|

but when I actually do the math, I seem to get the point(s) rotated clockwise around the origin:

|1 2|     |0 -1|     |2 -1|
|3 4|  x  |1  0|  =  |4 -3|

Graphing the points (1,2) and (3,4), they're both in quadrant 1 (+,+). Graphing the resulting points, (2,-1) and (4,-3), they're both in quadrang 4 (+,-). The rotation works, but it seems clockwise, not counter-clockwise. What am I missing?

Note A friend suggested that it's the coordinate system that's being rotated, but the wolfram site (linked above) seems to explicitly exclude that from being the cause of my misunderstanding (see (1) and (3) on the wolfram site).

Any help greatly appreciated.

share|cite|improve this question
up vote 0 down vote accepted

I had posted this on stackoverflow where you had originally posted your question....

x'  =  | 0  -1 | * | x |
y'     | 1   0 |   | y |

So what you want is

x'  =  | 0  -1 | * | 1 |
y'     | 1   0 |   | 2 |  =  (-2, 1)

x'  =  | 0  -1 | * | 3 |
y'     | 1   0 |   | 4 |  =  (-4, 3)

If you plot that on a graph and draw a line between the two original points, and the two new points, and then draw a dotted line from the origin to the first point of each line, and then draw a 90 degree angle marker between the two dotted lines you will see that the 90 degree angle has rotated counter clockwise from the origin.

share|cite|improve this answer

You have your order of multiplication back-to-front. Borrowing from your example, try

|0 -1|     |1|     |-3|
|1  0|  x  |3|  =  | 1|

which I think you will find is anti-clockwise

share|cite|improve this answer

You are multipliying the wrong way.

The image of a point $x$ (a column vector) by a transformation matrix $M$ is the point $M x$, whereas the multiplication $x M$ doesn't mean anything.

So the image of the vector $(1,2)$ by your rotation matrix is the vector $(-2,1)$, and it is a counter-clockwise rotation.

share|cite|improve this answer
Different conventions are possible. A matrix can operate on column vectors by $c \to Mc$, but it can also operate on row vectors by $r \to rM$. A clockwise rotation on the row vectors will correspond to a counterclockwise rotation on the column vectors. The most common convention these days is to primarily use column vectors, with the matrices on the left, but e.g. Herstein "Topics in Algebra" uses row vectors, with the matrices on the right. – Robert Israel Mar 25 '11 at 16:10
@Robert Israel: In that case, if you are given an anticlockwise rotation matrix designed for $c \to Mc$ then you will need to transpose it if you wish to use it for $r \to rM$. – Henry Mar 25 '11 at 16:41
you can multiply on the left (rows as opposed to columns) – yoyo Mar 25 '11 at 17:29

Here is a short answer: Let $R\in \Re^{2\times 2}$ be a rotation matrix, and $v\in \Re^2$ be a vector. If $R$ rotates $v$ clockwise by $\theta$ degrees. Then $R^T$ can rotate $v$ anticlockwise by $\theta$ degrees.

This is based on the basic property of a rotation matrix: $RR^T=R^TR=I$. In addition, a rotation matrix has many representations. One is to use a rotation angle and a rotation axis to describe a rotation. See Rodrigues' rotation formula. it should be noted that a 2 by 2 rotation matrix is not a "real" rotation matrix since its rotation axis is the $z$ axis which is already not on the plane. And the rotation direction obeys the right hand rule is regarded as positive.

Finally, your friends may not be wrong. Rotating a vector in a coordinate frame is different from rotating a coordinate frame. For the latter, there are two coordinate frames.

share|cite|improve this answer

one convention is to use columns not rows, ie to rotate $\theta$ counter clockwise, the vector $(1,0)$ goes to $(\cos\theta,\sin\theta)$ and $(0,1)$ goes to $(-\sin\theta, \cos\theta)$. the matrix for this is (in the convention $Ax=b$ using column vectors) $$\left( \begin{array}{cc} \cos\theta&-\sin\theta\\ \sin\theta&\cos\theta\\ \end{array} \right) \left( \begin{array}{c} x_1\\ y_1\\ \end{array} \right) = \left( \begin{array}{c} x_2\\ y_2\\ \end{array} \right) $$ if you want to use row vectors you get $$ \left( \begin{array}{cc} x_1&y_1\\ \end{array} \right) \left( \begin{array}{cc} \cos\theta&\sin\theta\\ -\sin\theta&\cos\theta\\ \end{array} \right) = \left( \begin{array}{cc} x_2&y_2\\ \end{array} \right) $$

share|cite|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.