You are on page 1of 30

GoBack

ENG 100 - Slide #1


ENG 100
Introduction to Industrial Engineering
A Short Review of Vector and Matrices
Ko University
qLECTURE 3
A Short Review of Vectors and
Matrices
qMatrices
qMatrix Operations
qMatrix Inverse
qLinear Equations
ENG 100 - Slide #2
Matrices
s
A matrix is a rectangular array of numbers (scalars), written
between square brackets
s
Examples
A =
_
0 1 2.3 0.1
1.3 4 0.1 0
_
B =
_
3 3
12 0
_
C =
_

_
1.6 0
3.4 4
7.2 1.1
_

_
s
Dimension or Size of a matrix is given as (numbers of) rows
columns
s
In the above example, A is a 2 4 matrix, B is a 2 2 matrix
and C is a 3 2 matrix.
s
An mn matrix is called
x
Square, if m = n (e.g. B),
x
Skinny, if m > n, (e.g. C),
x
Fat, if m < n (e.g. A).
qLECTURE 3
A Short Review of Vectors and
Matrices
qMatrices
qMatrix Operations
qMatrix Inverse
qLinear Equations
ENG 100 - Slide #3
Matrices
s
We use double script to refer to the elements of the matrix.
s
A
ij
is the element of the matrix A located in row i and the
column j.
s
In the notation A
ij
:
x
i is the row index
x
j is the column index
s
Example: For the matrix
A =
_
1 2 0.2 4
7 9 11 13
_
A
23
= 11, A
12
= 2 and A
31
is undened.
qLECTURE 3
A Short Review of Vectors and
Matrices
qMatrices
qMatrix Operations
qMatrix Inverse
qLinear Equations
ENG 100 - Slide #4
Vectors
s
A matrix with a single column, i.e., an m1 matrix, is called a
(column) vector. Example
x =
_

_
1
2
2
_

_
s
A matrix with a single row, i.e. a 1 n matrix, is called a row
vector. Example
y =
_
1 5 12 4
_
s
if we use the term vector alone, it is generally understood that
we are referring to a column vector.
s
We use vectors to denote points in n-dimensional spaces.
qLECTURE 3
A Short Review of Vectors and
Matrices
qMatrices
qMatrix Operations
qMatrix Inverse
qLinear Equations
ENG 100 - Slide #5
Matrix Equality
s
A = B means
x
A and B have the same size.
x
the corresponding entries are equal.
s
For example,
x
_
2
3.3
_
=
_
2 3.3
_
since the dimensions dont agree.
x
_
2
3.3
_
=
_
2
3.1
_
since the 2
nd
components dont agree.
qLECTURE 3
A Short Review of Vectors and
Matrices
qMatrices
qMatrix Operations
qMatrix Inverse
qLinear Equations
ENG 100 - Slide #6
Zero, Identity and Diagonal Matrices
s
O
mn
denotes the mn zero matrix, with all entries zero.
Ex : 0
23
=
_
0 0 0
0 0 0
_
.
s
I
n
denotes the n n identity matrix, with
I
ij
=
_
1 i = j
0 i = j
Ex : I
3
=
_

_
1 0 0
0 1 0
0 0 1
_

_
.
s
A square matrix A with all entries A
ij
= 0 if i = j is called a
diagonal matrix.
qLECTURE 3
A Short Review of Vectors and
Matrices
qMatrices
qMatrix Operations
qMatrix Inverse
qLinear Equations
ENG 100 - Slide #7
Unit Vectors
s
e
i
denotes the i
th
unit vector: its i
th
component is one, all
others are zero.
s
For example for three dimensional vectors
e
1
=
_

_
1
0
0
_

_
e
2
=
_

_
0
1
0
_

_
e
3
=
_

_
0
0
1
_

_
s
1 denotes the ones vector with all one elements.
s
For example, for four dimensional vectors
1 =
_

_
1
1
1
1
_

_
qLECTURE 3
A Short Review of Vectors and
Matrices
qMatrices
qMatrix Operations
qMatrix Inverse
qLinear Equations
ENG 100 - Slide #8
Transpose
s
Transpose of mn matrix A, denoted A
T
or A

is n m matrix
with
s
(A
T
)
ij
= A
ji
s
Example:
_
1 15 23
2 4 1
_
T
=
_

_
1 2
15 4
23 1
_

