gaussian elimination
TRANSCRIPT
…GAUSSIAN ELIMINATION…
VIVIANA MARCELA BAYONA CARDENAS
Linear equations…A set of n linear equations in n variables, xi
can be written in matrix form, Ax = b:
a11x1 a12x2 a1nxn b1a21x1 a22x2 a2nxn b2
an1x1 an2x2 annxn bn
a11 a12 a1na21 a22 a2n
an1 an2 ann
x1x2xn
b1b2
bn
…Linear equationse.g. the 2 2 system of linear equations
can be written in matrix form, Ax = b:
To solve, we premultiply the equation by A–1, A–1Ax = A–1b, giving x = A–1b:
2x y 5x y 3
2 11 1
xy
53
2 11 1
12 11 1
xy
2 11 1
153
xy
1
11 1 1 2
53
21
Matrix equations…We can use this method for matrix equations
of the form AX = B: e.g. find the matrix X if
We can get rid of the matrix to the left of X by premultiplying each side of the equation by the inverse
Thus
5 42 2
X 1 1 4
0 1 2
5 42 2
15 42 2
X 5 4
2 2
11 1 40 1 2
X 5 42 2
11 1 40 1 2
1
22 4 2 5
1 1 40 1 2
1 3 0 1 3.5 1
…Matrix equationsSimilarly for XA = B: e.g. find the matrix X if
We can remove matrix A by postmultiplying each side of the equation by its inverse, A–1
Thus
X 5 42 2
1 10 14 2
X 5 42 2
5 42 2
1
1 10 14 2
5 42 2
1
X1 10 14 2
5 42 2
1
1 10 14 2
1
22 4 2 5
2 4.5 1 2.52 3
Solving n n linear equationsWe can solve a general system of n n linear
equations by writing it in matrix form, AX = B, and premultiplying the matrix equation by the inverse of the matrix of coefficients, A–1.
i.e. if AX = B then A–1AX = A–1B, but A–1A = Iso X = A–1B
However, this method is almost never used because it is inefficient and prone to rounding errors.
We shall investigate Gaussian elimination, a more efficient and accurate method for solving linear equations.
Visualising n n linear equations2 variablesSolution is at
the intersection of 2 lines
• 3 variables• Solution is at the
intersection of 3 planes
Gaussian elimination…Consider a system of 3 3 linear equations in
matrix form, Ax = b:
To make book-keeping simpler, we represent the system by an augmented matrix:
a11 a12 a13a21 a22 a23a31 a32 a33
x1x2x3
b1b2b3
a11 a12 a13 b1a21 a22 a23 b2a31 a32 a33 b3
…Gaussian elimination…We can zero the first column by subtracting a21/a11 times the first row from the second row, and subtracting a31/a11 times the first row from the third row (primes indicate changed values)
Similarly, we can now zero the second column by subtracting a’32/a’22 times the first row from the third row (double primes indicate changed values), forming an upper triangular matrix:
a11 a12 a13 b10 a 22 a 23 b 20 a 32 a 33 b 3
a11 a12 a13 b10 a 22 a 23 b 20 0 a 33 b 3
…Gaussian elimination…The last row represents an equation in a single variable
a”33 x3 = b”3 which can be solved as x3 = b”3 / a”33
The second row represents an equation in two variablesa’22 x2 + a’23 x3 = b’2
Since the variable x3 has already been found in the previous step, x2 can be solved as x2 = (b’2 – a’23 x3) / a’22
a11 a12 a13 b10 a 22 a 23 b 20 0 a 33 b 3
…Gaussian eliminationThe first row represents an equation in three
variablesa11 x1 + a12 x2 + a13 x3 = b1
Since the variables x2 and x3 have already been found in the previous steps, x1 can be solved as x1 = (b1 – a12 x2 – a13 x3) / a11
This process of solving an upper triangular matrix equation is called back substitution.
Gaussian elimination: example 1…Solve the system of equations
Represent the system as an augmented matrix:
We introduce a lower triangular matrix, L, to record row multipliers in the • positions
x y z 4x y z 22x 8y z 19
1 1 1 41 1 1 22 8 1 19
1 0 0 1 0 1
…Gaussian elimination: example 1…Calculate the row multipliers and record
them in the L matrix, l21 = a21/a11 and l31 = a31/a11
Zero the first column by subtracting l21 = a21/a11 times the first row from the second row, and subtracting l31 = a31/a11 times the first row from the third row
1 1 1 41 1 1 22 8 1 19
1 1 1 40 2 2 60 6 1 11
L1 0 01 1 02 1
…Gaussian elimination: example 1…Calculate the row multiplier and record it in
the L matrix, l32 = a’32/a’22
Zero the second column by subtracting l32 = a’32/a’22 times the second row from the third row, forming an upper triangular matrix
1 1 1 40 2 2 60 6 1 11
1 1 1 40 2 2 60 0 7 7
L1 0 01 1 02 3 1
…Gaussian elimination: example 1Back substitute
The last row represents an equation in a single variable, a”33 z = b”3, which can be solved as z = b”3 / a”33 = –7 / –7 = 1
The second row represents an equation in two variables, a’22 y + a’23 z = b’2, which can be solved asy = (b’2 – a’23 z) / a’22 = (–6 + 2) / (–2) = 2
The first row represents an equation in three variablesa11 x + a12 y + a13 z = b1, which can be solved asx1 = (b1 – a12 y – a13 z) / a11 = (4 – 2 – 1) / 1 = 1
The solution is thus x = 1, y = 2, z = 1.
1 1 1 40 2 2 60 0 7 7
Gaussian elimination: example 2…Solve the system of equations
Represent the system as an augmented matrix:
2x 5y3z 7x 2.5y 1.5z 7.52x 7y4.5z 12
2 5 3 71 2.5 1.5 7.52 7 4.5 12
…Gaussian elimination: example 2…Calculate the row multipliers and record
them in the L matrix, l21 = a21/a11 and l31 = a31/a11
Zero the first column by subtracting l21 = a21/a11 times the first row from the second row, and subtracting l31 = a31/a11 times the first row from the third row
2 5 3 71 2.5 1.5 7.52 7 4.5 12
2 5 3 70 5 3 110 2 1.5 5
L1 0 00.5 1 01 1
…Gaussian elimination: example 2…Calculate the row multiplier and record it in
the L matrix, l32 = a’32/a’22
Zero the second column by subtracting l32 = a’32/a’22 times the second row from the third row, forming an upper triangular matrix
2 5 3 70 5 3 110 2 1.5 5
2 5 3 70 5 3 110 0 0.3 0.6
L1 0 00.5 1 01 0.4 1
…Gaussian elimination: example 2Back substitute
The last row can be solved as z = b”3 / a”33 = 0.6 / 0.3 = 2
The second row can be solved asy = (b’2 – a’23 z) / a’22 = (–11 + 6) / (–5) = 1
The first row can be solved asx = (b1 – a12 y – a13 z) / a11
= (7 – 5 – 6) / 2 = –2The solution is thus x = –2, y = 1, z = 2.
2 5 3 70 5 3 110 0 0.3 0.6
Gaussian elimination: example 3…Solve the system of equations
Work to 4 significant figures and give the answer to 3. Check the answer by substituting into the original equation.
Represent the system as an augmented matrix:
0.0001x 0.0001y1.99z 102x 2.001y z 14x 3y2.982z 1
0.0001 0.0001 1.99 102 2.001 1 14 3 9.282 1
…Gaussian elimination: example 3…Calculate the row multipliers and record them in
the L matrix, l21 = a21/a11 and l31 = a31/a11
Zero the first column by subtracting l21 times the first row from the second row, and subtracting l31 times the first row from the third
0.0001 0.0001 1.99 102 2.001 1 14 3 9.282 1
0.0001 0.0001 1.99 100 0.001 39,800 200,0000 1 79,600 400,000
L1 0 0
20,000 1 040,000 1
…Gaussian elimination: example 3…Calculate the row multiplier and record it in
the L matrix, l32 = a’32/a’22
Zero the second column by subtracting l32 = a’32/a’22 times the second row from the third row, forming an upper triangular matrix
L1 0 0
20,000 1 040,000 1,000 1
0.0001 0.0001 1.99 100 0.001 39,800 200,0000 1 79,600 400,000
0.0001 0.0001 1.99 100 0.001 39,800 200,0000 0 39,880,000 200,400,000
…Gaussian elimination: example 3…Back substitute
The last row can be solved as z = –39,880,000 / –200,400,000 = 5.025
The second row can be solved asy = (–200,000 + 199,995) / (0.001) = –5,000
The first row can be solved asx = (b1 – a12 y – a13 z) / a11
= (10 + 0.5 – 9.99975) / 0.0001 = 5,003The computed solution is thus x = 5,003, y = –5,000, z = 5.03
0.0001 0.0001 1.99 100 0.001 39,800 200,0000 0 39,880,000 200,400,000
…Gaussian elimination: example 3
Check the computed solution against the original equations
Numerical rounding has caused these errors.Working to more significant figures givesx = –7.939 c.f. 5,000y = 5.922 c.f. –5,000z = 5.025 c.f. 5.03
0.0001 0.0001 1.992 2.001 14 3 9.282
xyz
1011
0.0001 0.0001 1.992 2.001 14 3 9.282
5,000 5,0005.03
100.035,015
Geometric interpretationIll-conditioning, as seen in example 3,
can be interpreted geometrically:The shaded red area represents
uncertainty in the lines’ positions due to rounding errors.
The solid red area represents where the intersection may be found due to these errors.
The closer to parallel the lines are, the larger the possible error.
Geometric interpretation: 1 solutionGaussian
elimination to the form
where none of the diagonal elements are zero
We get the usual form of the augmented matrix and can fine a unique solution by back substitution
0 0 0
Geometric interpretation: 0 solutionGaussian
elimination to the form
where b3 is not zeroWe end up with
0 z = non-zeroi.e. no solution can exist because at least 2 planes, or 3 lines of intersection, are parallel
0 0 0 0
Geometric interpretation: ∞ solutionGaussian
elimination to the form
i.e. b3 is zeroWe end up with
0 z = zeroi.e. an infinite number of solutions exist because this is always true for any value of z
0 0 0 0 0
REFERENCEhttp
://es.wikipedia.org/wiki/Eliminaci%C3%B3n_de_Gauss-Jordan
http://www.monografias.com/trabajos72/resolucion-sistemas-metodo-gauss-jordan/resolucion-sistemas-metodo-gauss-jordan.shtml
http://cbi.azc.uam.mx/archivos/varios/
ProblemarioW.pdf