A square matrix $A \in \mathbb{R}^{n \times n}$ is an orthogonal matrix if and only if its columns are orthonormal so that
$AA^T=A^TA=I$ which implies that $A^{-1}=A^T$
Transformations by orthogonal matrices are special because the length of a vector $x$ is not changed when transforming it using an orthogonal matrix A.For the dot product we obtain
$\left \| Ax \right \|^2= (Ax)^T(Ax)=x^TA^TAx=x^TIx=x^Tx=\left \| x \right \|^2$
Moreover the angle between two vectors $x,y$ is unchanged when transforming both of them using an orthogonal matrix A
$cos \omega=\frac{(Ax)^T(Ay)}{\left \| Ax \right \| \left \| Ay \right \|}=\frac{x^TA^TAy}{\sqrt{x^TA^TAxy^TA^TAy}}=\frac{x^Ty}{\left \| x \right \| \left \| y \right \|}$
This means that orthogonal matrices A with $A^T=A^{-1}$ preserve both angles and distances.
Eg: The rotation matrix
$\begin{bmatrix}cos \theta & -sin \theta\\
sin \theta & cos \theta
\end{bmatrix}$
import numpy as np
B=np.array([[1/np.sqrt(2),1/np.sqrt(2)],[1/np.sqrt(2),-1/np.sqrt(2)]])
print("Orthogonal Matrix B")
print(B)
print("B Inverse")
print(np.linalg.inv(B))
print("B Transpose")
print(B.T)
print("B x B.T= I")
print(B.dot(B.T))
Orthogonal Matrix B
[[ 0.70710678 0.70710678]
[ 0.70710678 -0.70710678]]
B Inverse
[[ 0.70710678 0.70710678]
[ 0.70710678 -0.70710678]]
B Transpose
[[ 0.70710678 0.70710678]
[ 0.70710678 -0.70710678]]
B x B.T= I
[[1. 0.]
[0. 1.]]
rotate the vector
$x_1=\begin{bmatrix}
2 \\
3
\end{bmatrix}$
$x_2=\begin{bmatrix}
0 \\
-1
\end{bmatrix}$ by $30^{\circ}$
cos 30 & -sin 30\\
sin 30 & cos 30
\end{bmatrix}.\begin{bmatrix}2\\
3
\end{bmatrix}$
$\begin{bmatrix}
\frac{\sqrt{3}}{2}& -1/2\\
1/2 & \frac{\sqrt{3}}{2} \\
\end{bmatrix}.\begin{bmatrix}2\\
3
\end{bmatrix}=\frac{1}{2}\begin{bmatrix}2\sqrt{3}-3\\
2+3\sqrt{3}
\end{bmatrix}$
$\begin{bmatrix}
\frac{\sqrt{3}}{2}& -1/2\\
1/2 & \frac{\sqrt{3}}{2} \\
\end{bmatrix}.\begin{bmatrix}0\\
-1
\end{bmatrix}=\frac{1}{2}\begin{bmatrix}1\\
-\sqrt{3}
\end{bmatrix}$
\frac{\sqrt{3}}{2}& -1/2\\
1/2 & \frac{\sqrt{3}}{2} \\
\end{bmatrix}.\begin{bmatrix}0\\
-1
\end{bmatrix}=\frac{1}{2}\begin{bmatrix}1\\
-\sqrt{3}
\end{bmatrix}$
Comments
Post a Comment