Compute the inverse of a matrix over QQ

Compute the inverses of the following two matrices over $\mathbb{Q}$.

$A = \left[ \begin{array}{ccc} \text{-}7 & \text{-}1 & \text{-}4 \\ 7 & 1 & 3 \\ 1 & 0 & 0 \end{array} \right]$
$B = \left[ \begin{array}{cccc} 1 & 1 & 0 & 2 \\ 0 & 2 & 1 & \text{-}1 \\ 0 & 2 & 0 & 0 \\ \text{-}1 & 1 & 1 & 0 \end{array} \right]$

We will use the strategy suggested by the previous exercise.

Evidently, the reduced row echelon form (over $\mathbb{Q}$) of $[A|I]$ is $\left[ \begin{array}{ccc|ccc} 1 & 0 & 0 & 0 & 0 & 1 \\ 0 & 1 & 0 & 3 & 4 & \text{-}7 \\ 0 & 0 & 1 & \text{-}1 & \text{-}1 & 0 \end{array} \right]$. Thus $A^{-1} = \left[ \begin{array}{ccc} 0 & 0 & 1 \\ 3 & 4 & \text{-}7 \\ \text{-}1 & \text{-}1 & 0 \end{array} \right]$.

Likewise, the reduced row echelon form (over $\mathbb{Q}$) of $[B|I]$ is $\left[ \begin{array}{cccc|cccc} 1 & 0 & 0 & 0 & 1/3 & 2/3 & \text{-}1/2 & \text{-}2/3 \\ 0 & 1 & 0 & 0 & 0 & 0 & 1/2 & 0 \\ 0 & 0 & 1 & 0 & 1/3 & 2/3 & \text{-}1 & 1/3 \\ 0 & 0 & 0 & 1 & 1/3 & \text{-}1/3 & 0 & 1/3 \end{array} \right]$. Thus $B^{-1} = \left[ \begin{array}{cccc} 1/3 & 2/3 & \text{-}1/3 & \text{-}2/3 \\ 0 & 0 & 1/2 & 0 \\ 1/3 & 2/3 & \text{-}1 & 1/3 \\ 1/3 & \text{-}1/3 & 0 & 1/3 \end{array} \right]$.