_
s
Rows and columns of A are transposed in A
T
.
s
Transpose converts row vectors to column vectors, vice versa.
s
(A
T
)
T
= A.
s
A square matrix A such that A
T
= A is called a symmetric
matrix.
qLECTURE 3
A Short Review of Vectors and
Matrices
qMatrices
qMatrix Operations
qMatrix Inverse
qLinear Equations
ENG 100 - Slide #9
Addition and Subtraction
s
If A and B are both mn, we form A+B by adding
corresponding entries.
s
Example:
_

_
2 4
5 2
1 6
_

_
+
_

_
0 5
1 3
4 6
_

_
=
_

_
2 1
4 1
5 0
_

_
s
Similarly for Matrix Subtraction
_
2 3
5 7
_
I =
_
1 3
5 6
_
s
Addition (subtraction) of two matrices with different sizes is
undened.
qLECTURE 3
A Short Review of Vectors and
Matrices
qMatrices
qMatrix Operations
qMatrix Inverse
qLinear Equations
ENG 100 - Slide #10
Properties of Matrix Addition
s
A+B = B+A. (Commutativity)
s
(A+B) +C = A+ (B+C) (Associativity)
s
A+0 = 0 +A = A
s
AA = 0
s
(A+B)
T
= A
T
+B
T
qLECTURE 3
A Short Review of Vectors and
Matrices
qMatrices
qMatrix Operations
qMatrix Inverse
qLinear Equations
ENG 100 - Slide #11
Scalar Multiplication
s
We can multiply a number (scalar) by a matrix by multiplying
every entry of the matrix by the scalar.
s
Example:
(4)
_

_
2 4
1 5
3 6
_

_
=
_

_
8 16
4 20
12 24
_

_
s
Properties:
x
( + )A = A+ A
x
()A = (A)
x
(A+B) = A+ B
x
0 A = 0
x
1 A = A
qLECTURE 3
A Short Review of Vectors and
Matrices
qMatrices
qMatrix Operations
qMatrix Inverse
qLinear Equations
ENG 100 - Slide #12
Matrix Multiplication
s
If A is mp and B is p n, we can form
C
..
mn
= A
..
mp
B
..
pn
, which is a mn matrix with
C
ij
=
p

