From charlesreid1

1703 Lecture: Introduction to Matlab

Matrix Representation

Can someone give me some values of x and y that satisfy this equation?

x y
3 1
1 0
2
101 50

How many combinations of x and y will satisfy this equation?

How else can we represent this equation?

As a line:

(insert figure here)

Is the slope positive or negative?

What's the slope?


Some values of x and y that satisfy this equation?

x y
3 1
1 4
75 -107

How many combinations of x and y will satisfy this equation?

We can also represent this equation as a line

(insert figure here - both lines on same plot)

What's the slope?

We can see that the point x=3, y=1 is where these two lines meet - which means it is the combination of x and y that satisfies both of these equations.


How else can we represent these equations?

In column form:

After pushing these two columns together, we get:

What about the equations:

How to represent this graphically?

Instead of lines, use planes

Let's look at the first 2 equations only:

(Insert figure here)

The two planes intersect to form a line

Now the third equation: Also a plane

The line that represents the intersection of these first two equations will intersect the third equation's plane at one point

We can also represent these equations in matrix form:


How do we represent 4 equations graphically?

5 equations?

6 equations?

We run into a limit using graphical methods

What about the matrix representation of 4 equations? 5 equations? 6 equations?

The matrix representation is easy and flexible


Solving Systems of Equations

Now let's talk about how you actually solve these systems...

Going back to original example:

or,

Option A:

Use elimination to eliminate one variable, solve for the other variable

Then plug that into one of these equations to find the other variable

Example:

Eliminate y by adding the two equations:

and therefore

Then solve for y by plugging into original equations:

Let's see what's happening in matrix form:

We're adding equation (1) to equation (2), and using that as our new equation (2)

So in the matrix, we're replacing row(2) with ( row(1) + row(2) )

The matrix becomes:

Option B:

What's another way we can solve this?

(Cramer's Rule homework assignment)

Cramer's Rule:

If we have a system like:

then the solution is:

and for y:


One more 2x2 example:

or,

Let's try eliminating x or y and then solving for the remaining variable

So try (1) + 2*(2):

and solving for x,

Then we can plug this into our remaining equation and solve for y:

Look at what we did with our matrix:

We changed row (2) to be row (1) + 2*row(2)

(Can you tell me what I should change in my matrix?)

Now an example for a 3x3 system:

or,

Using elimination: First, we want 1 equation with 1 unknown

Try eqn (3) + eqn (2) - eqn (1)

so,

Next, we want an equation with two unknowns: y, and something else

Let's try (3) + 2*(2):

Next when we plug in we get

Finally, we want an equation with all 3 unknowns, so that we can plug in the values for x and y that we just found

so,

What happened to our matrix? What did our matrix become?

Did row 1 change?

Did row 2 change?

For the first step, we transformed row (3) into row(3) + row(2) - row(1)

What happened in the second step?

Row(2) changed to row(3) + 2*row(2)

or, we could swap column 1 and column 2 and rewrite this as:

If we swapped column 1 and column 2, how would we have to change the unknowns vector?