Upload
others
View
4
Download
1
Embed Size (px)
Citation preview
MATRICES, DETERMINANT AND SYSTEM OF LINEAR EQUATIONS
SOLVING LINEAR SYSTEM BY MATRIX INVERSIONCRAMER’S RULELEAST SQUARE METHOD
August 7, 2008 Matrices, Det(A) and System of Linear 2
Solving Linear System by Matrix Inversion
If A is an invertible nxn matrix, then for each matrix nx1 b, the system of linear equations Ax=b has exactly one solution, namely x=A-1b
Example
Solve system of linear below
=
321
221321311
zyx
August 7, 2008 Matrices, Det(A) and System of Linear 3
Solving Linear System by Matrix Inversion
−−
−== −
321
110011342
1bAX
−−
−=−
110011342
1A
We had A-1 (see System of Linear Equations PPT page 1)
Solution of linear system is
−=
113
August 7, 2008 Matrices, Det(A) and System of Linear 4
Cramer’s Rule
( ) ( ) ( ))det(
det,...,)det(
det,)det(
det 22
11 A
AxAAx
AAx n
n ===
Cramer’s Rule
If Ax=b is a system of linear equations in n variable such that det(A)≠0, then system has one solution. When Aj is the matrix obtained by replacing the entries in the j th column of A by the entries of b, then the solution of system is
August 7, 2008 Matrices, Det(A) and System of Linear 5
Cramer’s Rule
4...212321543
===A
=
101
212321543
zyx
ExampleSolve system of linear equations below
Solution
See Determinant ppt page 9
August 7, 2008 Matrices, Det(A) and System of Linear 6
Cramer’s Rule
101
101
=== ...122143
3A
Solution (continued)
101
=== ...223153
2A
=== ...213254
1A 3
0
-1
41
41,0
40,1
44
321 −=−
===== xxx
Solution of system
August 7, 2008 Matrices, Det(A) and System of Linear 7
Least Square Fitting to DataLeast Squares Fit of a Straight Line
a Straight Line Model
0123456789
101112131415
0 1 2 3 4 5 6
X
Y
Suppose we want to fit a straight line y = a+bx to the experimentally determined point (x1,y1), (x2,y2),…, (xn,yn)
Y=a+bx a= ?b= ?
August 7, 2008 Matrices, Det(A) and System of Linear 8
Least Square Fitting to DataLeast Squares Fit of a Straight LineLet we have data (x1,y1), (x2,y2),…, (xn,yn)
If the data points are collinear, the line would pass through all n points and so the unknown coefficient a and b would satisfy
y1=a+bx1
y2=a+bx2
:
yn=a+bxn
=
nn y
yy
ba
x
xx
MMM2
1
2
1
1
11
M v = y
August 7, 2008 Matrices, Det(A) and System of Linear 9
Least Square Fitting to DataLeast Square Solution
v is given by formula v = (MTM)-1 MTy
Example
Find the least square straight line fit to the four points
(0,1), (1,3), (2,4) and (3,4)
August 7, 2008 Matrices, Det(A) and System of Linear 10
Least Square Fitting to Data
4431
14664
−
−32101111
2337
101
Solution
We have
MTM= (MTM)-1 =
v = (MTM)-1 MTy =
=
4431
y
=15.1
−
−2337
101
=
31211101
M
The least square straight line fit is y = 1.5 + x
August 7, 2008 Matrices, Det(A) and System of Linear 11
Least Square Fitting to DataFitting of a Quadratic Curve to DataLet we have data (x1,y1), (x2,y2),…, (xn,yn)
The technique described for fitting a straight line to data points generalizes easily to fitting a polynomial of any specified degree to data point.
y1=a0+a1x+a2x2
=
nnn y
yy
aaa
x
xx
x
xx
MMMM2
1
2
1
0
2
22
21
2
1
1
11
Let us attempt to fit a polynomial of fixed degree 2
We have
M v = y
Least Square Solution
v is given by formula
v = (MTM)-1 MTy
August 7, 2008 Matrices, Det(A) and System of Linear 12
Least Square Fitting to Data
Example
Find the polynomial of fixed degree 2 fit to the four points
(0,1), (1,3), (-1,3) and (2,4)
1886862624
Solution
We have
MTM = (MTM)-1 =
=
4331
y
−−−−
5555935311
201
−=
4110
21111101
M
August 7, 2008 Matrices, Det(A) and System of Linear 13
Least Square Fitting to DataSolution
4431
−
−−−−
=411021101111
5555935311
201
v = (MTM)-1 MTy
−=201638
201
The polynomial of fixed degree 2 is
2
2016
2038 xxy +−=
August 7, 2008 Matrices, Det(A) and System of Linear 14
Exercises1. Let we have system of linear equations Ax=b
=
123
011132212
zyx
a. Find A-1
b. Solve that system using A-1
2. Let we have system of linear equations Ax=b
=
11
41
yx
ba
a. Find a and b such that system has one solution, write the solution
b. Find a and b such that system has infinitely many solution, write the solution
August 7, 2008 Matrices, Det(A) and System of Linear 15
Exercises
3. Find the least square straight line fit to the five points (0,0), (1,2), (3,4), (4,6) and (5,7)
4. Find the quadratic polynomial that best fit to the five points (0,0), (1,2), (3,4), (4,6) and (5,7)