k=1
A
ik
B
kj
= A
i1
B
1j
+ . . . + A
ip
B
pj
i = 1, . . . , m, j = 1, . . . , n
s
To nd C
ij
, you need the i
th
row of A and the j
th
column of B.
s
To form C = AB, the number of columns of A must equal the
number of rows of B.
qLECTURE 3
A Short Review of Vectors and
Matrices
qMatrices
qMatrix Operations
qMatrix Inverse
qLinear Equations
ENG 100 - Slide #13
Matrix Multiplication
s
Example 1:
_
1 6
9 3
__
0 1
1 2
_
=
_
6 11
3 3
_
for example to get 2, 1 entry of product:
C
21
= A
21
B
11
+ A
22
B
21
= 9 0 + 3 1 = 3
s
Example 2:
_
0 1
1 2
__
1 6
9 3
_
=
_
9 3
17 0
_
s
These examples illustrate that we dont always have
AB = BA.
qLECTURE 3
A Short Review of Vectors and
Matrices
qMatrices
qMatrix Operations
qMatrix Inverse
qLinear Equations
ENG 100 - Slide #14
Properties of Matrix Multiplication
s
IA = A, AI = A
s
(AB)C = A(BC), so we can write as ABC
s
(AB) = (A)B
s
A(B+C) = AB+AC
s
(AB)
T
= B
T
A
T
s
AB = 0 does not mean A or B is 0.
s
Cancelation Law does not hold for matrices. AB = AC does
not mean B=C.
Example:
A =
_
1 0
0 0
_
B =
_
0 0
1 0
_
C =
_
0 0
0 1
_
AB = AC = 0 but A = 0, B = 0, C = 0 and B = C
qLECTURE 3
A Short Review of Vectors and
Matrices
qMatrices
qMatrix Operations
qMatrix Inverse
qLinear Equations
ENG 100 - Slide #15
Matrix Powers
s
If matrix A is square, then product AA makes sense, and is
denoted A
2
.
s
More generally, k copies of A multiplied together gives A
k
:
A
k
= AA. . . A
. .
k
s
By convention we set A
0
= I.
s
We have A
k
A
l
= A
k+l
.
s
Non-integer powers like A
1/2
are tricky- thats an advanced
topic
qLECTURE 3
A Short Review of Vectors and
Matrices
qMatrices
qMatrix Operations
qMatrix Inverse
qLinear Equations
ENG 100 - Slide #16
Matrix Inverse
s
If A is square, and square matrix F satises FA = I, then
x
F is called the inverse of A, and is denoted A
1
x
The matrix A is called invertible or nonsingular
s
If A doesnt have an inverse, it is called singular or noninvertible
s
By denition, A
1
A = I; a basic result of linear algebra is that
AA
1
= I.
s
We dene negative powers of A via A
k
= (A
1
)
k
.
qLECTURE 3
A Short Review of Vectors and
Matrices
qMatrices
qMatrix Operations
qMatrix Inverse
qLinear Equations
ENG 100 - Slide #17
Matrix Inverse Examples
s
Example 1
_
1 1
1 2
_
1
=
1
3
_
2 1
1 1
_
(Check this!)
s
Example 2
_
1 1
2 2
_
does not have an inverse; lets see why:
_
a b
c d
__
1 1
2 2
_
=
_
a 2b a + 2b
c 2d c + 2d
_
=
_
1 0
0 1
_
but you cant have a 2b = 1 and a + 2b = 0 at the same
time!!
qLECTURE 3
A Short Review of Vectors and
Matrices
qMatrices
qMatrix Operations
qMatrix Inverse
qLinear Equations
ENG 100 - Slide #18
Properties of Matrix Inverse
s
(A
1
)
1
= A (Assuming A is invertible)
s
(AB)
1
= B
1
A
1
(Assuming A, B are invertible)
s
(A
T
)
1
= (A
1
)
T
(assuming A is invertible)
s
I
1
= I
s
(A)
1
= (1/)A
1
(assuming A is invertible, = 0)
s
if y = Ax, where x, y are n-vectors, and A is invertible, then
x = A
1
y:
A
1
y = A
1
Ax = Ix = x
s
If A is invertible and AB = AC then B = C.
qLECTURE 3
A Short Review of Vectors and
Matrices
qMatrices
qMatrix Operations
qMatrix Inverse
qLinear Equations
ENG 100 - Slide #19
Matrix-Vector Product
s
Very important special case of matrix multiplication: y = Ax
x
A is an mn matrix
x
x is an nvector
x
y is an mvector
y
i
= A
i1
x
1
+ . . . + A
in
x
n
i = 1, . . . , m
s
We can think of y = Ax as
x
a function that transforms nvectors to mvectors
x
a set of m linear equations relating x to y.
qLECTURE 3
A Short Review of Vectors and
Matrices
qMatrices
qMatrix Operations
qMatrix Inverse
qLinear Equations
ENG 100 - Slide #20
Inner Product
s
if x, y are nvectors, x
T
y is a scalar called inner product or dot
product of x, y, and denoted x, y:
x, y = x
T
..
1n
y
..
n1
. .
11
= x
1
y
1
+ . . . + x
n
y
n
=
n

i=1
x
i
y
i
qLECTURE 3
A Short Review of Vectors and
Matrices
qMatrices
qMatrix Operations
qMatrix Inverse
qLinear Equations
ENG 100 - Slide #21
Linear Equations
s
An equation in variables x
1
, . . . , x
n
is called linear if each side
consists of a sum of multiples of x
i
, and a constant, e.g.,
1 + x
2
= x
3
2x
1
is a linear equation in x
1
, x
2
, x
3
.
s
The equations involving the following components are not
linear.
a. Power of a variable.
Ex: x
n
for n = 1
b. Multiplication of two variables.
Ex: x
1
x
2
c. Division by a variable.
Ex: 1/x
d. A variable as a power of a constant.
Ex: a
x
qLECTURE 3
A Short Review of Vectors and
Matrices
qMatrices
qMatrix Operations
qMatrix Inverse
qLinear Equations
ENG 100 - Slide #22
Linear Equations Example
s
Any set of m linear equations in the variables x
1
, . . . x
n
can be
represented by the compact matrix equation
Ax = b,
where A is an mn matrix, b is an mvector, x is an
nvector.
s
Two equations in three variables x
1
, x
2
, x
3
:
1 + x
2
= x
3
2x
1
, x
3
= x
2
2
qLECTURE 3
A Short Review of Vectors and
Matrices
qMatrices
qMatrix Operations
qMatrix Inverse
qLinear Equations
ENG 100 - Slide #23
Linear Equations Example Continued
s
step 1: rewrite equations with variables on the lefthand side,
lined up in columns, and constants on the righthand side:
2x
1
+ x
2
x
3
= 1
0x
1
x
2
+ x
3
= 2
(each row is one equation)
s
Step 2: rewrite equations as a single matrix equation:
_
2 1 1
0 1 1
_
_

