Determinant of a matrix using LU decomposition

This macro calculates the determinant of a matrix by finding its LU decomposition. In other words, by transforming a matrix to a product of a lower (L) and an upper (U) triangular matrix, the determinant can be expressed as the product of the diagonal elements of both matrices.

Download the Macro

Be sure that Minitab knows where to find your downloaded macro. Choose Tools > Options > General. Under Macro location browse to the location where you save macro files.


If you use an older web browser, when you click the Download button, the file may open in Quicktime, which shares the .mac file extension with Minitab macros. To save the macro, right-click the Download button and choose Save target as.

Required Inputs

  • A square matrix (the numbers of rows and columns must be equal)

Optional Inputs

Use to specify two empty matrices to store the Lower and Upper triangular matrices.

Running the Macro

Suppose you want to calculate the determinant of a matrix stored in M1. You want to store the upper and lower triangular matrices in M2 and M3, respectively. To run the macro, choose Edit > Command Line Editor and type:


Click Submit Commands.

By using this site you agree to the use of cookies for analytics and personalized content.  Read our policy