A confusion matrix is a table counting how a classifier's predicted classes line up with the actual classes. For two classes it is a 2 × 2 grid of true positives, false positives, false negatives and true negatives. With k classes it is k × k, with correct predictions on the diagonal.
Example: an email classifier with classes work, personal and spam is tested on 100 emails; rows are actual classes, columns predicted. The diagonal holds 35, 24 and 28, so accuracy is 87%. The personal row covers 30 emails: 24 correct, 4 called work and 2 called spam, so recall for personal is 24/30 = 0.80. The largest off-diagonal cell shows the worst confusion.
Most classification metrics are ratios of its cells, so interviewers hand you one and ask for precision, recall or specificity. Each decision threshold gives a different matrix, and which error costs more depends on the problem: a missed tumor or a spam false alarm. On imbalanced data, normalize each row to sum to 1.