Sunteți pe pagina 1din 40

Lecture 2: Matrix Algebra and Calculus

The Algebra (al-jabr) of Matrices


Algebra as a branch of mathematics is much broader than elementary algebra
all of studied in our high school days. In a sense an algebra is a set of
rules. As we learned from our secondary education the algebra of scalars
studies the operations and relationships of numbers. When the rules of
addition and multiplication are generalized, their precise definitions lead to
the notions of algebraic structures that can lead to concepts such as groups,
rings and fields - concepts studied in the area of mathematics called abstract rings and fields concepts studied in the area of mathematics called abstract
algebra, We can talk in terms of the algebra of complex numbers, algebra of
vectors, and tensor algebra.
Al b i f d fi i i l d i h h i l Algebra is a set of definitions, rules, and operations that govern mathematical
quantities.
Lecture 2: Matrix Algebra and Calculus
Matrix Notation
Given the following system of equations
n n
n n
x a x a x a b
x a x a x a b
+ + + =
+ + + =
M K M M M
K
K
2 2 22 1 21 2
1 2 12 1 11 1
in short hand the above system can be expressed as
n mn m m m
x a x a x a b + + + = K
2 2 1 1
where
{ } | |{ } X A B =
{ }

=
b
b
B
2
1
{ }

=
n
n
a a a
a a a
A
K
K
2 22 21
1 12 11
{ }

=
x
x
X
2
1

m
b
K

mn n n
a a a K
K K K K
2 1

n
x
K
Lecture 2: Matrix Algebra and Calculus
Thus a matrix is an ordered arrangement of values (scalar, vector, higher order tensor) in a
row-column format
{ }

=
n
n
a a a
a a a
A
K
K
2 22 21
1 12 11
The matrix above consists of m rows and n columns. We can identify the elements in a

mn n n
a a a K
K K K K
2 1
y
matrix using the notation a
ij.
The first subscript designates row in which the element is in
and the second subscript identifies the column. Repeated subscripts (indices) indicates the
element is on the diagonal.
In later courses the subscripted notation will be used to represent the matrix itself when
some rules are incorporated on how to employ indicial notation (see Elasticity or Continuum
Mechanics).
Lecture 2: Matrix Algebra and Calculus
Although the number of rows and columns of a matrix may vary from problem to problem,
two cases deserve attention When m = 1 the matrix consists of one row of elements This two cases deserve attention. When m 1 the matrix consists of one row of elements. This
is called a row matrix and is denoted
{ } { }
m
b b b B K
2 1
=
When n = 1 the matrix consists of one column of elements and is referred to as a column
matrix It is denoted

x
x
1
matrix. It is denoted
{ }

