Matrix Pseudoinverse Calculator

For Singular or Non-Square, as well as Normal Matrix Inversions

This page allows you to experiment with my algorithm for inverting absolutely any matrix. You create the size you want, enter the values, and get the inverse.

Invert any matrix

In the following form, choose the number of rows and columns and click the "create" button. The script will create an empty matrix of the requested size and enable an "invert" button to calculate the inverse (A).



Working...

Pseudo-Inverse

...when calculated...

The inverted matrix (A-1) or pseudo-inverse (A), if the original was singular or non-square.


...when calculated...

And the original is reproduced here, as echo'd back from the servlet.


Null Space Matrix

...when calculated...

This is the matrix representing the null space of the original matrix. (I - A•A) If it is identically zero, the original problem was fully specified (or over specified).

If the original matrix is singular or non-square (over or under-determined), the product of the inverse and the original (AA) is not necessarily identity (I). If the matrix has only one solution, the null-space matrix will be identically zero.

If you multiply the original matrix times the product of the null space matrix and any arbitrary vector, the resulting product will be identically zero (indicating no arbitrariness in the solution).


Property confirmation matrices

...when calculated...

This matrix is the inverse times the original (A•A). If the problem was fully specified (or over specified), this will be the identity matrix. If not, it may be close to the identity matrix, depending upon now large is the null-space.


...when calculated...

This matrix is the original times the inverse times the original (A•A•A). If all went well, this should be the original back again (Moore-Penrose property number 1 - see the description in the text).


...when calculated...

This matrix is the inverse times the original times the inverse (A•A•A). If all went well, it should be the same as the inverse again (Moore-Penrose property number 2).

The code being used for this demonstration is available from the links above. The Java servlet, the JavaScript, my home-grown AJAX library, the Java code to do the inverse and related operations, and test code for testing the Java code. Nothing is hidden, nothing is magic.

The values displayed above are all rounded to a few digits in the servlet or the JavaScript. This was done because the numerical calculations introduce numbers like 2.99999999999999 when what we want to see is 3.0. The servlet and JavaScript also truncate numbers less than a tiny amount (something like 1.0E-10) to 0.0 because these are usually introduced by roundoff errors in the calculations. If you need to use numbers in that range, either scale the problem or use the Java matrix class directly.

This version works with floating point numbers, but the C++ template mentioned on the Matrix Inversions page will invert anything that has certain operations defined. When I have more time and inclination, and when the language matures to the point where I can create objects of the instantiated type and constants for zero and unity of the instantiated type, I'll extend the Java version. If I get on another C# project, I may do one of those as well; I didn't have time during the last such project. Also, my bandwidth is not very large, so please be patient with getting responses (I'm running several such sites from my house). And if you have firebug installed, you can see the returned xml document that contains all the data to finish populating the page.

If you find a good use for my algorithm, or make useful extensions, please send me the information. Send comments to rchuso at gmail dot com.