# Thread: fastest solution to simultaneous linear equations

1. ## fastest solution to simultaneous linear equations

Hi, I'm writing a program which solves for a list of coefficients in
matrix form:
b = [b1,b2,b3...]

The equation I'm trying to solve is:
Ab = z
where A is a symmetric matrix and z has the same dimensions as b.

The obvious solution is b = invs(A) z. However A is at least a 12x12 so
the inverse takes a long time to calculate (obviously).
Is there some other method which is faster?

2. ## Re: fastest solution to simultaneous linear equations

Well, technically, as long as the matrix is not symbolic or ridiculously complex, the inverse method should work. But if you want another method, try LU decomposition followed by either the Gauss-Seidel method or the Jacobi method. Not sure how much faster these methods will be though. They are well researched if you want to find either an algorithm or just a mathematical representation of them somewhere.

3. ## Re: fastest solution to simultaneous linear equations

Thanks, I will look into them

4. ## Re: fastest solution to simultaneous linear equations

Originally Posted by fredhenry
Thanks, I will look into them
fred,
I don't know if you've seen it yet, but CRG posted a good answer at a cross-posting local...
http://www.mymathforum.com/viewtopic...=linear#p88811

-----------------

Originally Posted by CRGreathouse
As a rule of thumb, never invert.

Usually equations like this are solved directly. For example, in gp (see my .sig):
Code:
A=mathilbert(12) \\ example matrix
b=vectorv(12,i,i) \\ example column vector
matsolve(A,b)
This is fast -- the example system can be solved in less than 400 microseconds on my machine, even using rational arithmetic. The 100x100 version takes 40 milliseconds at 28-digit precision.

What language are you using?