if you head over to www.delphi3d.net the DOT framework has a very good geometry unit which has matrix invert, it should give you some pointers.