# Rotating a Matrix by an angle

So I have a matrix like so

\begin{pmatrix} x_0 & x_1 & x_2 & x_3 \\ y_0 & y_1 & y_2 & y_3 \end{pmatrix}

And I need rotate the matrix by an angle - for say $45$ degrees.

I read that the rotation matrix is

\begin{pmatrix} \cos(45^\circ) & \sin(45^\circ) & \\ -\sin(45^\circ) & \cos(45^\circ) \\ \end{pmatrix}

Now my question is how do I apply that to my matrix? I mean in the rotation matrix there are 2 elements for $x$ and $2$ for y and I don't know to while elements in my matrix apply which $x$ or $y$ elements from the rotation matrix..

-

Rotation of point $(x,y)$ in a plane is two mapping like this: $u = f(x,y)$ and $v=g(x,y)$

here $$u = \begin{bmatrix} \cos(45^0) & \sin(45^0) \end{bmatrix} . \begin{bmatrix} x \\ y \end{bmatrix} =\frac1{\sqrt2}(x+y)$$

and similarly $$v = \begin{bmatrix} -\sin(45^0) & \cos(45^0) \end{bmatrix} . \begin{bmatrix} x \\ y \end{bmatrix} = \frac1{\sqrt2}(y-x)$$

So when you want to rotate many points, first you store them in a matrix like : $$X =\begin{pmatrix} x_0 & x_1 & x_2 & x_3 \\ y_0 & y_1 & y_2 & y_3 \end{pmatrix}$$ then multiply the rotation matrix from left by matrix of points ($RX$).

This could be considered rotation of several points

-
A minor correction: you either "multiply the rotation matrix from right by matrix of points", or you "multiply matrix of points from left by the rotation matrix". – Vedran Šego Jul 23 '13 at 12:01
@VedranŠego If you think I am wrong correct it please. But I think I'm right! Since rotation is a left multiplication – Mahdi Khosravi Jul 23 '13 at 12:05
(cos(45) * sin(45)) * (x/y) is that what you mean? by the first one? – gopgop Jul 23 '13 at 12:16
@MahdiKhosravi If $R$ is a rotation matrix and $X$ is a matrix of vectors, then what the OP wants is $RX$, and I think we agree on that. But, when you say "multiply $R$ from left by $X$", it sounds (at least to me) like $XR$. I won't edit your answer if you think that it's correct. There is no reason for me to believe I'm any more of an authority on the language than you are. However, you might consider writing it with $R$, $X$ and $RX$, so there is no confusion. – Vedran Šego Jul 23 '13 at 12:54