Need help in Matrix and Invers!!!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Budiman
    New Member
    • Nov 2006
    • 21

    Need help in Matrix and Invers!!!

    Hello friends, i need help for my assignment.
    For example i give input for a, b, c, d in matrix mode example like
    |a b|
    |c d|
    and i want to convert it to invers from that matrix, i hope you give the answer(if possible with the explanation).
    Thx so much for your help
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    start with your matrix

    |a b|
    |c d|

    and the identity matrix

    |1 0|
    |0 1|

    Use matrix line operations to convert the original matrix to the identity matrix, at the same time perform exactly the same operations on the identity matrix.

    When you have finished your original matrix will be the identity matrix and the identity matrix will be the inverse of your matrix.

    Comment

    • macklin01
      New Member
      • Aug 2005
      • 145

      #3
      Will the matrices always be 2 x 2? If so, there's a known, explicit inversion formula for that. (Google for it, or look on places like MathWorld or Planet Math.) You can figure it out yourself on paper very easily, too.

      I'm going to use the matlab-like notation [a,b;c,d] to represent the matrix
      Code:
      a b
      c d
      since it's a bit hard to get the formatting just right.

      By the definition of an inverse matrix, you need
      Code:
      [a,b;c,d] [e,f;g,h] = [1,0;0,1]
      Do the matrix multiplication:
      Code:
      [ae+bg,af+bh;ce+dg,cf+dh] = [1,0;0,1]
      Two matrices are equal iff all the corresponding entries are equal. So,

      ae + bg = 1
      af + bh = 0
      ce + dg = 0
      cf + dh = 1

      Four equations in four unknowns. You just need to use some simple algebra from here.

      For larger matrices, I'd recommend googling for "Gaussian elimination with partial pivoting." That algorithm is usually used to solve the system Ax = b by adjoining the matrices like [A | b], but if you use an identity matrix I in place of b and adjoin [A | I], then you'll get the inverse of A when you're done. GEPP is the way to keep track of all the operations that were suggested to you by the previous poster. If your matrix system turns out to be ill-conditioned (poorly behaved), then "Gaussian elimination with full pivoting" (GEFP) may be in order. In practice, I've never encountered small matrix systems that needed full pivoting.

      For even larger matrices, note that it's not computationally practical to find the full inverse matrix (nor even desirable). If you want to solve Ax = b for large matrices A, then you'll need to use iterative techniques (which give approximations to the solution that converge as you continue to iterate) like conjugate gradients (if A is symmetric and positive definite), biconjugate gradient, successive overrelaxation (SOR), Jacobi iteration, Gaussi-Seidel, etc. I routinely have to solve systems of approximately 250,000 variables for my cancer research on desktop systems, and it would be a non-starter to invert the matrix, particularly given that we need to solve several such systems per simulated time step (aproximately one simulated hour), for a total simulation of 30-180 virtual days.

      I hope you enjoy your project--matrix inversion sounds simple, but is actually a rich research topic in and of itself, and it forms a major part of the foundation of scientific computing. (To solve partial differential equations, you just end up discretizing the equation and writing it as a system of linear equations. Voila: you've translated a differential equation problem into a massive linear algebra problem.) -- Paul

      Comment

      • Budiman
        New Member
        • Nov 2006
        • 21

        #4
        Can you please just give me the complete program?

        Comment

        • Budiman
          New Member
          • Nov 2006
          • 21

          #5
          the matrix only 2x2, don't make it to 3x3 or others

          Comment

          • macklin01
            New Member
            • Aug 2005
            • 145

            #6
            If you're not even interested, just google for the well-known, explicit formula (inverse of a 2 x 2 matrix). Wikipedia has it. I'm sure planetmath and mathworld do, too. A host of websites probably has it. (I found the explicit formula in a brief, 2-second web search.)

            If you lack the curiosity to come up with the answer yourself even when provided a host of hints from more than one person, and if you lack the resourcefulness to search for somebody else's answers, then math/science/engineering/computer science may not be for you.

            I'm not trying to put you down here in any way, but you really need to give this some thought. -- Paul

            Comment

            Working...