Inverse and determinant of square matrix

Inverse and determinant of a square matrix are determined using only simple matrix multiplication
Updated 30 Nov 2012

View License

The inverse (AI) and determinant (det) of a given square matrix (AO) may be directly found by
[AI,det] = inv1(AO)
It uses automatic pivoting scheme. All computations involves only simple matrix multiplication.

The direct result without pivoting may also be found by
AI = inv0(AO)
The sourse code is only 4 statement lines. Yet it works for AO = randn(n), even n = 1000.
However, it fails for some simple peculiar matrix, such as AO = [0 1; 1 0].

Cite As

Feng Cheng Chang (2024). Inverse and determinant of square matrix (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R13
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Matrices and Arrays in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes

Update the m-file, involving direct automatic optional pivoting scheme.

Updated after some crucial comments.

updated to including pivotings.

update m-file