ics 6n computational linear algebra matrix algebraxhx/courses/ics6n/lectures/matrix-algebra.pdfics...
Post on 07-Jan-2020
28 Views
Preview:
TRANSCRIPT
ICS 6N Computational Linear AlgebraMatrix Algebra
Xiaohui Xie
University of California, Irvine
xhx@uci.edu
February 2, 2017
Xiaohui Xie (UCI) ICS 6N February 2, 2017 1 / 24
Matrix
Consider an m × n matrix
A =
a11 a12 . . . a1na21 a22 . . . a1n
......
. . ....
am1 am2 . . . amn
=[a1 a2 . . . an
]
aij is the scalar entry in the ith row and jth column, called the(i , j)-entry.
Each column is a vector in Rm.
Two matrices are equal if they have the same size and thecorresponding entries are equal
a11, a22, ... are called the diagonal entriesA is called diagonal if all non-diagonal entries are zero
The identity matrix In is a square diagonal matrix with diagonal being 1
The zero matrix is a matrix in which all entries are zero, written as 0.
Xiaohui Xie (UCI) ICS 6N February 2, 2017 2 / 24
Matrix operations
Given two m × n matrices A and B,
Sum: A + B is an m × n matrix whose (i , j)-entry is aij + bij
Multiplication by a scalar: rA = Ar is an m × n matrix whose(i , j)-entry is raij , where r is a scalar.
Matrix vector product: Ax = x1a1 + x2a2 + . . . + xnan
Xiaohui Xie (UCI) ICS 6N February 2, 2017 3 / 24
Examples
Given A =
[1 2 34 5 6
], B =
[1 0 10 1 1
], C =
[1 00 1
], compute
A + B
2A
A + C
Xiaohui Xie (UCI) ICS 6N February 2, 2017 4 / 24
Examples
Given A =
[1 2 34 5 6
], B =
[1 0 10 1 1
], C =
[1 00 1
],
A + B =
[2 2 40 6 7
]2A =
[2 4 58 10 12
]A + C = Not defined.
Xiaohui Xie (UCI) ICS 6N February 2, 2017 5 / 24
Properties of matrix operations
Given A, B, C matrices of the same size, and scalars r and s,
(A + B) + C = A + (B + C )
A + B = B + A
A + 0 = A
r(A + B) = rA + rB
(r + s)A = rA + sA
r(sA) = (rs)A
Xiaohui Xie (UCI) ICS 6N February 2, 2017 6 / 24
Matrix Multiplication
When a matrix B multiplies a vector x, it transforms x into the vectorBx.
If this vector is then multiplied in turn by a matrix A, the resultingvector is A(Bx).
Thus A(Bx) is produced from x by a composition of mappings – thelinear transformations.
Our goal is to represent this composite mapping as multiplication bya single matrix, denoted by AB, so that A(Bx) = (AB)x .
Xiaohui Xie (UCI) ICS 6N February 2, 2017 7 / 24
Matrix Multiplication
Suppose A is m × n, B is n × p, and x is in Rp
Denote B =[b1 b2 . . . bp
].
Xiaohui Xie (UCI) ICS 6N February 2, 2017 8 / 24
Matrix Multiplication
Suppose A is m × n, B is n × p, and x is in Rp
Bx is a vector in Rn, A(Bx) is a vector in Rm
Denote B =[b1 b2 . . . bp
]. Then Bx = x1b1 + x2b2 + . . . + xpbp
A(Bx) = A(x1b1 + x2b2 + . . . + xpbp)
= A(x1b1) + A(x2b2) + . . . + A(xpbp)
= x1(Ab1) + x2(Ab2) + . . . + xp(Abp) linear combination
=[Ab1 Ab2 · · · Abp
]x
So AB =[Ab1 Ab2 · · · Abp
], an m × p matrix.
Xiaohui Xie (UCI) ICS 6N February 2, 2017 9 / 24
MATRIX MULTIPLICATION
Definition: If A is an m × n matrix, and if B is an n × p matrix withcolumns b1, · · · , bp, then the product AB is the m × p matrix whosecolumns are Ab1, · · · ,Abp.
That isAB =
[Ab1 Ab2 · · · Abp
]Each column of AB is a linear combination of the columns of A usingweights from the corresponding column of B.
Xiaohui Xie (UCI) ICS 6N February 2, 2017 10 / 24
Example
Given A =
[1 2 12 1 1
]and B =
1 1−1 10 0
, compute AB.
Xiaohui Xie (UCI) ICS 6N February 2, 2017 11 / 24
Example
Given A =
[1 2 12 1 1
]and B =
1 1−1 10 0
, compute AB.
Solution: AB =
| |Ab1 Ab2| |
Ab1 =
[1 2 12 1 1
] 1−10
=
[−11
], Ab2 =
[1 2 12 1 1
]110
=
[33
]So AB =
[−1 31 3
]
Xiaohui Xie (UCI) ICS 6N February 2, 2017 12 / 24
Row-column rule for computing AB
Now let’s check the (i , j)-entry of AB:
(AB)ij = the i-th entry of the j-th column
= the i-th entry of Abj
= bj · (the i-th row of A)
= ai1b1j + ai2b2j + ... + ainbnj
The (i , j)-entry of AB is the sum of the products of correspondingentries from row i of A and column j of B
(AB)ij = ai1b1j + ai2b2j + ... + ainbnj =n∑
k=1
aikbkj
Xiaohui Xie (UCI) ICS 6N February 2, 2017 13 / 24
Example
Given A =
[1 2 34 5 6
], B =
1 −11 00 1
, compute AB.
Xiaohui Xie (UCI) ICS 6N February 2, 2017 14 / 24
Example
Given A =
[1 2 34 5 6
], B =
1 −11 00 1
, compute AB.
Solution:
Are the sizes consistent? Yes
Based on definition, AB =
| |Ab1 Ab2| |
=
[3 29 2
]Or we can also calculate this entry by entry(AB)11 =
[1 2 3
] [1 1 0
]= 3
(AB)21 =[4 5 6
] [1 1 0
]= 9
And so on until we get
AB =
[3 29 2
]
Xiaohui Xie (UCI) ICS 6N February 2, 2017 15 / 24
Special Cases
An nx1 matrix can be viewed as a vector in Rn (column vector)
A row vector can be viewed as a 1xn matrix.
(Dot product) A row vector times a column vector produces a scalarif they are of the same size.
[a1 a2 . . . an
]×
b1b2...bn
= a1b1 + a2b2 + . . . + anbn
Xiaohui Xie (UCI) ICS 6N February 2, 2017 16 / 24
Special Cases
(Out product) A column vector times a row vector produces a matrix.a1a2...am
× [b1 b2 . . . bn]
=
a1b1 a1b2 . . . a1bna2b1 a2b2 . . . a2bn
......
. . ....
amb1 amb2 . . . ambn
Xiaohui Xie (UCI) ICS 6N February 2, 2017 17 / 24
Special cases
Let A be an mxn matrix,
AIn = A = ImA
A0 = 0
.
Xiaohui Xie (UCI) ICS 6N February 2, 2017 18 / 24
Theorems
If the sizes are consistent
a) (AB)C = A(BC )
b) A(B + C ) = AB + AC
c) (B + C )A = BA + BC
d) (rA)B = A(rB)
e) ImA = AIn
Xiaohui Xie (UCI) ICS 6N February 2, 2017 19 / 24
Warnings
AB 6= BA in general. They are not even of the same size!
ExampleEven if they are the same size it is in general not true
A =
[1 10 0
], B =
[0 11 0
]AB =
[1 10 0
], BA =
[0 01 1
]If AB = BA then A and B are commutable, but in general they are not.
Xiaohui Xie (UCI) ICS 6N February 2, 2017 20 / 24
Warnings
If AB = AC and A 6= 0, we cannot conclude B = C
ExampleEven if they are the same size it is in general not true
A =
[1 −11 −1
], B =
[1 21 2
], C =
[3 43 4
]AB =
[0 00 0
], BA =
[0 00 0
]But we can clearly see B 6= C
Xiaohui Xie (UCI) ICS 6N February 2, 2017 21 / 24
Powers of a matrix
Definition: If A is an n × n matrix and if k is a positive integer, then Ak
denotes the product of k copies of A.
Ak = A · · ·A (k times)
A0 = I by convention.
Xiaohui Xie (UCI) ICS 6N February 2, 2017 22 / 24
Transpose
Given an mxn matrix A, the transpose of A is the nxm matrix,denoted by AT , whose columns are formed from the correspondingrows of A.
If A =
a11 a12 . . . a1na21 a22 . . . a2n
......
. . ....
am1 am2 . . . amn
, then AT =
a11 a21 . . . an1a12 a22 . . . an2
......
. . ....
a1m a2m . . . anm
(AT )ij = aji
Xiaohui Xie (UCI) ICS 6N February 2, 2017 23 / 24
Properties of matrix transpose
If the sizes are consistent
(AT )T = A
(A + B)T = AT + BT
(rA)T = rAT
(rA)B = A(rB)
(AB)T = BTAT (note the reverse order!)
Xiaohui Xie (UCI) ICS 6N February 2, 2017 24 / 24
top related