Differences between revisions 1 and 7 (spanning 6 versions)
Revision 1 as of 2021-09-14 15:49:24
Size: 1019
Comment:
Revision 7 as of 2024-01-21 17:51:51
Size: 2092
Comment: Expanded on permutations, removed properties
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:

These '''special matrices''' are core concepts to linear algebra.

<<TableOfContents>>

----

Line 5: Line 13:
The '''identity matrix''' multiplied by matrix A returns matrix A. The '''identity matrix''' is a diagonal line of 1s in a matrix of 0s.
Line 7: Line 15:
This matrix is simply a diagonal line of 1s in a matrix of 0s. Any matrix A multiplied by the (appropriately sized) identity matrix returns matrix A.
Line 10: Line 18:
┌ ┐
│ 1 0 0│
│ 0 1 0│
│ 0 0 1│
└ ┘
julia> using LinearAlgebra

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

----
Line 19: Line 31:
== Permutation Matrix == == Permutation Matrices ==
Line 21: Line 33:
The '''permutation matrix''' multiplied by matrix A returns matrix C which is a mirrored transformation of A.

This matrix is simply a diagonal line of 1s in a matrix of 0s, but going the opposite direction as compared to an identity matrix
A '''permutation matrix''' multiplied by matrix A returns a row- or column-exchanged transformation of A. If the permutation matrix leads in the multiplication, rows are exchanged. If the permutation matrix follows, columns are exchanged.
Line 26: Line 36:
┌ ┐
│ 0 0 1│
│ 0 1 0│
│ 1 0 0│
└ ┘
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
Line 33: Line 61:
Note that a permutation matrix can mirror either the rows or columns of matrix A, depending simply on the order. The transpose permutation matrix is the same as the inverse permutation matrix: P^T^ = P^-1^.

The transpose permutation matrix multiplied by the permutation matrix is the same as the identity matrix: P^T^P = I



=== Counting Permutations ===

For 3 by 3 matrices, there are 6 possible permutation matrices. They are often denoted based on the rows they exchange, such as P,,2 3,,.
Line 36: Line 72:
┌ ┐┌ ┐ ┌ ┐
│ 0 1│| 1 2| | 3 4|
│ 1 0│| 3 4|=| 1 2|
└ ┘└ ┘ └ ┘
┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐ ┌ ┐
│ 1 0 0│ │ 1 0 0│ │ 0 1 0│ │ 0 1 0│ │ 0 0 1│ │ 0 0 1│
│ 0 1 0│ │ 0 0 1│ │ 1 0 0│ │ 0 0 1│ │ 1 0 0│ │ 0 1 0│
│ 0 0 1│ │ 0 1 0│ │ 0 0 1│ │ 1 0 0│ │ 0 1 0│ │ 1 0 0│
└ ┘ └ ┘ └ ┘ └ ┘ └ ┘ └ ┘
(identity matrix) P P (and so on...)
                     2,3 1,2
}}}
Line 41: Line 81:
┌ ┐┌ ┐ ┌ ┐
| 1 2|│ 0 1│ | 2 1|
| 3 4|│ 1 0│=| 4 3|
└ ┘└ ┘ └ ┘
}}}
For any ''n'' by ''n'' matrix, there are ''n''! possible permutation matrices.

Special Matrices

These special matrices are core concepts to linear algebra.


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. If the permutation matrix leads in the multiplication, rows are exchanged. If the permutation matrix follows, columns are exchanged.

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

The transpose permutation matrix is the same as the inverse permutation matrix: PT = P-1.

The transpose permutation matrix multiplied by the permutation matrix is the same as the identity matrix: PTP = I

Counting Permutations

For 3 by 3 matrices, there are 6 possible permutation matrices. They are often denoted based on the rows they exchange, such as P2 3.

┌      ┐          ┌      ┐ ┌      ┐ ┌      ┐ ┌      ┐ ┌      ┐
│ 1 0 0│          │ 1 0 0│ │ 0 1 0│ │ 0 1 0│ │ 0 0 1│ │ 0 0 1│
│ 0 1 0│          │ 0 0 1│ │ 1 0 0│ │ 0 0 1│ │ 1 0 0│ │ 0 1 0│
│ 0 0 1│          │ 0 1 0│ │ 0 0 1│ │ 1 0 0│ │ 0 1 0│ │ 1 0 0│
└      ┘          └      ┘ └      ┘ └      ┘ └      ┘ └      ┘
(identity matrix)   P        P        (and so on...)
                     2,3      1,2

For any n by n matrix, there are n! possible permutation matrices.


CategoryRicottone

LinearAlgebra/SpecialMatrices (last edited 2024-01-30 15:45:39 by DominicRicottone)