Special Matrices


Identity Matrix

The identity matrix is a diagonal line of 1s in a matrix of 0s.

Any matrix A multiplied by the (appropriately sized) identity matrix returns matrix A.

julia> using LinearAlgebra

julia> Matrix{Int8}(I,3,3)
3×3 Matrix{Int8}:
 1  0  0
 0  1  0
 0  0  1


Permutation Matrices

A permutation matrix multiplied by matrix A returns a row- or column-exchanged transformation of A, depending on the order of multiplication.

julia> P = Matrix{Int8}(I,3,3)[:,[3,2,1]]
3×3 Matrix{Int8}:
 0  0  1
 0  1  0
 1  0  0

julia> A = [1 2 3; 4 5 6; 7 8 9]
3×3 Matrix{Int64}:
 1  2  3
 4  5  6
 7  8  9

julia> P * A
3×3 Matrix{Int64}:
 7  8  9
 4  5  6
 1  2  3

julia> A * P
3×3 Matrix{Int64}:
 3  2  1
 6  5  4
 9  8  7

See Permutation Matrices for more information.


Inverse Matrices

An inverse matrix A-1 multiplied by matrix A returns the identity matrix.

If A-1 exists, then A is invertible and non-singular. Not all matrices are invertible.

See Matrix Inversion for more information.


Symmetric Matrices

A symmetric matrix is any matrix that is equal to its transpose.

julia> A = [1 2; 2 1]
2×2 Matrix{Int64}:
 1  2
 2  1

julia> A == A'
true

See Symmetric Matrices for more information.


CategoryRicottone