ChemE 109  Numerical and Mathematical Methods in Chemical and Biological
Engineering
Solution to Homework Set 2
1. (10 points) From the deﬁnition of a determinant, one can show the following properties:
•
Property 1:
A determinant changes in sign but not in magnitude with an interchange of
a pair of rows or a pair of columns.
•
Property 2:
A determinant remains unchanged by additions of multiples of one row
(column) to another row (column).
Using these properties, show that if
A
0
is the upper triangular matrix formed during the solution
of a system of equations
Ax
=
c
via Gauss elimination with partial pivoting, then:
det A
= (

1)
I
det A
0
= (

1)
I
n
Y
i
=1
a
0
ii
where
I
is the number of row interchanges.
Proof:
In Gauss elimination, the matrix
A
is undergoing a series of elementary transformations as
follows:
A
⇒
A
1
⇒
A
2
⇒
A
3
⇒ ··· ⇒
A
0
The transformations can be either interchange of rows(columns) or additions of multiples of
one row (column) to another row (column). The
A
s are the intermediate matrices during the
transformations. From Properties 1 and 2, the absolute values of the determinants of these
A
s
are equal. Since only an interchange changes the sign of the determinant and there are totally
I
times of interchanges, the relationship between the determinants of
A
and
A
0
is
det A
= (

1)
I
det A
0
The determinant of
A
0
is the multiplication of its diagonal elements due to the upper triangular
structure:
det A
0
=
n
Y
i
=1
a
0
ii
Therefore the proof is completed.
2. (10 points)
(a) Create a program using MATLAB which performs
LU decomposition with partial
pivoting
.
Sample program:
function [x] = LUSolver(A, b)
n=size(A,1);
%find the size of A
U=A;
%Start the U matrix as A
1
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentL=eye(size(A)); %Start the L matrix as identity
P=eye(n);
%Start the permutation matrix as identity
y=zeros(size(b));
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '07
 Christofides
 0.5%, Gaussâ€“Seidel method, Jacobi method, Iterative method, NaN Inf

Click to edit the document details