Advanced Math/Matrix

Advertisement


Question
I have to develop a c program which can balance a chemical equation by the method of 'Generalized matrix inverse method for balancing chemical equation and their stability'. But I am using a little different method. where I am not able to find complete step to find rank of a matrix. I don't be able to develop the algorithm for that.

Main Qus:
starting from a matrix how I can make its left rowXrow a unit matrix by just Adding & Subtracting only rows of that matrix.
Example:
main matrix:
1 0 0 -1 0 1 0 0 0
2 1 1 -3 0 0 1 0 0
0 1 2 -1-1 0 0 1 0
0 1 0  0-1 0 0 0 1

After operation:(r2-2r1;r3-r2;r4-r2;r2-r3;r4+r3;r1+r4;r2+r4)
1 0 0 0 -2 5 -2 1 1
0 1 0 0 -1 0  0 0 1
0 0 1 0 -1 2 -1 1 0
0 0 0 1 -2 4 -2 1 1
(I know the operation for the above matrix but not for all)

Is there is any general rule or method that if I apply that same rule into all matrix I get the result. so there is no need to find which row of that matrix is added or subtracted with other. that is the starting procedure is same for all(its simplify my C++ code/algorithm)  but the solution should use only add/subtraction of rows?
please help me...Rahul

Answer
I think your program could work like this:

for  k = 1 to n
   check that A[k,k] is not zero.
   if it is zero, then
       repeat
            switch row k with a later one
       until A[k,k] is not zero.
   Divide row k by A[k,k] to make  A[k,k] = 1.
   for newrow = k+1 to n
        Get factor = A[newrow,k]
        Subtract  Row k * factor from Row newrow.
           -- now  A[newrow,k] = zero.
   end for

end for

Now you should have your matrix diagonalized.

Advanced Math

All Answers


Answers by Expert:


Ask Experts

Volunteer


Paul Klarreich

Expertise

I can answer questions in basic to advanced algebra (theory of equations, complex numbers), precalculus (functions, graphs, exponential, logarithmic, and trigonometric functions and identities), basic probability, and finite mathematics, including mathematical induction. I can also try (but not guarantee) to answer questions on Abstract Algebra -- groups, rings, etc. and Analysis -- sequences, limits, continuity. I won't understand specialized engineering or business jargon.

Experience

I taught at a two-year college for 25 years, including all subjects from algebra to third-semester calculus.

Education/Credentials
-----------

©2012 About.com, a part of The New York Times Company. All rights reserved.