Determinant is defined for square matrices and represents a transformation from $\real^{n \times n} \to \real$. Its defined as follows for $2 \times 2$ and $3 \times 3$ matrices \begin{align} A &= [a]\newline \detm{A} &= a\newline A &= \begin{bmatrix} a &b\newline c &d \end{bmatrix}\newline \detm{A} &= ac - bd\newline A &= \begin{bmatrix} a &b &c\newline d &e &f\newline g &h &i \end{bmatrix}\newline \detm{A} &= a(ei-hf) - b(di - gf) + c(dh - ge) \end{align}
More precisely, read below on how the formula is derived
For any element $a_{ij}$ of the matrix $A$, the minor $M_{ij}$ is the determinant of the matrix obtained after removing the $i$ row and $j$ column.
Since the determinant of a single element is the element itself, the minor of any element of a $2 \times 2$ matrix is the diagonally opposite element.
The minor $M_{ij}$ multiplied by $(-1)^{i+j}$ is called the cofactor $C_{ij}$. \begin{align} C_{ij} = (-1)^{i+j}M_{ij} \end{align}
The transpose of the matrix obtained after replacing all the elements of the matrix with their cofactors is called adjoint, Adj(A). The adjoint is thus another matrix. \begin{align} Adj(A)_{ij} = [C_{ij}]^{T} \end{align}
Let $A$ be a $n \times n$ matrix. Consider any row (or column) $i$ of the matrix. \begin{align} \detm{A} = \sum_{j=1}^{n} a_{ij} C_{ij} \end{align}
Thus, the determinant can be obtained by expansion along any row or column. In calculation of the cofactors, the $\pm$ sign will keep alternating as is evident from the above formula. We can verify that the definition for determinants of $2 \times 2$ and $3 \times 3$ can be derived from this formula.