es 240: scientific and engineering computation. chapter 8 chapter 8: linear algebraic equations and...
TRANSCRIPT
![Page 1: ES 240: Scientific and Engineering Computation. Chapter 8 Chapter 8: Linear Algebraic Equations and Matrices Uchechukwu Ofoegbu Temple University](https://reader035.vdocuments.net/reader035/viewer/2022062804/5697bf8b1a28abf838c8b14b/html5/thumbnails/1.jpg)
ES 240: Scientific and Engineering Computation. Chapter 8
Chapter 8: Linear Algebraic Equations and Matrices
Uchechukwu Ofoegbu
Temple University
![Page 2: ES 240: Scientific and Engineering Computation. Chapter 8 Chapter 8: Linear Algebraic Equations and Matrices Uchechukwu Ofoegbu Temple University](https://reader035.vdocuments.net/reader035/viewer/2022062804/5697bf8b1a28abf838c8b14b/html5/thumbnails/2.jpg)
ES 240: Scientific and Engineering Computation. Chapter 8
OverviewOverview
Matrix:– rectangular array of elements represented by a single
symbol (e.g. [A]).
Element– An individual entry of a matrix
– example: a23 – arow column
![Page 3: ES 240: Scientific and Engineering Computation. Chapter 8 Chapter 8: Linear Algebraic Equations and Matrices Uchechukwu Ofoegbu Temple University](https://reader035.vdocuments.net/reader035/viewer/2022062804/5697bf8b1a28abf838c8b14b/html5/thumbnails/3.jpg)
ES 240: Scientific and Engineering Computation. Chapter 8
Overview (cont)Overview (cont)
A horizontal set of elements is called a row and a vertical set of elements is called a column.
The first subscript of an element indicates the row while the second indicates the column.
The size of a matrix is given as m rows by n columns, or simply m by n (or m x n).
1 x n matrices are row vectors.
m x 1 matrices are column vectors.
![Page 4: ES 240: Scientific and Engineering Computation. Chapter 8 Chapter 8: Linear Algebraic Equations and Matrices Uchechukwu Ofoegbu Temple University](https://reader035.vdocuments.net/reader035/viewer/2022062804/5697bf8b1a28abf838c8b14b/html5/thumbnails/4.jpg)
ES 240: Scientific and Engineering Computation. Chapter 8
Special MatricesSpecial Matrices
Matrices where m=n are called square matrices. There are a number of special forms of square matrices:
Symmetric
A 5 1 2
1 3 7
2 7 8
Diagonal
A a11
a22
a33
Identity
A 1
1
1
Upper Triangular
A a11 a12 a13
a22 a23
a33
Lower Triangular
A a11
a21 a22
a31 a32 a33
Banded
A
a11 a12
a21 a22 a23
a32 a33 a34
a43 a44
![Page 5: ES 240: Scientific and Engineering Computation. Chapter 8 Chapter 8: Linear Algebraic Equations and Matrices Uchechukwu Ofoegbu Temple University](https://reader035.vdocuments.net/reader035/viewer/2022062804/5697bf8b1a28abf838c8b14b/html5/thumbnails/5.jpg)
ES 240: Scientific and Engineering Computation. Chapter 8
Matrix OperationsMatrix Operations
Equal Matrices– Two matrices are considered equal if and only if every element in the first
matrix is equal to every corresponding element in the second. – Both matrices must be the same size.
Matrix addition and subtraction– performed by adding or subtracting the corresponding elements. – Matrices must be the same size.
![Page 6: ES 240: Scientific and Engineering Computation. Chapter 8 Chapter 8: Linear Algebraic Equations and Matrices Uchechukwu Ofoegbu Temple University](https://reader035.vdocuments.net/reader035/viewer/2022062804/5697bf8b1a28abf838c8b14b/html5/thumbnails/6.jpg)
ES 240: Scientific and Engineering Computation. Chapter 8
Example Addition & SubtractionExample Addition & Subtraction
2 1 3 1 4 7
4 0 5 8 3 2
1 3 10
12 3 3
1 82 1 3
4 34 0 5
7 2
2 1 3 1 4 7
4 0 5 8 3 2
3 5 4
4 3 7
is not defined.
![Page 7: ES 240: Scientific and Engineering Computation. Chapter 8 Chapter 8: Linear Algebraic Equations and Matrices Uchechukwu Ofoegbu Temple University](https://reader035.vdocuments.net/reader035/viewer/2022062804/5697bf8b1a28abf838c8b14b/html5/thumbnails/7.jpg)
ES 240: Scientific and Engineering Computation. Chapter 8
Matrix MultiplicationMatrix Multiplication
Scalar matrix multiplication is performed by multiplying each element by the same scalar.
If A is a row matrix and B is a column matrix, then we can form the product AB provided that the two matrices have the same length.
The product AB is a 1x1 matrix obtained by multiplying corresponding entries of A and B and then forming the sum.
1
21 2 1 1 2 2n n n
n
b
ba a a a b a b a b
b
![Page 8: ES 240: Scientific and Engineering Computation. Chapter 8 Chapter 8: Linear Algebraic Equations and Matrices Uchechukwu Ofoegbu Temple University](https://reader035.vdocuments.net/reader035/viewer/2022062804/5697bf8b1a28abf838c8b14b/html5/thumbnails/8.jpg)
ES 240: Scientific and Engineering Computation. Chapter 8
Example Multiplying Row to ColumnExample Multiplying Row to Column
3
2 1 3 2
5
2 3 1 2 3 5 7
3
4 0 2 1 2
5
is not defined.
![Page 9: ES 240: Scientific and Engineering Computation. Chapter 8 Chapter 8: Linear Algebraic Equations and Matrices Uchechukwu Ofoegbu Temple University](https://reader035.vdocuments.net/reader035/viewer/2022062804/5697bf8b1a28abf838c8b14b/html5/thumbnails/9.jpg)
ES 240: Scientific and Engineering Computation. Chapter 8
Matrix MultiplicationMatrix Multiplication
If A is an mxn matrix and B is an nxq matrix, then we can form the product AB.
The product AB is an mxq matrix whose entries are obtained by multiplying the rows of A by the columns of B.
The entry in the ith row and jth column of the product AB is formed by multiplying the ith row of A and jth column of B.
c ij aikbkj
k1
n
![Page 10: ES 240: Scientific and Engineering Computation. Chapter 8 Chapter 8: Linear Algebraic Equations and Matrices Uchechukwu Ofoegbu Temple University](https://reader035.vdocuments.net/reader035/viewer/2022062804/5697bf8b1a28abf838c8b14b/html5/thumbnails/10.jpg)
ES 240: Scientific and Engineering Computation. Chapter 8
Example Matrix MultiplicationExample Matrix Multiplication
7 12 -5
-19 0 2
3 2 02 1 3
2 1 23 0 2
5 3 1
is not defined.
3 2 02 1 3
2 1 23 0 2
5 3 1
Matlab command: A*B Matlab command: A*B – no dot multiplication– no dot multiplication
![Page 11: ES 240: Scientific and Engineering Computation. Chapter 8 Chapter 8: Linear Algebraic Equations and Matrices Uchechukwu Ofoegbu Temple University](https://reader035.vdocuments.net/reader035/viewer/2022062804/5697bf8b1a28abf838c8b14b/html5/thumbnails/11.jpg)
ES 240: Scientific and Engineering Computation. Chapter 8
Matrix Inverse and TransposeMatrix Inverse and Transpose
The inverse of a square matrix A, denoted by A-1, is a square matrix with the property
A-1A = AA-1 = I,where I is an identity matrix of the same size. – Matlab command: inv(A), A^-1
The transpose of a matrix involves transforming its rows into columns and its columns into rows.
– (aij)T=aji– Matlab command: a’ or transpose(a)
![Page 12: ES 240: Scientific and Engineering Computation. Chapter 8 Chapter 8: Linear Algebraic Equations and Matrices Uchechukwu Ofoegbu Temple University](https://reader035.vdocuments.net/reader035/viewer/2022062804/5697bf8b1a28abf838c8b14b/html5/thumbnails/12.jpg)
ES 240: Scientific and Engineering Computation. Chapter 8
Example Example
Verify that is the inverse of 4 111 11
3 211 11
2 1.
3 4
4 1 2 1 1 011 113 3 4 0 1211 11
4 12 1 1 011 1133 4 0 1211 11
checks
checks
![Page 13: ES 240: Scientific and Engineering Computation. Chapter 8 Chapter 8: Linear Algebraic Equations and Matrices Uchechukwu Ofoegbu Temple University](https://reader035.vdocuments.net/reader035/viewer/2022062804/5697bf8b1a28abf838c8b14b/html5/thumbnails/13.jpg)
ES 240: Scientific and Engineering Computation. Chapter 8
Representing Linear AlgebraRepresenting Linear Algebra
Matrices provide a concise notation for representing and solving simultaneous linear equations:
a11x1 a12x2 a13x3 b1
a21x1 a22x2 a23x3 b2
a31x1 a32x2 a33x3 b3
a11 a12 a13
a21 a22 a23
a31 a32 a33
x1
x2
x3
b1
b2
b3
[A]{x} {b}
![Page 14: ES 240: Scientific and Engineering Computation. Chapter 8 Chapter 8: Linear Algebraic Equations and Matrices Uchechukwu Ofoegbu Temple University](https://reader035.vdocuments.net/reader035/viewer/2022062804/5697bf8b1a28abf838c8b14b/html5/thumbnails/14.jpg)
ES 240: Scientific and Engineering Computation. Chapter 8
Solving a Matrix EquationSolving a Matrix Equation
Solving a Matrix Equation – If the matrix A has an inverse, then the solution of the matrix equation
AX = B is given by X = A-1B.
![Page 15: ES 240: Scientific and Engineering Computation. Chapter 8 Chapter 8: Linear Algebraic Equations and Matrices Uchechukwu Ofoegbu Temple University](https://reader035.vdocuments.net/reader035/viewer/2022062804/5697bf8b1a28abf838c8b14b/html5/thumbnails/15.jpg)
ES 240: Scientific and Engineering Computation. Chapter 8
Example Solving a Matrix EquationExample Solving a Matrix Equation
Use a matrix equation to solve 2 4 2
3 7 7.
x y
x y
The matrix form of the equation is
2 4 2.
3 7 7
x
y
1 7 22 4 2 2 72
3 7 7 3 7 412
x
y
![Page 16: ES 240: Scientific and Engineering Computation. Chapter 8 Chapter 8: Linear Algebraic Equations and Matrices Uchechukwu Ofoegbu Temple University](https://reader035.vdocuments.net/reader035/viewer/2022062804/5697bf8b1a28abf838c8b14b/html5/thumbnails/16.jpg)
ES 240: Scientific and Engineering Computation. Chapter 8
Solving With MATLABSolving With MATLAB
MATLAB provides two direct ways to solve systems of linear algebraic equations [A]{x}={b}:– Left-divisionx = A\b
– Matrix inversionx = inv(A)*b
Disadvantages of the matrix inverse method:– less efficient than left-division – only works for square, non-singular systems.
![Page 17: ES 240: Scientific and Engineering Computation. Chapter 8 Chapter 8: Linear Algebraic Equations and Matrices Uchechukwu Ofoegbu Temple University](https://reader035.vdocuments.net/reader035/viewer/2022062804/5697bf8b1a28abf838c8b14b/html5/thumbnails/17.jpg)
ES 240: Scientific and Engineering Computation. Chapter 8
LabLab
Ex 8.9 (see pgs 193/194)