Matrix Algebra : matrix inverse

Screen Link: Learn data science with Python and R projects

My Code:

matrix_a = np.asarray([
    [1.5, 3],
    [1, 4]
])

def matrix_inverse_two(mat):
    det = (mat[0,0]*mat[1,1] - mat[0,1] * mat[1,0])
    if det == 0:
        raise ValueError("The matrix isn't invertible")
    right_mat = np.asarray([
        [mat[1,1], -mat[0,1]],
        [-mat[1,0], mat[0,0]]
    ])
    inv_mat = np.dot(1/det, right_mat)
    return inv_mat

inverse_a = matrix_inverse_two(matrix_a)
i_2 = np.dot(inverse_a , matrix_a)

print(i_2)

det = (mat[0,0]*mat[1,1] - mat[0,1] * mat[1,0])
why it multiple [0,0]? it said determinant equals to ad-bc. the formula above doesn’t equal to ad - bc…

mat[0, 0] is a.

\begin{bmatrix} a & b \\ c & d \end{bmatrix} = \begin{bmatrix} mat[0,0] & mat[0,1] \\ mat[1,0] & mat[1,1] \end{bmatrix}