Orthogonal Matrix

An orthogonal matrix is a $n x n$ matrix whose dot product with it's transpose returns an identify matrix. Mathematically, an orthogonal matrix is defined as:

$$ Q*Q^{T} = I $$

An orthogonal matrix has two specific properties:

  1. It's rows are mutually orthonormal. The means any row multiplied by itself equals 1. Any row multiplied by another row equals 0.
  2. It's columns are mutually orthonormal. This means any column multipled by itself equal 1. Any column multiplied by another column equals 0

An orthogonal matrix has some useful properties because it's transpose is also the inverse.

$$ Q^{T} = Q^{-1} $$

Example of Orthogonal Matrix

Here is an example of an orthogonal matrix $A$

$$ A = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix} $$

$$ A*A^{T} = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix} \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix} = \begin{pmatrix} 1*1 + 0*0 & 1*0 + 0*-1 \\ 0*1 + -1*0 & 0*0 + -1*-1 \end{pmatrix} = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix} $$

Implementation in Numpy

import numpy as np

A = np.array([1,0,0,-1]).reshape(2,2)
A
array([[ 1, 0], [ 0, -1]])

Returning the transpose

A.T
array([[ 1, 0], [ 0, -1]])

Returning the inverse

np.linalg.inv(A)
array([[ 1., 0.], [-0., -1.]])

Checking the dot product condition

A.dot(A.T)
array([[1, 0], [0, 1]])