I want to solve the linear equation below:(adsbygoogle = window.adsbygoogle || []).push({});

[tex]Ax = b[/tex]

For this purpose, I'm writing a C++ code. I have written both routines for decomposing A matrix to L and U matrices, and for calculating inverse of A matrix.

I may multiply both sides with A^{-1}:

[tex]Ax = b[/tex]

[tex]A^{-1}Ax = A^{-1}b[/tex]

[tex]x = A^{-1}b[/tex]

Or, I can use LU decomposition:

[tex]Ax = b[/tex]

[tex]A = LU[/tex]

[tex]Ax = LUx = Ly = b[/tex]

[tex]Solve\,\,\,\,\, Ly = b\,\,\,\,\, for\,\,\,\,\, y[/tex]

[tex]Solve\,\,\,\,\, Ux = y\,\,\,\,\, for\,\,\,\,\, x[/tex]

LU decomposition method is said to be faster. But, I'm not sure if these rumors are true for all cases. I have a feeling that the first method (matrix inversion method) would be faster for smaller A matrices.

My question is, how do I prefer which method to use?

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Solving Ax=b; when to use LU decomposition?

Loading...

Similar Threads - Solving Ax=b decomposition | Date |
---|---|

I Solving System of Equations w/ Gauss-Jordan Elimination | Sep 18, 2017 |

I Solving a system of linear equations using back substitution | Aug 30, 2017 |

I Matrix Equation -- clarification about solving a system | Aug 1, 2017 |

A If [A,B]=0, are they both functions of some other operator? | Jul 20, 2017 |

**Physics Forums - The Fusion of Science and Community**