Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Matrix operations
Matrices
Two ways to denote m n matrix A (m rows, n column).
In terms of the columns of A:
A=
In terms of the entries of A:
a1
a2
an
a11
a21
A= .
..
a12
a22
..
.
..
.
a1n
a2n
..
.
am1
am2
amn
a1j
a2j
aj = .
..
amj
Main diagonal entries: a11 , a22 , . . ., amm (only care about these when m = n)
Even more notation
Zero matrix:
0
..
.
0=
0
.
..
0
1
0
..
.
0
..
.
0
0
..
.
..
.
0
Definition. Let A = a1
scalar. Then
an , B = b1
a2
b2
bn be m n-matrices and let r be a
A + B is defined by
A + B = a1 + b1
a2 + b2
...
an + bn
Moreover, rA is defined as
rA = ra1
ra2
...
ran
Example 1. Calculate
1
5
0
2 3
3 3
+
=
2
3 1
8 3
2 3
20 30
10
=
3 1
30 10
.
.
.
.
am1 am2 amn
bm1 bm2
then indeed
a11 + b11
a12 + b12 a1n + b1n
a21 + b21
a22 + b22 a2n + b2n
A+B =
.
..
..
..
..
.
.
.
.
am1 + bm1 am2 + bm2 amn + bmn
of matrices
b1n
b2n
.. ,
..
.
.
bmn
1
2
1
2
Matrix Multiplication
Definition. Let x be a vector in Rn and A = a1
...
an an m n-matrix. We define Ax by
Ax = x1 a1 + x2 a2 + . . . + xn an .
Remark.
It is important to realize that Ax is a linear combination of the columns of A that uses the
corresponding entries in x as weights.
The product Ax is only defined if the number of entries of x is equal to the number of columns
of A.
Example 3. Consider
2
A=
1
0
,
1
1
B = 0
3
2
1 ,
5
2
x=
3
Solution.
Ax =
2
1
1
Bx = 0
3
0 2
2
0
4
=2
+3
=
1 3
1
1
5
2
1
2
8
2
1
= 2 0 + 3 1 = 3
3
5
3
5
21
1
2
3
3
and x =
. Then
4
1
Ax =
1
2
3 x1
1
3
= x1
+ x2
.
4 x2
2
4
A matrix is a machine
Let A be a m n matrix. So n columns, m rows. How is it a machine?
Input: n-component vector x Rn .
Output: m-component vector b = Ax Rm .
x
Ax
b .
0
1
1
. What does this machine do?
0
Solution.
x
Let x = 1 be our input.
x2
Ax =
0
1
1 x1
0
1
x
= x1
+ x2
= 2 .
0 x2
1
0
x1
So the machine A switches the entries of the vector x. Geometrically speaking, this machine reflects
across the x1 = x2 -line.
1 0
Example 6. Consider the matrix B =
. What does this machine do?
0 0
Solution.
x
Let x = 1 be our input.
x2
1
Bx =
0
0
0
x1
1
0
x
= x1
+ x2
= 1 .
x2
0
0
0
So the machine B replace the second entry of the vector x by 0. Geometrically speaking, this machine
projects a vector onto the x1 -axis.
Composition of machines. Let A be an m n matrix and B be an k l matrix. Now we can
compose the two machines:
x
Ax
B(Ax)
B
1
1
0
A(B
)=A
=
2
0
1
1
2
2
B(A
)=B
=
2
1
0
Linearity
The most important property of the machine corresponding to a matrix A is that it plays nice with
linear combinations.
Theorem 3. Let A be a matrix, x, y vectors and c, d scalars. If the input vector is a linear combination then also the output vector is a linear combination:
A(cx + dy) = cAx + dAy.
To see this write both sides out! This property of matrix multiplication is called Linearity.
Example 8. Assume we have a linear system Ax = b. Suppose x and y are two distinct solutions.
Why are there infinitely many solutions?
Solution.
Let x, y be such that x 6= y, Ax = b and Ay = b. Let us subtract:
Ax Ay = b b = 0.
The left hand side is a linear combinations of outputs of A, so it is A applied to a linear combination:
A(x y) = 0.
Define then the difference vector z = x y, so that Az = 0. This is not zero because x and y are
distinct. Then we can use the vector z to produce many solutions: choose a scalar c, and calculate
again using linearity
A(x + cz) = Ax + cAz = b + c0 = b.
So we see that we get infinitely many new solutions x + cz, if we have found just two solutions.