Vincent Tan picked up on Raymond Chen’s “rotate a matrix” interview post.

As Vincent Tan points out, there is no way to create an *n* x *n* matrix *R* such that *RA* is a rotated version of *A* – for example, in the 2 x 2 case:

*R*such that

R [ a b ] = [ b a ]

[ c d ] [ c d ]

Vincent Tan points out that such an *R* would entail hidden assumptions but asks for a simpler proof.

Here it is. I’ll go back to the *n* by *n* case, assuming *n* >= 2. (The 0 x 0 case and the 1 x 1 case are actually trivially solvable using the identity matrix.)

Assume there is such a matrix *R* = (*r _{ij}*)

_{i,j∈{1…n}}which has the property that

*RA*=

*B*= (

*b*)

_{ij}_{i,j∈{1…n} }is the rotated version of

*A*for any

*n*x

*n*matrix

*A =*(

*a*)

_{ij}_{i,j∈{1…n}}

*.*

To see that this is impossible, consider the matrix with a 1 in the upper-left-hand corner and zeros everywhere else; that is, *a*_{1,1} = 1, and *a _{ij}* = 0 for all other combinations of

*i*and

*j*.

To be the rotated version of this matrix, *B*_{} should have *b _{n}*

_{1}= 1 and

*b*= 0 for all other combinations of

_{ij}*i*and

*j*. (My coordinates are such that

*b*

_{n}_{1 }is the number in the top right corner of the matrix.)

But how did that 1 get in the top right hand corner? The rules of matrix multiplication imply that *b _{n}*

_{1}=

*r*

_{1,1}

*a*

_{n}_{1}+

*r*

_{2,1}

*a*

_{n}_{2}+

*… + r*

_{n1}

*a*. At first blush, this looks fine… until we realize that

_{nn}*b*

_{n}_{1 }is 1, and all of the

*a*are 0… so we have the contradiction

_{nj }1 = *r*_{1,1}0 + *r*_{2,1}0 + *… + r*_{n1}0 = 0

QED.

But this is not how rotation matrices are applied. Rotation matrices *R* are not applied as *RA* = *B*; instead, they’re applied as *RAR*^{-1} = *B*. Not that this helps our hapless interviewee; the operation being asked of him (“rotate a matrix”) can’t be done by a rotation matrix anyway. That is, there is no magic matrix *R* that works under this operation either.

EDIT: A simple way to prove that *RAR*^{-1} = *B *doesn’t work either (for *n* >= 2) is to think about what happens when you choose *A* to be the identity matrix *I* (the matrix with 1’s on the main diagonal [*i* = *j*] and 0’s everywhere else.)

*RIR*^{-1} = *RR*^{-1} = *I*; and for *n* >= 2, *I* is not its own “rotation.”

We therefore arrive at the paradoxical result that you can’t rotate a matrix via matrix rotation.

That is indeed a much better proof than mine. I didn’t think of using a further explicit example to use as the matrix A. Thanks!

And I applaud you for the proper math notations used! I was balking at the amount of subscripts and superscripts I would have to type…