Anda di halaman 1dari 12

Matrix Algebra

Matrix Algebra (I)

Matrix algebra is a means of efficiently


expressing large numbers of calculations to
be made upon ordered sets of numbers

Also referred to as Linear Algebra

What is a Vector ?

Definitions - Scalars

scalar - a single number

Vector - a single row or column of numbers


Each number is called a component or entry
denoted with bold small letters
row vector
r 1

column vector
1
2
c
3
4

What are Matrices ?

An nxm matrix is a rectangular array of


numbers (called entries) arranged in n rows
and m columns, e.g.
a
A 11
a21

a12
a22

a13
a23

Properties of Matrices

Matrices are denoted by bold capital


letters

All matrices (and vectors) have an order or


dimension - that is the number of rows
the number of columns.
Often a matrix A of dimension n m is
denoted Anxm

is a 23 matrix

Equality of Matrices

Two matrices are equal if all of their


corresponding entries are equal
Statistical data sets are matrices (usually
observations in rows and variables in
columns)

Variable 1 Variable 2 Variable m


Observation 1
a11
a12

a1m
Observation 2
a21
a22

a2m

Observation n
an1
an2

anm

Basic Matrix Operations

Transposition

Sum and Difference

Product

Inversion

Transpose of a Matrix

Transpose of a Matrix : Example

The transpose A of a matrix A is the

If

matrix such that the ith row of A is the ith


column of A and vice versa.

1 4
A 2 5
3 6

then
A' 1 2 3
4 5 6

Sum and Difference

More on Transpose

(A) = A

If A = A', then A is said to be symmetric

Two matrices may be added (subtracted) if they


have the same order

Simply add (subtract) entries from corresponding


locations

where

a11
a21
a31

a12 b11 b12 c11


a22 + b21 b22 = c 21
a32 b31 b32 c 31

a11 + b11 = c11 , a12 + b12 = c12 ,


a21 + b21 = c 21 , a22 + b22 = c 22 ,
a31 + b31 = c 31 , a32 + b32 = c 32

c12
c 22
c 32

Sum and Difference - Example

If we have
1 2
A 3 4
5 6

Sum and Difference - Example

and

7 10
B = 8 11
9 12

1 2
A 3 4
5 6

then C = A + B is given by

The transpose of a sum = sum of

transposes (A+B+C) = A+B+C

A+B = B+A (commutative)


A+(B+C) = (A+B)+C (associative)

and

7 10
B = 8 11
9 12

then C = A B is given by

1 2 7 10 8 12
C A + B = 3 4 + 8 11 = 11 15
5 6 9 12 14 18

Properties of Sum / Difference

Similarly, if we have

1 2 7 10 -6 -8
C A - B = 3 4 - 8 11 = -5 -7
5 6 9 12 -4 -6

Product of a Scalar and a Matrix

To multiply a matrix by a scalar, simply


multiply each entry of the matrix by the
scalar quantity
a
a a
a12
11 12 = 11
a21 a22 a21 a22

Product of a Scalar & a Matrix Example

If we have
1 2
A 3 4
5 6

and

= 3.5

Product of Matrices

We write the multiplication of two


matrices A and B as AB

This is referred to either as


pre-multiplying B by A
or
post-multiplying A by B

then we can calculate A by


1 2

3.5

7.0

5 6

17.5 21.0

A 3.5 3 4 = 10.5 14.0

Note that A = A

if is a scalar

Special Matrix Multiplication

Premultiplication of a column vector a by


conformable row vector b yields a single value
called the dot product

If
a 3 4 6

and

5
b 2
8

then ab is defined by
5
ab 3 4 6 2 = 3 5 + 4 2 + 6 8 = 71
8

So for matrix multiplication AB, A is


referred to as the premultiplier and B is
referred to as the postmultiplier

Product of Matrices

In order to multiply matrices, they must


be conformable (number of columns in the
premultiplier = number of rows in
postmultiplier)

Note that
(m n) (n p) = (m p)
(m n) (p n) impossible
(1 n) (n 1) = (1 1)

Product of Matrices

If we have A3x3 and B3x2 then

a11 a12 a13 b11 b12 c11 c12


AB a21 a22 a23 b21 b22 = c21 c22 C
a a a b b c c
31 32 33 31 32 31 32

where
c ij = a i1b1j + a i2b 2j + a i3b 3j

3
a b
1 ik k j

e.g. c 32 = a 31b12 + a 32b 22 + a 33b 32

Matrix Multiplication : An Example

If we have
then
where

Product of Matrices

1 4 7
1 4
A 2 5 8 and B = 2 5
3 6 9
3 6

1 4 7 1 4 c11 c12 30 66
AB 2 5 8 2 5 = c21 c22 = 36 81
3 6 9 3 6 c31 c32 42 96

c11 = a11b11 + a12b21 + a13b31 = 1 1 + 4 2 + 7 3 = 30


c12 = a11b12 + a12b22 + a13b32 = 1 4 + 4 5 + 7 6 = 66
c 21 = a21b11 + a22b21 + a23b31 = 2 1 + 5 2 + 8 3 = 36
c 22 = a21b12 + a22b22 + a23b32 = 2 4 + 5 5 + 8 6 = 81
c 31 = a31b11 + a32b21 + a33b31 = 3 1 + 6 2 + 9 3 = 42
c 32 = a31b12 + a32b22 + a33b32 = 3 4 + 6 5 + 9 6 = 96

