I am not a matrix geek or something. I just remeber a couple of things from the university math classes. Maybe the explanation is simple.
What's going on: I go through a code of a certain game and an interesting mathematical matrix property appeared when I played with some functions.
Notation: $m×n$ matrix means $m$-row $n$-column matrix.
Here we go. We have a $4\times4$ matrix $A$ that contains following elements:
- A 3D general rotation matrix $B$ ($3\times3$) in left upper positions of $A$
$B = \begin{bmatrix}a&b&c\\d&e&f\\g&h&i\end{bmatrix}$
2. A random vector $aa$ ($1×3$) in left lower positions of $A$
$aa = \begin{bmatrix}x&y&z\end{bmatrix}$
3. An additional vector $bb$ ($4×1$) in right positions of $A$
$bb = \begin{bmatrix}0\\0\\0\\1\end{bmatrix}$
It seems (by inspecting resulting numbers) that always when the matrix $A$ is invertible and we calculate its inverse $C$, then $C$ has this form:
- The transpose of the rotation matrix $B$ ($3\times3$) in left upper positions of $C$
$B^T = \begin{bmatrix}a&d&g\\b&e&h\\c&f&i\end{bmatrix}$
2. A vector $cc$ generally different from the vector $aa$ ($1\times3$) in left lower positions of $C$
$cc = \begin{bmatrix}t&u&v\end{bmatrix}$
3. An unchanged additional vector $bb$ ($4\times1$) in right positions of $C$
$bb = \begin{bmatrix}0\\0\\0\\1\end{bmatrix}$
So, from \begin{bmatrix}a&b&c&0\\d&e&f&0\\g&h&i&0\\x&y&z&1\end{bmatrix}
we get the inverse \begin{bmatrix}a&d&g&0\\b&e&h&0\\c&f&i&0\\t&u&v&1\end{bmatrix}
How can this be explained? Is there a simple proof of this or will that be hard?
Thank you for any answers!
This is commonplace in computer science. The CS guys like to store a rigid motion $x\mapsto xA+b$ (here $x$ and $b$ are row vectors) in a single matrix $\pmatrix{A&0\\ b&1}$ and encode each 3D vector $x$ as a $4$-vector $\pmatrix{x&1}$, so that the rigid motion can be computed as a single matrix-vector multiplication $\pmatrix{xA+b&1}=\pmatrix{x&1}\pmatrix{A&0\\ b&1}$. And since we are talking about rigid motions, the matrix $A$ must be real orthogonal, i.e. $A^T=A^{-1}$. Geometrically, this means $A$ is composed of rotations and/or reflections.
If you want to invert the rigid motion, it is easy to verify that $\pmatrix{A&0\\ b&1}^{-1}=\pmatrix{A^{-1}&0\\ -bA^{-1}&1}$. As $A$ is orthogonal, we get $\pmatrix{A&0\\ b&1}^{-1}=\pmatrix{A^T&0\\ -bA^T&1}$ as a result.