How to obtain submatrix of a given matrix of any size? Actually I have a matrix A of order n×n with all non-singlular submatrices of order n−1 and n−2. Now I need another matrix B whose (i,j)th entry is detA(i,j)detA(i), where detA(i,j) denote the determinant of the sub matrix of A formed by deleting ith and jth rows and columns, and detA(i) denote the determinant of the sub matrix of A formed by deleting ith row and column. I'm unable to generate the submatrices A(i,j) for every element.