# Matlab, 40 <s>27</s> bytes Using an anonymous function: @(A)mat2str(fix(inv(A+eps)*det(A+eps)')) Input is in standard Matlab format, that is, `[-3,2,-5; -1,0,-2; 3,-4,1]`, where commas can be replaced by spaces, and spaces after `;` can be removed. `eps` is added in case the matrix is singular. It is "removed" using `fix` (the true result is guarantted to be an integer). Example: >> @(A)mat2str(fix(inv(A+eps)*det(A+eps)')) ans = @(A)mat2str(fix(inv(A+eps)*det(A+eps)')) >> ans([-3,2,-5; -1,0,-2; 3,-4,1]) ans = [-7 18 -3;-4 12 -1;3 -6 1] Example with singualr matrix: >> @(A)mat2str(fix(inv(A+eps)*det(A+eps)')) ans = @(A)mat2str(fix(inv(A+eps)*det(A+eps)')) >> ans([1,0 ; 0,0]) ans = [0 0;0 1] Or [try it online](http://ideone.com/E6BBHH) in Octave.