HOME Mathematics Computer Science
Identity Matrices
Prerequisites
Show All
Hide All
Matrices
Show/Hide

Definition
A matrix is a rectangular group of numbers (or symbols) with a given number of rows and columns.
Example

The following matrix has two rows and three columns, and is described as a "two by three" (2x3) matrix.

LaTeX
\begin{bmatrix}
    3 & 6 & 2  \\
    5 & 1 & 10
\end{bmatrix}
Notation
  • There are a few different ways to represent a matrix. The easiest is with an bold uppercase letter: A
Code
A = [[3, 6, 2], [5, 1, 10]]

print(A)
Notes
  • The plural of matrix is matrices.
  • The size of a matrix is called its dimension or order. It is written with as rows x columns. A matrix with 2 rows and 3 columns is written as 2x3.
  • Two matrices are considered equal if and only if:
    • They have the same number of rows.
    • They have the same number of columns.
    • Each corresponding element is equal. i.e. x111 = x211
  • The numpy.matrix is depreciated, in favour of regular arrays
Matrix Transposition
Show/Hide

Introduction
  • Matrix Transposition is an operation that converts one matrix into another.
  • Each row in the original matrix is used as a column in the transposed matrix.
Notation
There are two main notations used to show that a matrix is transposed:
  • Using a prime: the transpose of matrix A is A'
  • Using a T superscript: the tranpose of matrix A is AT
Example
Code
import numpy as np

a = np.matrix([[3, 6, 2], [5, 1, 10]])
print(a)

transposed = a.transpose()
print(transposed)
Notes
  • The order (or dimension) of a matrix is switched when transposing, i.e. a 3x2 matrix creates a 2x3 matrix.
Symmetric Matrices
Show/Hide

Introduction
A symmetric matrix is a matrix whose transpose is equal to itself.
Example

In the following example, both A and A' equal the same matrix:

Diagonal and Scalar Matrices
Show/Hide

Diagonal Matrices
A diagonal matrix is a type of symmetric matrix in which every element is set to 0 apart from the main diagonal.
Example
Scalar Matrices
A scalar matrix is a type of diagonal matrix in which every element along the diagonal is equal, while every other element is set to 0.
Example

Identity Matrices

Introduction
An identity matrix is a special type of scalar matrix in which all elements along the main diagonal are equal to 1 and all other elements are 0.
Example
Code
import numpy as np

a = np.identity(4)
print(a)