Each element of a matrix has a minor. The minor is the determinant of a smaller matrix cut from the original matrix. We can find a matrix of minors by finding the minor for each element of a matrix.
To find the minor of element i, j in a 3 X 3 matrix M, remove row i and column j of the matrix. The determinant of the resulting 2 X 2 matrix is the minor of element .
We can find the minor of a 2 X 2 matrix in a similar fashion. To find the minor of element i, j, remove row i and column j. The remaining scalar is the determinant. In the case of a 2 X 2 matrix, this determinant is the minor.
We're going to implement a helper function, Cut
. The purpose of this function is to cut a 2 X 2 matrix from a 3 X 3 by eliminating one row and one column. Once we have the Cut
function, implementing the Minor
for a 3 X 3 matrix is straightforward: loop through the matrix, for every element assign the determinant of a 2 X 2 acquired by cutting the elements row and column from the...