private Matrix subMatrix(Matrix matrix, int row, int column) {

        Matrix result = new Matrix(matrix.getRows() - 1, matrix.getColumns() - 1);

        int rowIndex = 0;
        int colIndex = 0;

        for (int x = 0; x < matrix.getRows(); x++) {
            colIndex = 0;
            for (int y = 0; y < matrix.getColumns(); y++) {
                if ((x != row) && (y != column)) {
                    result.setElement(rowIndex, colIndex, matrix.getElement(x, y));
                }
                if (column != y) {
                    colIndex++;
                }
            }
            if (row != x) {
                rowIndex++;
            }
        }

        return result;
    }