PDA

Click to See Complete Forum and Search --> : matrix help please =(


mariusmssj
Dec 28th, 2009, 09:26 AM
hello guys i am having quite a problem trying to solve this, i am doing something wrong.
4x + 3y - 4z= -7
5x - 2y + 3z= 13
6x + 4y - 3z= -4

these were my 1st attempts, but they went wrong i know the answer should be 1 -1 2.
http://img237.imageshack.us/img237/4216/maths10001.jpg
http://img64.imageshack.us/img64/5191/maths10002.jpg

please help me =(

MartinLiss
Dec 28th, 2009, 09:57 AM
Welcome to VB Forums!

You don't need to post links to images, in fact we'd prefer that you didn't. Instead you can use the Manage Attachments button that you'll find in the frame below the one where you are creating a post.

NickThissen
Dec 28th, 2009, 03:23 PM
You don't really seem to understand how matrices work, judging from your attempts.

You have three equations, which can be represented in matrix form by this:
┌ ┐┌ ┐ ┌ ┐
│ 4 3 -4 ││ x │ │ -7 │
│ 5 -2 3 ││ y │ = │ 13 │
│ 6 4 -3 ││ z │ │ -4 │
└ ┘└ ┘ └ ┘
And not by this (which is what you're writing)
┌ ┐ ┌ ┐ ┌ ┐
│ 4 3 -4 │ │ x │ │ -7 │
│ 5 -2 3 │ = │ y │ = │ 13 │
│ 6 4 -3 │ │ z │ │ -4 │
└ ┘ └ ┘ └ ┘

Now, you can solve the equations by simply solving them line by line. For example, if you start with the first one, you may get an expression for x in terms of y and z. Then, you can substitute that expression for x for the x that appears in the second and third equations. Now, you have eliminated the variable x. You can do the same for y, using the second line, and finally you can do the same for z, in which case you have found a value for z. Then, you can substitute that back into the expression for y (which only depends on z), and you get a value for y. Finally, you can substitute both the y and z you've found back into the expression for x, and you have all three values. Solved!

However, that may get very messy, so clever people have come up with a different way of solving this: by using matrix and vector multiplication.
┌ ┐┌ ┐ ┌ ┐
│ 4 3 -4 ││ x │ │ -7 │
│ 5 -2 3 ││ y │ = │ 13 │
│ 6 4 -3 ││ z │ │ -4 │
└ ┘└ ┘ └ ┘
A x = b
A is the matrix, x is the vector (x, y, z) which you have to solve, and b is the vector representing the right-hand-sides of the three equations.

To solve this equation for x, you can do a so-called Gaussian elimination. I think it's also often called 'sweeping' the matrix.

If you know how to do gaussian elimination, then you're basically done: apply it to the matrix and you'll get your answer. If you don't, I suggest you read your textbook (if you have one) again, or ask your teacher, because I'm sure it has been explained.

Basically, you start with this matrix (which is just A and b pasted together)
┌ ┐
│ 4 3 -4 │ -7 │
│ 5 -2 3 │ 13 │
│ 6 4 -3 │ -4 │
└ ┘
And you manipulate the rows and columns until you arrive at this form
┌ ┐
│ 1 0 0 │ u │
│ 0 1 0 │ v │
│ 0 0 1 │ w │
└ ┘
The values for u, v and w are then your x, y and z.

Justa Lol
Dec 28th, 2009, 08:00 PM
i actually never learned this because i could see the results right away and somehow i passed with the highest grades in maths in 9th grade :D finished school with top in maths and i can't even figure out how to calculate this, the results just popped up in my head... just like marius he knows the result but can't figure it out... and welcome to the forums by the way :D

jemidiah
Dec 28th, 2009, 09:16 PM
I'd like to fill in a small detail based on Nick's post. Your original system of equations can be rewritten as 1 equation (i.e. 1 = sign), instead of 3, as Nick did. If you're pedantic, this uses definitions 1.3.Equality and 1.5.Multiplication [of a Matrix] by a Column Vector of my Guide to Linear Algebra (http://www.vbforums.com/showthread.php?t=596958).


4x + 3y - 4z= -7
5x - 2y + 3z= 13
6x + 4y - 3z= -4

becomes

┌ ┐ ┌ ┐
│ 4x + 3y - 4z │ │ -7 │
│ 5x - 2y + 3z │ = │ 13 │
│ 6x + 4y - 3z │ │ -4 │
└ ┘ └ ┘

which is, through reversed matrix multiplication,

┌ ┐┌ ┐ ┌ ┐
│ 4 3 -4 ││ x │ │ -7 │
│ 5 -2 3 ││ y │ = │ 13 │
│ 6 4 -3 ││ z │ │ -4 │
└ ┘└ ┘ └ ┘