



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Notes; Class: LINR ALG & NUM ANLY; Subject: Applied Mathematics; University: University of Washington - Seattle; Term: Summer 2008;
Typology: Study notes
1 / 7
This page cannot be seen from the preview
Don't miss anything!




For a while now, we’ll focus on linear systems of equations that are square. This refers to the left side of Ax = b, and it means that the system has just as many equations as variables. For example, here’s a 4 × 4 system:
a 11 x 1 + a 12 x 2 + a 13 x 3 + a 14 x 4 = b 1 a 21 x 1 + a 22 x 2 + a 23 x 3 + a 24 x 4 = b 2 a 31 x 1 + a 32 x 2 + a 33 x 3 + a 34 x 4 = b 3 a 41 x 1 + a 42 x 2 + a 43 x 3 + a 44 x 4 = b 4
If I write this as Ax = b, then the matrix A is square:
In particular, we’ll be looking at systems that have exactly one solution. These types tend to come up in mathematical models, and they’re often quite large, so it’s a pretty big deal to describe them in general terms.
Square systems are a big deal because they’re the only type that can be invertible. For a system Ax = b, invertibility is actually a property of the matrix A that specifies the system.
Definition. The matrix A is invertible if for every b (of appropriate di- mension), there is a unique solution to Ax = b.
So for every potential output b, there’s exactly one input x that can be used to get this output. This makes solving Ax = b a well-defined problem.
When I specify b, there definitely is a solution, and there’s only one, so I don’t need to impose any additional conditions. A matrix can only be invertible under two conditions:
The first condition essentially states that there are the same number of inputs as outputs. If A has r rows and d columns, then x ∈ Rd^ and b ∈ Rr. If there are more rows than columns, then the space of possible outputs is larger. If there are more columns than rows, then the space of possible inputs is larger. So the number of rows has to be the same as the number of columns. The second condition is a spiffy consequence of linearity. It says that if I want to check whether the inputs and outputs correspond one-to-one (one output per input), then I only have to check this for the zero vector.
If A is invertible, then it’s inverse, A−^1 , is defined as follows.
Definition. If an n × n matrix A is invertible, then its inverse, denoted A−^1 , is the matrix such that for any b ∈ Rn, the solution to Ax = b is x = A−^1 b. If I know the inverse A−^1 , then solving any system Ax = b is a piece of cake. I just multiply the right side by A−^1 , and I’m done.
If matrix inverses are so awesome, then naturally I want to know how to find them. Conveniently, it’s not too hard to do this using Gaussian elimination. The key thing is a basic fact for all matrices: A−^1 e 1 = first column of A−^1 A−^1 e 2 = second column of A−^1 A−^1 e 3 = third column of A−^1 .. . etc.
Now I’ll do the same things for Ax 2 = e 2 and Ax 3 = e 3 :
e2 = [0; 1; 0]; [Aech, bech] = gausselim2(A,e2); [Arech, brech] = easyjordan(Aech, bech); x2 = brech x2 =
-1. -0.
e3 = [0; 0; 1]; [Aech, bech] = gausselim2(A,e3); [Arech, brech] = easyjordan(Aech, bech); x3 = brech; x3 = -1.
Assuming all has gone well, now I can stick x1, x2, and x3 together to get A−^1. I’ll assemble this matrix, and call it Ainv:
Ainv = [x1 x2 x3] Ainv = 1.1658 1.6631 -1. 2.1104 -1.9754 0. -2.3312 -0.4146 2.
To check this, I’ll take a random b.
b = rand(3,1) b =
If everything has gone as planned, I can solve Ax = b by using the inverse matrix I just calculated:
x = Ainv * b
x =
-0.
A * x ans =
And that’s the same thing as b. It worked! Setting x = A−^1 b solves the system Ax = b.
The process in the last section is a little bit tedious. Fortunately, there’s a way to streamline this process. While calculating A−^1 , we used three augmented matrices:
[ A
∣ (^) e 1 ], [ A
∣ (^) e 2 ], [ A
∣ (^) e 3 ]. (1)
When I apply Gauss-Jordan elimination to any of these three systems, the operations that are used only depend on A. This means I use the exact same operations all three times. So instead of making three individual augmented matrix, why not just make one big one? [ A
∣ (^) e 1 e 2 e 3 ] (2)
All I need to do is make sure that my code for doing Gauss-Jordan elimination can handle multiple columns in the augmented portion of the matrix. It just needs to apply any operations used to all columns independently. And conveniently, gausselim2 and easyjordan already do this. As one final note before moving along, the augmented portion of my matrix is especially simple:
e 1 e 2 e 3
The method I’ve outlined for finding inverses is pretty reliable. Gauss-Jordan elimination is nice and stable, meaning it’s not going to crash and burn as a result of small errors. Since that’s all I’m using, this method of finding inverses is stable, too. However, for large systems, this is a lot of work. If A is 1, 000 × 1 , 000 (which is actually fairly modest), then finding A−^1 involves solving 1,000 dif- ferent systems, each with 1,000 equations! So unless I need to solve thousands of systems involving A, this is pretty inefficient. As it turns out, there are better ways. The most common is the LU decomposition, in which A is written as a matrix product,
A = LU, (4)
where the matrices L and U have particular forms. Essentially, this amounts to bookkeeping the steps that go into Gauss-Jordan elimination in an efficient manner that makes a general system Ax = b easy to solve. So from here, first we’ll talk about what matrix products are, and how they fit into Gaussian elimination. Then we’ll see what LU decompositions are all about.