Thursday, August 29, 2024

Matrices+ 01 - Matrix as Operator: UNIZOR.COM - Math+ & Problems - Matrices

Notes to a video lecture on http://www.unizor.com

Matrices+ 01
Matrix as Operator


In the beginning matrices were just tables of real numbers with m rows and n columns, we called them mn matrices.
We knew how to add two matrices with the same numbers of rows and columns, how to multiply a matrix by a scalar number and how to multiply an mn matrix by an nk matrix.

Here is a short recap.

Addition of matrices
Let Am⨯n be an mn matrix with elements ai,j, where the first index signifies the row, where this element is located and the second index is a column.
Let Bm⨯n be another mn matrix with elements bi,j.
Then a new matrix C=A+B is an mn matrix with elements ci,j=ai,j+bi,j.

Multiplication of a matrix by a scalar
Let s be any real number (scalar) and Am⨯n be an mn matrix with elements ai,j.
Multiplication of s by Am⨯n produces a new matrix Bm⨯n with elements bi,j=s·ai,j.
Obviously, since the product of numbers is commutative and associative, the product of a matrix by a scalar is commutative, and the product of a matrix by two scalars is associative.

Product of two matrices
Let Am⨯n be an mn matrix with elements ai,j.
Let Bn⨯k be an nk matrix with elements bi,j.
It's important for a definition of a product of matrices that the number of columns in the first matrix Am⨯n equals to a number of rows in the second Bn⨯k (in our case this number is n.)
The product Cm⨯k of Am⨯n and Bn⨯k is mk matrix with elements cp,q calculated as sums of products of n elements of pth row of matrix Am⨯n by n elements of qth column of matrix Bn⨯k
p∈[1,m], ∀q∈[1,k]:
cp,q = Σ[1≤t≤n]ap,t·bt,q
It's important to note that, generally speaking, multiplication of two matrices IS NOT commutative, see Problem C below.
The product of three matrices, however, is associative, see Problem B below.

For our purposes we will only consider "square" matrices with the same number of rows and columns n and n-dimensional Euclidean vector space of sequences of n real numbers organized in a row (row-vector, which can be viewed as 1n matrix) or in a column (column-vector, which can be viewed as n1 matrix).

What happens if we multiply an nn matrix by a column-vector, which we can consider as an n1 matrix, according to the rules of multiplication of two matrices?
In theory, the multiplication is possible because the number of columns in the first matrix n equals to the number of rows in the second one (the same n) and, according to the rules of multiplication, the resulting matrix should have the number of rows of the first matrix n and the number of columns of the second one, that is 1. So, the result is an n1 matrix, that is a column-vector.

As we see, multiplication of our nn matrix by a column-vector with n rows results in another column-vector with n row.
In other word, multiplication by nn matrix on the left transforms one column-vector into another, that is this multiplication represents an operation in n-dimensional vector space of column-vectors. The nn matrix itself, therefore, acts as an operator in the vector space of column-vectors of n components.

Similar operations can be considered with row-vectors and their multiplication by matrices. The only difference is the order of this multiplication.
In a case of column-vectors we multiplied nn matrix by n1 column-vector getting another n1 column-vector.
In case of row-vectors, we change the order and multiply a 1n row-vector by nn matrix on the right, getting another 1n row-vector.
Therefore, an nn matrix can be considered an operator in a vector space of row-vectors, if we apply the multiplication by matrix from the right.

Let's examine the properties of the transformation of n1 column-vectors by multiplying them by nn matrices.

Problem A
Prove that multiplication by an nn matrix is a linear transformation in the n-dimensional Euclidean space ℝn of n1 column-vectors.
(a) ∀u∈ℝn, ∀ K∈ℝ, ∀An⨯n:
A·(K·u) = K·(A·u) = (K·A)·u
(b) ∀u,v∈ℝn, ∀An⨯n:
A·(u+v) = A·u + A·v
(c) ∀u∈ℝn, ∀An⨯n,Bn⨯n:
(A+B)·u = A·u + B·u

Hint A
The proof is easily obtained straight from the definition of matrix multiplications.


Problem B
Prove that consecutive multiplication by two nn matrices is associative in the n-dimensional Euclidean space ℝn of n1 column-vectors.
u∈ℝn, ∀An⨯n,Bn⨯n:
A·(B·u) = (A·B)·u

Hint B
It's all about changing of an order of summation.
Let's demonstrate it for n=2.

Given two matrices A and B and a column-vector u.

Matrix A
a1,1a1,2
a2,1a2,2

Matrix B
b1,1b1,2
b2,1b2,2

Column-vector u
u1
u2

Let v=B·u and w=A·(B·u)=A·v
Then column-vector v's components are
v1 = b1,1·u1 + b1,2·u2
v2 = b2,1·u1 + b2,2·u2

The components of vector w are
w1 = a1,1·v1 + a1,2·v2 =
= a1,1·(b1,1·u1 + b1,2·u2) +
+ a1,2·(b2,1·u1 + b2,2·u2) =
= a1,1·b1,1·u1 + a1,1·b1,2·u2 +
+ a1,2·b2,1·u1 + a1,2·b2,2·u2 =
= (a1,1·b1,1 + a1,2·b2,1)·u1 +
+ (a1,1·b1,2 + a1,2·b2,2)·u2


w2 = a2,1·v1 + a2,2·v2 =
= a2,1·(b1,1·u1 + b1,2·u2) +
+ a2,2·(b2,1·u1 + b2,2·u2) =
= a2,1·b1,1·u1 + a2,1·b1,2·u2 +
+ a2,2·b2,1·u1 + a2,2·b2,2·u2 =
= (a2,1·b1,1 + a2,2·b2,1)·u1 +
+ (a2,1·b1,2 + a2,2·b2,2)·u2


Let's calculate the product of two matrices A·B
Matrix A·B:
a1,1·b1,1+a1,2·b2,1a1,1·b1,2+a1,2·b2,2
a2,1·b1,1+a2,2·b2,1a2,1·b1,2+a2,2·b2,2

Notice that coefficients at u1 and u2 in expression for w1 above are the same as elements of the table (A·B) of the first row.
Analogously, coefficients at u1 and u2 in expression for w2 above are the same as elements of the table (A·B) of the second row.
That means that, if we multiply matrix (A·B) by a column-vector u, we will get the same vector w as above.
That proves the associativity for a two-dimensional case.

Problem C
Prove that consecutive multiplication by two nn matrices, generally speaking, IS NOT commutative.
That is, in general,
(A·B)·u) ≠ (B·A)·u

Proof C
To prove it, it is sufficient to present a particular case when a product of two matrices is not commutative.

Consider matrix A
12
34

Matrix B
−12
−34

Then matrix A·B will be
−710
−1522

Reverse multiplication B·A will be
56
910

As you see, matrices A·B and B·A are completely different, and, obviously, their product with most vectors will produce different results.
Take a vector with components (1,0), for example. Matrix A·B will transform it into (−7,−15), while matrix B·A will transform it into (5,9).
End of Proof.

No comments: