# Is Cramer's rule efficient for computational point of view?

I am not sure if Cramer's rule is used for computation purposes. Your help would mean a lot. Thanks!

• no. check some linear analisys book. like burden or Kincaid – Luis Felipe Oct 6 '15 at 11:56
• It has rather theoretical importance. It is used to prove some theorems in linear algebra. – user137035 Oct 6 '15 at 12:00
• See this as well. – J. M. is a poor mathematician Oct 6 '15 at 14:43
• Cramer's rule is often handy for small, fixed-size matrices like 3x3. I use it in computer graphics work occasionally. – Tavian Barnes Oct 6 '15 at 17:41
• Actually I would go a step further than "don't use Cramer's rule". If you are calculating the determinant or the inverse of a matrix as part of a bigger algorithm, that is almost always a bad thing to do. Mathematical formulas using matrix inverses often look neat, but that doesn't mean they are the best way to calculate something. – alephzero Oct 6 '15 at 18:16

## 2 Answers

Cramer is highly inefficient, of time complexity $O(n! \times n)$ with a naive determinant-finding algorithm, and $O(n^4)$ with e.g. LU decomposition. Gaussian elimination has cubic complexity.

• That's only if the deteminant is computer by definition. It may be computed by LU decomposition as well, in which case the complexity would be $O(n^4)$. – Sasha Oct 6 '15 at 11:56
• Fair enough. I'll add that in, thanks. – Patrick Stevens Oct 6 '15 at 11:57
• On a tangent: is there a difference between $O(n! \times n)$ and $O(n!)$? I'm thinking $O(n! \times n) \approx O((n+1)!) \approx O(n!)$? – Nick T Oct 6 '15 at 21:06
• $O((n+1)!)$ is not $O(n!)$ any more than $O(n^{k+1})$ is $O(n^k)$. – R.. Oct 6 '15 at 21:22

Reducing the matrix to triangular form and multiplying the elements on the diagonal is usually quicker. I am pretty sure that is the algorithm most computer algebra systems use, unless it is known in advance that the matrix has some special properties. Sometimes Laplace expansion can be quicker if the matrix has many zeros along some rows/columns.