The determinant of a matrix is somewhat complicated in general, so you may want to check one of the reference books. The $2\times2$ and $3\times3$ cases can be memorized using the examples below.
The determinant of a $2\times2$ matrix is given by $$\det\left(\begin{array}{cc} a&b\\ c&d\\ \end{array} \right) = ad-bc.$$
The determinant of a $3\times3$ matrix is computed as follows: \begin{align*} \left|\begin{array}{ccc} a&b&c\\ d&e&f\\ g&h&i\\ \end{array}\right| &= \det\left(\begin{array}{ccc} a&b&c\\ d&e&f\\ g&h&i\\ \end{array}\right) = a\cdot \left|\begin{array}{cc} e&f\\ h&i\\ \end{array}\right| - b\cdot \left|\begin{array}{cc} d&f\\ g&i\\ \end{array}\right| + c\cdot \left|\begin{array}{cc} d&e\\ g&h\\ \end{array}\right|\\ &= a\cdot(ei-hf)-b\cdot(di-gf)+c\cdot(dh-ge)\\ &= aei-ahf-bdi+bgf+cdh-cge . \end{align*} The smaller $2\times2$ determinants are called the cofactors of the elements $a$, $b$, and $c$, respectively. The minus sign in front of $b$ is part of the cofactor. Cofactors are formed by keeping only what is left after eliminating everything from the row and column where the element desired resides. So, for $a$, the row elements, $b$ and $c$, and the column elements, $d$ and $g$, are eliminated, leaving the $2\times2$ matrix shown above.
Computing $4\times4$ matrices is a straightforward extension of the above procedure, but it is easier to just go to a computer!!!
Try it for yourself by determining $$ \det\left(\begin{array}{ccc} 1&2&3\\ 4&5&6\\ 7&8&9\\ \end{array} \right)$$