If we have A3x3 and B3x2 then


b11 b12 a11 a12 a13
BA b21 b22 a21 a22 a23 is undefined

31 b32 a31 a32 a33

i.e., matrix multiplication is not commutative


(why ?)

Properties of Matrix Multiplication


Even if conformable, AB does not necessarily
equal BA (i.e., matrix multiplication is not
commutative)
Multiplication is associative, i.e., A(BC) = (AB)C
(AB) = BA

Special Uses of Matrix Multiplication

Suppose we have :
a11x1 + a12x2 = b1
a21x1 + a22x2 = b2
If we let
a
A 11
a21

a12
,
a22

x
x = 1,
x2

b
b = 1
b 2

Special Matrices

There are a number of special matrices.


Zero Matrix
Identity Matrix
Diagonal Matrix

then we can rewrite the system as Ax = b.

Zero Matrix
A square matrix whose elements all equal
0
0
0
0
0

0
0
0
0

0
0
0
0

0
0
0
0

Note : O+A = A+O = A for any A

Identity Matrix
An identity matrix is a diagonal matrix
where the diagonal elements all equal 1
1
I 0
0
0

0
1
0
0

0
0
1
0

0
0
0
1

Note : IA = AI = A for any A

Diagonal Matrix
A diagonal matrix is a square matrix with
all off-diagonal entries being zero.
a11
0
0
0

0
a22
0
0

0
0
a33
0

0
0
0
a44

Prelude to Inverse Matrix


Consider the system of equations:
a11x1 + a12x2 = b1
a21x1 + a22x2 = b2
which can be represented by:
Ax = b
where

A = a11
a21

Prelude to Inverse Matrix


If we were to solve this system of equations
simultaneously for x2 we would have:
a21(a11x1 + a12x2 = b1)
-a11(a21x1 + a22x2 = b2)
which yields (through cancellation & rearranging):
a21a11x1 + a21a12x2 - a11a21x1 - a11a22x2
= a21b1 - a11b2

a12 , x = x 1 , and b = b1
x 2
b 2
a22

Prelude to Inverse Matrix


This gives
x2=

a11b2 a21b1
a11a22 a12 a21

The denominator is called the determinant of A,


|A| or det(A) :
A = a11a22 a12 a21

Thus if |A|= 0 then either

i) no solution or

ii) many solutions

Determinant of a 2x2 Matrix

If we have a 2x2 matrix A such that


A a11
a 21

then

a12
a 22

A = a1 1 a 2 2 - a1 2 a 2 1

For example if
A 1
3

2
4

Some Properties of Determinants

Determinants have several mathematical


properties useful in matrix manipulations:
|A|=|A'|
|AB|= |A||B|
(determinant of product = product of
determinants)

A = 1 2 = a11a22 - a12a21 1 4 - 2 3 = -2
3 4

Inverse of Matrices of Order 2


Suppose

Inverse of Matrices of Order 2 Example


Suppose

A a b
c d

then
A 1

d b
c a

det A

Check : AA-1 = A-1A = I

A 1 2
2 5

then
A 1

5 2
2 1 5 2

1
2 1

Inverse of a Matrix
The inverse of a matrix A, denoted by
A-1 , is such that AA-1 = A-1A = I
An inverse of A exists if only if |A| 0
A matrix which has no inverse is said to
be singular
(AB)-1 = B-1A-1

Inverse Using EXCEL

Enter the matrix entries, e.g. A1:D4

Highlight the cells where you want to


place the inverse matrix

While still highlighted, enter


= MINVERSE(A1:D4)
Press Ctrl Shift Enter together

Solving Linear Equations


Consider the system again :
Ax = b
where A = aa11 aa12 , x = xx1 , and b = bb1
22
21
2
2
If

A-1 exists

then
A-1Ax

or

A-1b

x = A-1b

Trace of a Matrix
The trace of a square matrix A is the sum of
the leading diagonal elements
Denoted tr(A)
For example, the trace of

is

A 1
3
n

2
4

tr A = aii =1+ 4 = 5
i=1

Quadratic Forms

Some Properties of Trace

A quadratic form is a function


For any scalar c, tr(cA) = c[tr(A)]
tr(A B) = tr(A) tr(B)
tr(AB) = tr(BA)

Q(x) = xAx
in k variables x1,,xk where
x1

x x 2

xk

and A is a kxk symmetric matrix.

Positive Definite
Matrix/Quadratic Form

Quadratic Forms
A quadratic form has only squared terms and
cross-product terms.
Suppose
x
x 1 and A 1
2
x2

2
2

then

Q( x ) = x'Ax = x12 + 4x1 x 2 2x 22

If

xAx > 0
x =[x1 x2 xk] [0 0 0]

the matrix A and the quadratic form are said


to be positive definite.

Quadratic Forms with 2


Unknowns

The quadratic form

The quadratic form


Q( x ) = x1

x
x 2 a b 1 ax12 2bx1 x 2 cx 22
b
c

x 2

can be re-written as
where

Quadratic Form : Examples

x 22 az 2 2bz c

z x1 / x 2

which is positive definite when


a 0 and ac b2 0

Comment
There are many other matrix algebra results
that will be important to statistics. This file
provides only a glimpse to the totality.

4x 12 + 9x 22 - 6x 1 x 2

having matrix

4 -3
-3 9
is positive definite. Why ?

How about 4x12 + 9x 22 - 14x1 x 2 ?

Anda mungkin juga menyukai