I am a Software Development Engineer in Test working for the Windows Sound team. You can contact me via email: mateer at microsoft dot com
Friend key: 28904932216450_59cd9d55374be03d8167d37c8ff4196b
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 [ 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 = (rij)i,j∈{1...n} which has the property that RA = B = (bij)i,j∈{1...n} is the rotated version of A for any n x n matrix A = (aij)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, a1,1 = 1, and aij = 0 for all other combinations of i and j.
To be the rotated version of this matrix, B should have bn1 = 1 and bij = 0 for all other combinations of i and j. (My coordinates are such that bn1 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 bn1 = r1,1an1 + r2,1an2 + ... + rn1ann. At first blush, this looks fine... until we realize that bn1 is 1, and all of the anj are 0... so we have the contradiction
1 = r1,10 + r2,10 + ... + rn10 = 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.