Inverse of a $4 \times 4$ matrix with variables I missed my class on the inverses of matrices. I'm catching up well, but there's a problem in the book that got me stumped. 
It's a $4 \times 4$ matrix that is almost an identity matrix, but whose bottom row is $a,b,c,d$ instead of $0,0,0,1$.
$$\begin{pmatrix}
1 &0  &0  &0 \\ 
0 &1  &0  &0 \\ 
 0& 0 & 1 &0 \\ 
a &b  & c & d
\end{pmatrix}$$
Any pointers? 
 A: The systematic way to compute an inverse to matrix $A$ is as follows.


*

*Adjoin the identity to $A$, i.e. $[A|I]$, to form a matrix with $n$ rows and $2n$ columns.

*Perform row reduction to turn $A$ into the identity.  
3a. If you can't, i.e. there's a row of all zeroes, then $A$ is not invertible.
3b. If you can, the result will be $[I|B]$, for some matrix $B$.  This $B$ is the inverse of $A$.
A: Recall that one way to compute an inverse is by forming the augmented matrix
$$
(A \vert I)
$$
and then using Gaussian elimination to completely row-reduce $A$. The final result will be of the form
$$
(I \vert A^{-1}).
$$
So, in this case, you would write
$$
\begin{bmatrix}
1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 & 0 & 1 & 0 & 0 \\
0 & 0 & 1 & 0 & 0 & 0 & 1 & 0 \\
a & b & c & d & 0 & 0 & 0 & 1
\end{bmatrix}
$$
and the first step would be to add $-a \times$ (first row) to (last row), i.e.
$$
\begin{bmatrix}
1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 & 0 & 1 & 0 & 0 \\
0 & 0 & 1 & 0 & 0 & 0 & 1 & 0 \\
0 & b & c & d & -a & 0 & 0 & 1
\end{bmatrix}
$$
etc.
A: Using SymPy Live, we compute the RREF of the augmented matrix:
>>> a, b, c, d = symbols('a b c d')
>>> M = Matrix(([1,0,0,0,1,0,0,0],[0,1,0,0,0,1,0,0],[0,0,1,0,0,0,1,0],[a,b,c,d,0,0,0,1]))
>>> M
[1  0  0  0  1  0  0  0]
[                      ]
[0  1  0  0  0  1  0  0]
[                      ]
[0  0  1  0  0  0  1  0]
[                      ]
[a  b  c  d  0  0  0  1]
>>> M.rref()
([1  0  0  0   1    0    0   0], [0, 1, 2, 3])
 [                            ]               
 [0  1  0  0   0    1    0   0]               
 [                            ]               
 [0  0  1  0   0    0    1   0]               
 [                            ]               
 [            -a   -b   -c   1]               
 [0  0  0  1  ---  ---  ---  -]               
 [             d    d    d   d]

Viewing the matrix as a block matrix
$$\left[\begin{array}{ccc|c}
1 &0  &0  &0 \\ 
0 &1  &0  &0 \\ 
 0& 0 & 1 &0 \\
\hline 
a &b  & c & d
\end{array}\right] = 
\left[\begin{array}{c|c}
\mathrm I_3 & 0_3\\ 
\hline 
\mathrm r^T & d
\end{array}\right]$$
Assuming that $d \neq 0$,
$$\left[\begin{array}{ccc|c}
1 &0  &0  &0 \\ 
0 &1  &0  &0 \\ 
 0& 0 & 1 &0 \\
\hline 
a &b  & c & d
\end{array}\right]^{-1} = 
\left[\begin{array}{c|c}
\mathrm I_3 & 0_3\\ 
\hline 
\mathrm r^T & d
\end{array}\right]^{-1} =
\left[\begin{array}{c|c}
\mathrm I_3 & 0_3\\ 
\hline 
-d^{-1} \mathrm r^T & d^{-1}
\end{array}\right] =
\left[\begin{array}{ccc|c}
1 &0  &0  &0 \\ 
0 &1  &0  &0 \\ 
 0& 0 & 1 &0 \\
\hline 
-\frac ad & -\frac bd  & -\frac cd & \frac 1d
\end{array}\right]$$
