Determinant in terms of element & block of a matrix

30 Views Asked by At

Dear fellow researchers,

I have encountered a peculiar problem in finding determinant of a matrix in terms of block and an element like following.
$$\text{det}\left[\begin{array}{rr} \mathbf{A} & \mathbf{b} \\ \mathbf{c} & d \end{array}\right] = \text{det}\left(\mathbf{A}\right) \left(d - \mathbf{c}^T \mathbf{A}^{-1} \mathbf{b}\right) $$ Here $\mathbf{A}, \mathbf{b}, \mathbf{c}$ and $d$ are of orders $(p-1) \times (p-1)$, $1 \times (p-1)$, $(p-1) \times 1$ and $1 \times 1$ respectively. For example, for the following matrix I wanted to find the determinants in terms each element and corresponding block matrix, one by one. $$ \text{det}\left[\begin{array}{rrrr} 3 & -1 & 2 & 1 \\ -1 & 5 & 3 & 2 \\ 2 & 3 & 4 & -1 \\ 1 & 2 & -1 & 2 \end{array}\right]$$.

Theoretically, all the determinants resulting from fixing an element and using the corresponding rest of the row-column vectors and rest matrix, must have same values. For example, corresponding to $(1,1)$ element the determinant can be calculated as $$ \text{det} \left[\begin{array}{rrr} 5 & 3 & 2 \\ 3 & 4 & -1 \\ 2 & -1 & 2 \end{array}\right]\times \left( 3 - \left[\begin{array}{rrr} -1 & 2 & 1 \end{array}\right] \times \left[\begin{array}{rrr} 5 & 3 & 2 \\ 3 & 4 & -1 \\ 2 & -1 & 2 \end{array}\right]^{-1} \left[\begin{array}{rrr} -1 \\ 2 \\ 1 \end{array}\right] \right) $$ Taking another instance for $(3,1)$ element the above calculation will become $$ \text{det} \left[\begin{array}{rrr} -1 & 2 & 1 \\ 5 & 3 & 2 \\ 2 & -1 & 2 \end{array}\right]\times \left( 2 - \left[\begin{array}{rrr} 3 & -1 & 1 \end{array}\right] \times \left[\begin{array}{rrr} -1 & 2 & 1 \\ 5 & 3 & 2 \\ 2 & -1 & 2 \end{array}\right]^{-1} \left[\begin{array}{rrr} 3 \\ 4 \\ -1 \end{array}\right] \right) $$ Theoretically all of these must give same determinant values same as the determinant of the original matrix. But the results are varying too much. In case of the diagonal elements determinant values are same $= -173$, but for the off-diagonal elements the results are varying too much. Like in the 2nd case above the determinant value is coming as $-104$.

Can anybody please help me in trapping the error?

Putting the python code here:

for jj in range(4):
    for ii in range(jj+1):
        rr = cc = np.array(range(4))
        xx_elem = xx[ii,jj]
        xx_colvec = np.delete(xx[:, jj], ii)
        xx_rowvec = np.delete(xx[ii, :], jj)
        print('Element is: ', xx[ii,jj])
        print('Column Vector is: \n', xx_colvec)
        print('Row vec is: \n', xx_rowvec)
        xx_rest = xx[np.ix_(np.delete(rr, ii), np.delete(cc, jj))]
        print('Rest Matrix is: \n', xx_rest)
        det = np.linalg.det(xx_rest) * ((-1)**(ii+jj+2) * xx_elem -  [email protected](xx_rest)@xx_rowvec.T).item()
        print('Determinant is: ', det)
        print('==================================================')

   

Thanks in advance.