_
x
1
x
2
x
3
_

_
=
_
1
2
_
s
i
th
row of A gives the coefcients of the i
th
equation
s
j
th
column of A gives the coefcients of x
j
in the equations
s
i
th
entry of b gives the constant in the i
th
equation.
qLECTURE 3
A Short Review of Vectors and
Matrices
qMatrices
qMatrix Operations
qMatrix Inverse
qLinear Equations
ENG 100 - Slide #24
Solving Linear Equations
s
Suppose we have n linear equations in n variables x
1
, . . . x
n
s
Lets write it in compact matrix form as Ax = b where A is an
n n matrix, b is an nvector.
s
Suppose A is invertible, i.e., its inverse A
1
exists.
s
Multiply both sides of Ax = b on the left by A
1
:
A
1
Ax = A
1
b
Ix = A
1
b
x = A
1
b
s
So multiplication by matrix inverse solves a set of linear
equations.
qLECTURE 3
A Short Review of Vectors and
Matrices
qMatrices
qMatrix Operations
qMatrix Inverse
qLinear Equations
ENG 100 - Slide #25
Solving Linear Equations Example
Example: Solve the following set of linear equations.
5 + x
2
= 2x
3
3x
1
, 2x
3
= 3x
2
2 x
2
+ x
3
= 4x
1
3x
1
+ x
2
2x
3
= 5
0x
1
3x
2
+ 2x
3
= 2
4x
1
+ x
2
+ x
3
= 0
_

_
3 1 2
0 3 2
4 1 1
_

_
_

_
x
1
x
2
x
3
_

_
=
_

_
5
2
0
_

_
x = A
1
b
qLECTURE 3
A Short Review of Vectors and
Matrices
qMatrices
qMatrix Operations
qMatrix Inverse
qLinear Equations
ENG 100 - Slide #26
Linear Independence
s
A set of vectors a
1
, a
2
, ...a
n
is linearly independent if the only
solution of the equation

1
a
1
+
2
a
2
+ ... +
n
a
n
= 0
is
1
=
2
= ... =
n
= 0
s
If there are scalars
1
,
2
, ...
n
not all zero, such that

1
a
1
+
2
a
2
+ ... +
n
a
n
= 0
then the set of vectors a
1
, a
2
, ...a
n
is linearly dependent.
(i.e. A vector can be obtained from the others.)
Ex: [2 4 6], [3 7 1], [5 8 -3] are linearly independent.
Ex: [2 4 6], [3 7 1], [5 11 7] are linearly dependent.
Ex: [2 4 6], [1 2 3] are linearly dependent.
qLECTURE 3
A Short Review of Vectors and
Matrices
qMatrices
qMatrix Operations
qMatrix Inverse
qLinear Equations
ENG 100 - Slide #27
Solving Linear Equations
s
When A is noninvertible (i.e., inverse doesnt exist), it means
that coefcient vectors are linearly dependent and
x
one or more of the equations is redundant (i.e. can be
obtained from the others.)
x
the equations are inconsistent or contradictory
(these facts are studied in linear algebra (in Math 203!) )
s
in practice: A isnt invertible means youve set up the wrong
equations, or dont have enough of them
qLECTURE 3
A Short Review of Vectors and
Matrices
qMatrices
qMatrix Operations
qMatrix Inverse
qLinear Equations
ENG 100 - Slide #28
Solving Linear Equations Example
Example:
5 + x
2
= 2x
3
3x
1
, 2x
3
= 3x
2
2 10 + 6x
1
= 4x
3
2x
2
3x
1
+ x
2
2x
3
= 5
0x
1
3x
2
+ 2x
3
= 2
6x
1
+ 2x
2
4x
3
= 10
Example:
5 + x
2
= 2x
3
3x
1
, 2x
3
= 3x
2
2 8 + 6x
1
= 4x
3
2x
2
3x
1
+ x
2
2x
3
= 5
0x
1
3x
2
+ 2x
3
= 2
6x
1
+ 2x
2
4x
3
= 8
qLECTURE 3
A Short Review of Vectors and
Matrices
qMatrices
qMatrix Operations
qMatrix Inverse
qLinear Equations
ENG 100 - Slide #29
Solving Linear Equations
s
What if the number of equations is not equal to the number of
variables, i.e., m = n?
Youll study these in more detail in Math 203!