# rotating a matrix

Given a rectangular matrix $A$, what is the general form to rotate the matrix about the center term, e.g. such that

$$\pmatrix{a_{0,0} & a_{0,1} & a_{0,2} \\ a_{1,0} & a_{1,1} & a_{1,2} \\ a_{2,0} & a_{2,1} & a_{2,2}}\longrightarrow\pmatrix{a_{0,2} & a_{1,2} & a_{2,2} \\ a_{0,1} & a_{1,1} & a_{2,1} \\ a_{0,0} & a_{1,0} & a_{2,0}}$$

and possibly the reverse case as well.

-
XKCD may be helpful in solving this question. xkcd.com/184 –  akkkk Apr 17 '12 at 21:52
@Auke no its not –  gardian06 Apr 17 '12 at 21:54

$$\pmatrix{0 & 0 & 1 \\ 0 & 1 & 0 \\ 1 & 0 & 0}A^T = \pmatrix{a_{0,2} & a_{1,2} & a_{2,2} \\ a_{0,1} & a_{1,1} & a_{2,1} \\ a_{0,0} & a_{1,0} & a_{2,0}} =A_r$$
$$A_r^T \pmatrix{0 & 0 & 1 \\ 0 & 1 & 0 \\ 1 & 0 & 0} = \pmatrix{a_{0,0} & a_{0,1} & a_{0,2} \\ a_{1,0} & a_{1,1} & a_{1,2} \\ a_{2,0} & a_{2,1} & a_{2,2}} = A$$