Reduced Echelon form program

This is a discussion on Reduced Echelon form program within the C Programming forums, part of the General Programming Boards category; How can I make a program that solves for the reduced echelon form of a matrix? I dont know how ...

  1. #1
    Registered User
    Join Date
    Aug 2012
    Location
    Manila, Philippines, Philippines
    Posts
    1

    Reduced Echelon form program

    How can I make a program that solves for the reduced echelon form of a matrix?

    I dont know how to show it but it involves a lot of row operations between each row of the matrix

    confused :|

    here's the definition of a echelon form
    Row echelon form - Wikipedia, the free encyclopedia

  2. #2
    Registered User
    Join Date
    Sep 2008
    Location
    Toronto, Canada
    Posts
    1,832
    Did you want to make a row-echelon form from a matrix, or solve the coefficients from an echelon form matrix?

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,847
    Well I guess the thing to do is read a few more web pages on the topic until you "get it".
    Row echelon form - Google Search

    This site (on google's first page of hits) seems to explain things with some practical interactive examples.
    Linear Algebra Toolkit
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User
    Join Date
    Oct 2011
    Posts
    890
    You write a program that does Gaussian elimination. The article starts with three equations,
    Code:
     2x + y -  z =   8
    -3x - y + 2z = -11
    -2x + y + 2z =  -3
    The augmented matrix is
    Code:
     2    1   -1       8      (L1)
    -3   -1    2     -11      (L2)
    -2    1    2      -3      (L3)
    I've added the row vector name on the right, so you can easily follow what is done to each row vector, and how you get the row echelon rows.

    The idea is to go over each column, from left to right. Ignoring rows already in row echelon form, select the row with the largest value in magnitude in that column. Add the row vector to all the other row vectors not yet in row echelon form, scaling so that the value in that column will be zero. Divide the selected row by its value in that column, and that row is then the next row in row echelon form.

    In this case, the largest value in magnitude in the leftmost column is on the second line. That will become the first row in row echelon form (after dividing by -3, since it has that value in the first column). First, however, we'll need to add that row vector (scaled by 2/3) to the first row, and (scaled by -2/3) to the third row:
    Code:
     1  1/3 -2/3    11/3      (row echelon form, row R1 = -1/3 L2)
    
     0  1/3  1/3     2/3      (L4, L4 = L1 + 2/3 L2)
     0  5/3  2/3    13/3      (L5, L5 = L3 - 2/3 L3)
    For the second column, the largest value in magnitude is in the last row. When scaled by 3/4, it will become the second row in row echelon form. Before that, though, we need to add the row (scaled by -(1/3)/(5/3) = -1/5) to the last row left:
    Code:
     1  1/3 -2/3    11/3      (row echelon form, row R1)
     0    1  2/5    13/5      (row echelon form, row R2 = 3/5 L5)
    
     0    0  1/5    -1/5      (L6, L6 = L4 - 1/5 L5)
    The last row obviously has the largest value in magnitude (1/5, so scale by 1/(1/5) = 5 to get the row echelon row vector). We get
    Code:
     1  1/3 -2/3    11/3      (row echelon form, row R1)
     0    1  2/5    13/5      (row echelon form, row R2)
     0    0    1      -1      (row echelon form, row R3 = 5 L6)
    The augmented matrix is now in row echelon form. It has also reduced the equations into
    Code:
     x + 1/3 y - 2/3 z = 11/3
             y + 2/5 z = 13/5
                     z = -1
    You can do a pass over the rows, starting at the final row, to use the augmented matrix to calculate the value for each variable:
    Code:
        z = -1
    
        y + 2/5 z = 13/5
    =>  y = 13/5 - 2/5 z
    =>  y = 13/5 + 2/5 = 15/5
    =>  y = 3
    
        x + 1/3 y - 2/3 z = 11/3
    =>  x = 11/3 - 1/3 y + 2/3 z
    =>  x = 11/3 - 1 - 2/3
    =>  x = 2

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. help with reduced fractions
    By southpark in forum C Programming
    Replies: 1
    Last Post: 10-12-2010, 03:28 AM
  2. Replies: 1
    Last Post: 07-30-2008, 11:45 AM
  3. how to get a reduced form
    By silent_eyes in forum C++ Programming
    Replies: 3
    Last Post: 02-25-2005, 10:15 PM
  4. Row-echelon form of a matrix
    By Leeman_s in forum C++ Programming
    Replies: 7
    Last Post: 05-17-2003, 10:01 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21