Computational complexity of Gaussian elimination

1.7k Views Asked by At

If it took me approximately 4 minutes to solve an equatian $Ax=b$ for $x$ (where $A$ is a $3\times3$ matrix and $b$ is a $3\times1$ matrix) using Gaussian elimination, how much longer would it take me to:

a) use Gaussian elimination to find $A^{-1}$ and then find $x=A^{-1}b$

b) if $A$ were a $30\times 30$ matrix and $b$ were a $30\times1$ matrix and I used Gaussian elimination to find $x$

c) if $A$ were a $30\times30$ matrix and $b$ were a $30\times1$ matrix and I used Gaussian elimination to find $A^{-1}$ and then find $x$ from $x=A^{-1}b$

I know there is an equation to use that helps you solve problems like this. I believe it is something like $(2/3)n^3$, but I am not sure how to use it, or even if that is the right equation.

1

There are 1 best solutions below

2
On

This is not a full answer, but it is a partial one! It will take less than twice as much time to invert $A$ as to solve $Ax=b$ for $x$. The multiplication to get to $x$ will take time proportional to the square of the matrix size (that is, proportional to the number of elements in the matrix). So if you just need to solve the one equation, inverting is definitely a bad idea, but if you need to solve a lot with the same matrix, it might be reasonable, except that

scary drumbeats

  1. If $A$ is not invertible, this will not work, and

  2. If $A$ is a nasty old beast of a matrix that's just barely invertible, and you're calculating numerically, then this could give bad results.

In practice, better-behaved numerical methods are used to "decompose" $A$ into matrices that are faster to work with. I don't, however, remember any of them.