Discrete Wavelets

022 - Basic Matrix Arithmetic

Helmut  Knaust - Department of Mathematical Sciences, University of Texas at El Paso, hknaust@utep.edu
01/22/2009; last edited 1/19/2026

Defining matrices

A={{1,2,3},{2,0,1}}
B={{0,2,-3},{1,2,-6}}

StandardForm[A]

MatrixForm[A]

d={{0,1},{1,3}}

Other useful ways to define a matrix

matrix=Array[a,{3,2}]

matrix=RandomInteger[{0,255},{3,4}]

f[r_,c_]=10r+c
f[2,3]
matrix=Array[f,{3,4}]

matrix=Table[10r+c,{r,1,3},{c,1,4}]

Extracting elements, rows and columns

A
A[[1, 3]]

A[[2]]

A[[All, 3]]

A2 = A[[1;; 2, 2;;3]]

Listing a matrix' s dimensions

Dimensions[A]
Dimensions[A2]

Matrix addition, subtraction and scalar multiplication

A+B

A-B

Sqrt[2](A-B)

Sqrt[2.](A-B)

Matrix multiplication

A
B={{0,2,4,-1},{-3,1,2,0},{-3,-6,1,1}}

Dimensions[A]
Dimensions[B]
Dimensions[A.B]

A.B

This is the definition of matrix multiplication :

Table[Sum[A[[i,j]] B[[j,k]],{j,1,3}],{i,1,2},{k,1,4}]

The identity matrix

I3=IdentityMatrix[3]
I4=IdentityMatrix[4]

A.I3
A==A.I3
B
B==I3.B

The inverse matrix of a square matrix

A={{1,2,3},{-2,3,0},{1,0,4}}

B=Inverse[A]

A.B
B.A

Not every matrix has an inverse :

A={{1,-1,3},{-2,1,-5},{1,0,2}}

Inverse[A]

Det[A]

Solving linear equations

A={{1,2,3},{-2,3,0},{1,0,4}}
b={{1},{2},{3}}

x=Inverse[A].b
A.x
A.x==b

The transpose of a matrix

A={{1,2,3},{2,0,1}}

Transpose[A]

Symmetric matrices

A={{1,2,3},{2,-3,1},{3,1,0}}

Transpose[A]

The sum of a square matrix and its transpose is symmetric :

A={{1,2,3},{4,5,6},{3,-3,0}}

A+Transpose[A]

Orthogonal matrices

A={{Sqrt[3]/2,1/2,0},{-1/2,Sqrt[3]/2,0},{0,0,1}}

A.Transpose[A]

x={1,2,3}

Norm[x]
Norm[A.x]

Simplify[Norm[A.x]]