=
n
x
x
X
K
2
Lecture 2: Matrix Algebra and Calculus
Fundamental Types of Matrices
Asquare matrix has the same number of rows as columns A square matrix has the same number of rows as columns.
A symmetric matrix is one in which the off diagonal elements are reflected about the
diagonal. Using subscript notation
or in a full matrix format
j i a a
ji ij
=
or in a full matrix format
| |
(
(
(

=
3 6 5
6 2 4
5 4 1
A
Symmetric square matrices play a special role in engineering mathematics. Can a matrix be
symmetric if m does not equal n?
(

3 6 5
sy e c does o equ
Lecture 2: Matrix Algebra and Calculus
When all elements of the main diagonal are equal to one, and all the off diagonal entries are
equal to zero, i.e.,
1 0 0
(
L
| |
1 0 0
0 1 0
0 0 1
I
(
(
(
=
(
(

L
M M O M
the square matrix is referred to as the identity matrix.
The transpose of a matrix is defined as the reordering of the elements of the matrix such
0 0 1

L
The transpose of a matrix is defined as the reordering of the elements of the matrix such
that the columns of the original matrix become the rows of the new matrix. The following
notation is utilized
{ }

=
n
n
a a a
a a a
A
K
K
2 22 21
1 12 11
{ }

=
n
n
a a a
a a a
A
K
K
2 22 21
1 12 11

mn n n
a a a K
K K K K
2 1

mn n n
a a a K
K K K K
2 1
Lecture 2: Matrix Algebra and Calculus
An example of a specific matrix and its transpose is


2 1
{ } { }
)
`

=
6 4 2
5 3 1
6 5
4 3
2 1
T
A A
The product of a transpose is defined as
{ }{ } { } { } { }
T T T
B A B A
For a square symmetric matrix
{ }{ } { } { } { } B A B A =
| | | |
j i a a
A A
ij ji
T
=
=
Lecture 2: Matrix Algebra and Calculus
Show that
{ }{ } { } { } { }
T T T
In Class Example 2.1
Proof by example: If
{ }{ } { } { } { }
T T T
A B B A =
{ }

2 1 4
3 2 1
A
{ }

`

= 1 2
1 1
B
{ }

)
`

=
2 3 2
1 2 0
A
{ }

)
`

=
3 0
1 2 B
So that
{ }

`

2 0 4 1
T
{ }

0 2 1
T
{ }

=
2 1 2 3
3 2 1 2
T
A
{ }
)
`

=
3 1 1
0 2 1
T
B
Lecture 2: Matrix Algebra and Calculus
Then

1 1
3 2 1
{ }{ }



=
3 0
1 2
1 1
2 3 2
1 2 0
2 1 4
B A
( )( ) ( )( ) ( )( ) ( )( ) ( )( ) ( )( )
( )( ) ( )( ) ( )( ) ( )( ) ( )( ) ( )( )

= + + = + +
= + + = + +

)


1 3 2 1 1 1 4 2 0 2 2 1 1 4
8 3 3 1 2 1 1 5 0 3 2 2 1 1
2 3 2
( )( ) ( )( ) ( )( ) ( )( ) ( )( ) ( )( )
( )( ) ( )( ) ( )( ) ( )( ) ( )( ) ( )( )
( )( ) ( )( ) ( )( ) ( )( ) ( )( ) ( )( )

= + + = + +
= + + = + +
=
11 3 2 1 3 1 2 4 0 2 2 3 1 2
5 3 1 1 2 1 0 4 0 1 2 2 1 0


=
5 4
1 2
8 5
{ }{ } { }
`

4 4 2 5
T
B A

11 4
5 4
{ }{ } { }
)
`


=
11 5 1 8
T
B A
Lecture 2: Matrix Algebra and Calculus
Similarly
{ }{ }

`

= 3 2 1 2
2 0 4 1
0 2 1
T T
A B { }{ }

)
`

)
`


=
2 1 2 3
3 2 1 2
3 1 1
A B
( )( ) ( )( ) ( )( ) ( )( ) ( )( ) ( )( )
( )( ) ( )( ) ( )( ) ( )( ) ( )( ) ( )( )
( )( ) ( )( ) ( )( ) ( )( ) ( )( ) ( )( )

= + + = + +

= + + = + +
= + + = + +
=
4 2 0 3 2 2 1 4 1 0 2 2 0 1
1 2 3 1 1 4 1 8 3 3 2 1 1 1
2 2 0 1 2 4 1 5 3 0 2 2 1 1
( )( ) ( )( ) ( )( ) ( )( ) ( )( ) ( )( )
( )( ) ( )( ) ( )( ) ( )( ) ( )( ) ( )( )

)
`

= + + = + +
+ + + +
11 2 3 3 1 2 1 5 1 3 2 1 0 1
4 2 0 3 2 2 1 4 1 0 2 2 0 1
{ }{ } { }
)
`


= =
)
`


=
11 5 1 8
4 4 2 5
11 5 1 8
4 4 2 5
T
B A
hence
{ }{ } { } { } { }
T T T
A B B A =
Lecture 2: Matrix Algebra and Calculus
It is easy to conceptualize the transpose of the transpose is the matrix itself
{ } { } B B
T
T
= { } { }
With rules of addition and multiplication
{ } { } { } { } L L + + + = + + +
T T T T
C B A C B A
{ } { }
T T
A A =
and
{ } { }
{ } { } ( )
n
T
T
n
{ } { } ( )
T
T
n
A A =
where
{ } { }{ }{ } { } A A A A A
n
{ } { }{ }{ } { } A A A A A
n
L =
Lecture 2: Matrix Algebra and Calculus
A square matrix is a diagonal matrix when the entries along the diagonal are non-zero and
all off diagonal are zero, i.e., g , ,
| |
11
22
0 0
0 0
d
d
D
(
(
(
=
L
L
| |
0 0
mm
D
d
(
=
(
(

M M O M
L
A scalar matrix is a diagonal matrix whose diagonal elements all contain the same scalar
0 0
0 0

(
(
(
L
| |
0 0
0 0
S

(
=
(
(

L
M M O M
L
| |
I =
Lecture 2: Matrix Algebra and Calculus
The null matrix is a matrix whose entries are all zero, i.e.,

0 0 0 L
{ }

=
0 0 0
0 0 0
0 0 0
M
M O M M
L
I
The null matrix does not have to be a square matrix.

0 0 0 M
The number of rows and columns that a matrix has is called its order or its dimension. By
convention, rows are listed first and then columns. Thus, we would say that the order (or
dimension) of the matrix below is 3 x 4, meaning that the matrix has 3 rows and 4 columns.

6 17 47 0
42 103 23 57

9 1 89 51
Lecture 2: Matrix Algebra and Calculus
A lower triangular matrix is a square matrix with entries equal to zero above the diagonal,
i.e.,
| |
(
(
(
(
(

= l l l
l l
l
L L
L
L
33 32 31
22 21
11
0
0 0
0 0 0
A t i l t i i t i ith t i l t b l th di l
(
(
(

nn n n n
l l l l L
M O M M M
3 2 1
An upper triangular matrix is a square matrix with entries equal to zero below the diagonal,
i.e.,
(
(

n
u u u u L
1 13 12 11
| |
(
(
(
(
(
(

=
n
n
n
u u
u u u
U
M O M M M
L
L
0 0
0
3 33
2 23 22
1 13 12 11
(
(

nn
u L
M O M M M
0 0 0
Lecture 2: Matrix Algebra and Calculus
Matrix Addition and Subtraction
The matrix A The matrix A
{ } { }
n x m
ij
a A =
can be added to the matrix B can be added to the matrix B
{ } { }
n x m
ij
b B =
to produce the matrix C to produce the matrix C
{ } { }
{ }
ij ij
n x m
ij
b a
c C
+ =
=
{ }
n x m
ij ij
This points out that to form a sum of two matrices the matrices must be of the same order
(the matrices are said to be conformable for addition) and that the elements of the sum are
determined by adding the corresponding elements of the matrices forming the sum. y g p g g
Lecture 2: Matrix Algebra and Calculus
Matrix addition is both commutative and associative
{ } { } { } { } A B B A + = + { } { } { } { }
{ } { } { } ( ) { } { } ( ) { } C B A C B A
A B B A
+ + = + +
+ = +
The matrix {B}
{ } { }
n x m
ij
b B =
can be subtracted from the matrix {A}
{ } { }
to produce the matrix {C}
{ } { } C
{ } { }
n x m
ij
a A =
{ } { }
{ }
n x m
ij ij
n x m
ij
b a
c C
=
=
To carry this one step further y p
{ } { } { } { } { } { } B C A C B A = = +
Lecture 2: Matrix Algebra and Calculus
Matrix Multiplication
W ill h h i h d i l l i i l i We will see that the matrix methods in structural analysis requires solving
large systems of linear equations using matrix algebra tools. In an earlier
section, the large systems of linear equations was represented simply as
{ } | |{ } X A B =
where A was an m x n coefficient matrix, B was an m x 1 vector, and X was
an n x 1 vector. Now let m = n = 3. The matrices take on the following
forms:

(
(

1 13 12 11 1
x a a a b

(
(
(

3
2
33 32 31
23 22 21
3
2
x
x
a a a
a a a
b
b
A b l l t d t d ti i l l id t A row by column element product and summation is clearly evident:
Lecture 2: Matrix Algebra and Calculus
A row by column element product and summation is clearly evident:
3 13 2 12 1 11 1
x a x a x a b + + =
3 33 2 32 1 31 3
3 23 2 22 1 21 2
3 13 2 12 1 11 1
x a x a x a b
x a x a x a b
x a x a x a b
+ + =
+ + =
+ +
that is, each element of B is obtained by multiplying the corresponding
element of A by the appropriate element in X and adding the result. Notice
that the forgoing procedure does not work if the number of columns in A g g p
does not equal the number of rows of B. This suggests a general definition
for the multiplication of two matrices. If A is an m x n matrix, and B is a
p x q matrix, then
exists if n is equal to p.
{ }{ } { } C B A =
exists if n is equal to p.
Lecture 2: Matrix Algebra and Calculus
If this is the case the elements of C are given by
m i , , 3 , 2 , 1 L =
{ }
q j
b a c
m i
p n
k
kj ik
q x m
ij
3 2 1
, , 3 , 2 , 1
1
=
=

=
=
Under these conditions the matrices A and B are said to be conformable for
multiplication. In general
q j , , 3 , 2 , 1 L =
multiplication. In general
H it b ith ff t th t
{ }{ } { }{ } A B B A
However, it can be proven with some effort that
{ }{ } ( ){ } { } { }{ } ( )
{ } { } { } ( ) { }{ } { }{ } C B B A C B A
C B A C B A =
{ } { } { } ( ) { }{ } { }{ }
{ } { } ( ){ } { }{ } { }{ } C B C A C B A
C B B A C B A
+ = +
+ = +
Lecture 2: Matrix Algebra and Calculus
In Class Example 2.2
Lecture 2: Matrix Algebra and Calculus
If the product of two matrices A and B yields the null matrix, that is,
{ } { } { } { } { } { }
0 A B =
it cannot be assumed that A or B is the null matrix. Furthermore, if
{ } { } { } { } { } { } { } { }
A B A C =
or
{ } { } { } { }
C A B A =
it cannot be assumed that
{ } { } C B =
This infers that in general cancellation of matrices in a manner similar to multiplication of
scalar algebra is not permissible scalar algebra is not permissible.
Lecture 2: Matrix Algebra and Calculus
In Class Example 2.3
Lecture 2: Matrix Algebra and Calculus
To review some basic matrix algebra consider the following system of
Examples from MATLab
To review some basic matrix algebra, consider the following system of
equations
6 2 = + y x
10
or
17 4 = + y x
6
7
8
9
(x,y)= (1,4)
4
17
4
1
6 2
+ =
+ =
x y
x y
2
3
4
5
4 4
0 1 2 3 4 5 6
0
1
2
Lecture 2: Matrix Algebra and Calculus
Matrix form:
(
| |{ } { }
(
=
)
`

=
)
`

6 1 2
17
6
4 1
1 2
where
b x a or
y
x
Matlab output
| | { }
)
`

=
)
`

=
(

=
17
6
, ,
4 1
1 2
b
y
x
x a
a =
2 1
1 4
Matlab code
a=[2 1;1 4]
b=[6;17]
1 4
b =
6
17
b=[6;17]
determinant=det(a)
solution=a\b
17
determinant =
7
solution =
Note |a| 0
1.0000
4.0000
Lecture 2: Matrix Algebra and Calculus
Now consider a different system of equations Now consider a different system of equations
16 2 4 = + y x
10
6 2
16 2 4
= +
+
y x
y x
6
7
8
9
or
8 2 + = x y
3
4
5
6
or
6 2 + = x y
0 1 2 3 4 5 6
0
1
2
Lecture 2: Matrix Algebra and Calculus
Matrix form:
| |{ } { } =
`

=
`

(
(

16 2 4
b x a or
x
Matlab output
a =
4 2
2 1
| |{ } { }
| | { }
`

=
`

=
(
(

=
)
`

)
`

16
, ,
2 4
6 1 2
b
x
x a
where
b x a or
y
b =
16
6
d i
| | { }
)
`

)
`

6
, ,
1 2
b
y
x a
determinant =
0
Warning: Matrix is singular to working
precision
a=[4 2;2 1]
b=[16;6]
Matlab code
precision.
solution =
Inf
b [16;6]
determinant=det(a)
solution=a\b
Note |a| = 0
Inf
-Inf
Lecture 2: Matrix Algebra and Calculus
System of three equations (Matlab format)
Code: Code:
a=[-1 1 2;3 -1 1;3 3 1]
b=[2;6;2]
solution=a\b
3
solution a\b
Output:
a =
2
2.5
a
-1 1 2
3 -1 1
3 3 1
b =
1.15 -0.95
-0.9
1
1.5
b
2
6
2
solution =
0.9
0.95
1
1.05
1.1
-1.1
-1.05
-1
solution
1
-1
2
Lecture 2: Matrix Algebra and Calculus
Matrix Multiplication Applied to Structural Analysis
For displacement based stress analysis
(
D K K K F

(
(
(
(

n
D
D
K K
K K K
F
F
M M
M
M
2
1
22 12
1 12 11
2
1
...

)
`

(
(

)
`

n nn n n
D K K F
M M M
1
...
Stiffness matrix -
Symmetric since K
ij
= K
ji
Nodal Displacements
Nodal Forces
Lecture 2: Matrix Algebra and Calculus
Matrix Inversion Basic Definition
I l l b il k f h f d f ll In scalar algebra we can easily make use of the concept of zero and one as follows:


= =
= + = +
1 1
0 0
where is a scalar quantity. The scalar certainly possesses a reciprocal, or multiplicative
inverse. that when applied to the scalar quantity produces one:
1
| |
( ) 1
1
1
= =
|
.
|

\
|

The above can be extended to n x n matrices. Here one is the identity matrix, and zero is the
null matrix.
| | | | | | | | | |
| || | | || | | | A A I I A
A A A = + = + 0 0
| || | | || | | | A A I I A = =
Lecture 2: Matrix Algebra and Calculus
If there is an n x n matrix A
-1
that pre- and post-multiplies the matrix A such that
| | | | | | | | | | I A A A A = =
1 1
then the matrix A
-1
is the inverse of the matrix A with respect to matrix multiplication The then the matrix A is the inverse of the matrix A with respect to matrix multiplication. The
matrix A is said to be invertible, or non-singular, if A
-1
exists, and non-invertible or singular
if A
-1
does not exist.
Th f i i i i f i h d f l The concept of matrix inversion is of paramount importance to the study of structural
analysis with matrix methods. We will study this topic in detail shortly, and refer to it often
throughout the course.
Lecture 2: Matrix Algebra and Calculus
Powers and Roots of Square Matrices
Because the matrix A is conformable with itself for matrix multiplication we can form Because the matrix A is conformable with itself for matrix multiplication we can form
powers of the matrix as follows:
{ } { }{ }{ } { } A A A A A
n
L = { } { }{ }{ } { }
In addition it is easy to see that the law of exponents holds
{ } { } { }
) ( n m
n m
A A A
+
= { } { } { }
) (
A A A =
and the zero power of a matrix is the identity matrix. Negative powers of a matrix can be
defined as:
{ } { } ( )
m
m
A A
1

=
and are defined as:
{ } { }
m
m
A A =
1
Lecture 2: Matrix Algebra and Calculus
Matrix Differentiation
One can differentiate a matrix by differentiating every element of the matrix in the One can differentiate a matrix by differentiating every element of the matrix in the
conventional manner. Consider
| |
(
(

4 2
2 3
3 2 x x x
The derivative d[a]/dx of this matrix is
| |
(
(
(

=
5
4 2
3
2
x x x
x x x A
The derivative d[a]/dx of this matrix is
| |
(
(

3
2
3 4 3 x x
A d| |
(
(
(

=
4
3
5 1 3
1 4 4
x
x x
dx
A d
Lecture 2: Matrix Algebra and Calculus
Similarly, one can take the partial derivative of a matrix as follows
| |
(
(

3 2
2 2 3
xy z x y x
| |
(
(
(
(

3
2
5 2
4 2
z y xy
y xz z x
y y
x x
A
(
(
(

=
0 0 3
0 4
3 4 3
2
4
2 2
y
z xz
y xz y x
In structural analysis we differentiate strain energy potential functions that have the form

y
( (
x a a
1
via matrix multiplication
| |
(

=
y
x
a a
a a
y x U
22 21
12 11
2
1
( )
2
22 12
2
11
2
2
1
y a xy a x a U + + =
Lecture 2: Matrix Algebra and Calculus
Partial differentiation leads to
U
y a x a
x
U
12 11
+ =

y a x a
U
22 12
+ =

Or in matrix format

U
y a x a
y
22 12
+

y
x
a a
a a
y
U
x
U
22 21
12 11
If
)
y
| | { } | |{ } X A X
x a a
y x U
T
1 1
12 11
=
(
(

(
(

= | | { } | |{ } X A X
y a a
y x U
2 2
22 21
=
(

=
Lecture 2: Matrix Algebra and Calculus
Then
U
| |{ } X A
x
U
i
=

Here x
i
represents x and y using index notation. The above holds only if [a] is a symmetric
matrix.
Lecture 2: Matrix Algebra and Calculus
Matrix Integration
One can differentiate a matrix by differentiating every element of the matrix in the y g y
conventional manner. Consider
| |
(
(
(

=
3
2
1 4 4
3 4 3
x x
x x
a
The integration of this matrix is
(
2 3
| |
(
(

4
5 1 3
1 4 4
x
x x a
| |
(
(
(

5
4 2
2 3
3
2
3 2
x x x
x x x
x x x
dx a
We often integrate the expression

| | | || | d d d X A X
T

This triple product will be symmetric if [A] is symmetric


| | | || | dz dy dx X A X
T

Lecture 2: Matrix Algebra and Calculus


Special Categories of Matrices
Asq are matri is said to be a k t i if all diagonal elements are not ero and A square matrix is said to be a skew matrix if all diagonal elements are not zero and
j i a a
ji ij
=
Thi t i b k t i if ll di l l t H This matrix becomes skew-symmetric if all diagonal elements are zero. Here
T
A A =
Any matrix can be composed of complex elements
| | = c C
ij
| |
| | 1 = + = j b j a
c C
ij ij
ij
Lecture 2: Matrix Algebra and Calculus
A complex matrix has a conjugate
| | c C = | |
| |
ij ij
ij
b j a
c C
=
=
Lecture 2: Matrix Algebra and Calculus
Other Matrix Terminology
Banded matrix
If all non-zero terms are contained within a band along the diagonal,
the matrix is said to be banded
0 0 0 0 0 a a
(
L
11 12
21 22 23
32 33 34
0 0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
a a
a a a
a a a
(
(
(
(
(
(
L
L
L
| |
43 44 34
54 55 34
65 66
0 0 0 0
0 0 0 0
0 0 0 0
a a a
A
a a a
a a
(
(
=
(
(
(
(
L
L
O M
Later you will find that banded matrices are quite common in structural
1,
, 1
0 0 0 0 0
m m
m m mm
a
a a

(
(
(

M M M M M O O
L
Later you will find that banded matrices are quite common in structural
analysis. Special band storage techniques are used to avoid finding space
for all the zero entries.
Lecture 2: Matrix Algebra and Calculus
Other Matrix Terminology (continued)
Sparse matrix
If a matrix has relatively few non-zero terms (as is common in FEA),
the matrix is said to be sparse p
Singular matrix
If the determinant of the matrix equals zero, the matrix is said to be q ,
singular. As we saw earler, if [A] is singular, then the system of
equations [A]{x}={b} has no unique solution.

S-ar putea să vă placă și