473,378 Members | 1,334 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Need help in Matrix and Invers!!!

21
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
Nov 29 '06 #1
5 2346
Banfa
9,065 Expert Mod 8TB
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.
Nov 29 '06 #2
macklin01
145 100+
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
Expand|Select|Wrap|Line Numbers
  1. a b
  2. c d
  3.  
since it's a bit hard to get the formatting just right.

By the definition of an inverse matrix, you need
Expand|Select|Wrap|Line Numbers
  1. [a,b;c,d] [e,f;g,h] = [1,0;0,1]
  2.  
Do the matrix multiplication:
Expand|Select|Wrap|Line Numbers
  1. [ae+bg,af+bh;ce+dg,cf+dh] = [1,0;0,1]
  2.  
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
Nov 29 '06 #3
Budiman
21
Can you please just give me the complete program?
Dec 2 '06 #4
Budiman
21
the matrix only 2x2, don't make it to 3x3 or others
Dec 2 '06 #5
macklin01
145 100+
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
Dec 2 '06 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Yudan Yi | last post by:
I have a problem to copy (assign) a matrix to another matrix. Curreny, I know copy the number using loops, while it will take some time, I wonder if there have faster method. The following code...
11
by: Micha | last post by:
Hello there, I think I've run into some classic c++ pitfall and maybe some of you guys can help me out. For my project I will need to use matrices and vectors and so I decided to implement them...
6
by: vishnu mahendra | last post by:
hello to all, can any one please give me an algorithm to find inverse of a matrix of order n rows and m columns. thank you in advance, vishnu.
20
by: Frank-O | last post by:
Hi , Recently I have been commited to the task of "translating" some complex statistical algorithms from Matlab to C++. The goal is to be three times as fast as matlab ( the latest) . I've...
11
by: Budiman | last post by:
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...
1
by: Budiman | last post by:
Guys can you help me to make a program in matrix and the inverse. For example i have variable a b c d And i want to make the inverse from a,b,c,and d. Thanks for all your help
21
by: =?UTF-8?B?TWFydGluIFDDtnBwaW5n?= | last post by:
Hello, I´m using a very large 2-dimensional double matrix (45.000x45.000) in my program. At the initialization of the matrix: double matrix = new double I am getting an out of memory...
1
by: jinxy | last post by:
Hello, this is my code in visual c#: namespace im_client { public partial class Form2 : Form { MySqlConnection conDatabase = new MySqlConnection("Data Source=86.123.220.28;" +...
5
by: adam.kleinbaum | last post by:
Hi there, I'm a novice C programmer working with a series of large (30,000 x 30,000) sparse matrices on a Linux system using the GCC compiler. To represent and store these matrices, I'd like to...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.