Compatible Matrices
Compatible Matrices
Two matrices with dimensions arranged so that they may be multiplied. The number of columns of the first matrix must equal the number of rows of the second.

See also
Key Formula
Am×n⋅Bn×p=Cm×p
Where:
- A = The first matrix, with m rows and n columns
- B = The second matrix, with n rows and p columns
- C = The resulting product matrix, with m rows and p columns
- m = Number of rows in matrix A
- n = Number of columns in A, which must equal the number of rows in B
- p = Number of columns in matrix B
Worked Example
Problem: Determine whether matrices A and B are compatible for multiplication, and if so, find the dimensions of the product. A is a 2×3 matrix and B is a 3×4 matrix.
Step 1: Identify the dimensions of each matrix.
A is 2×3andB is 3×4
Step 2: Check the compatibility condition: the number of columns of A must equal the number of rows of B.
Columns of A=3,Rows of B=3
Step 3: Since 3 = 3, the matrices are compatible for multiplication.
3=3✓
Step 4: Determine the dimensions of the product matrix. The result takes the rows of A and the columns of B.
A⋅B=C2×4
Answer: Matrices A and B are compatible. Their product is a 2×4 matrix.
Another Example
This example involves three matrices and tests multiple products, showing that compatibility depends on order and that both AB and BA can be defined yet yield different-sized results.
Problem: Given three matrices — A (2×3), B (3×2), and C (2×5) — determine which of the products AB, BA, and AC are defined, and give the dimensions of each valid product.
Step 1: Check AB: columns of A (3) vs. rows of B (3).
A2×3⋅B3×2:3=3✓⇒Product is 2×2
Step 2: Check BA: columns of B (2) vs. rows of A (2).
B3×2⋅A2×3:2=2✓⇒Product is 3×3
Step 3: Check AC: columns of A (3) vs. rows of C (2).
A2×3⋅C2×5:3=2×
Step 4: Summarize results. Notice that AB and BA are both defined but produce matrices of different sizes. This illustrates that matrix multiplication is not commutative — even when both orders are valid, the results differ.
AB is 2×2,BA is 3×3,AC is undefined
Answer: AB is defined (2×2), BA is defined (3×3), and AC is not defined because the inner dimensions do not match.
Frequently Asked Questions
What makes two matrices compatible for multiplication?
Two matrices are compatible for multiplication when the number of columns in the first matrix equals the number of rows in the second. For example, a 4×3 matrix can multiply a 3×7 matrix because the inner dimensions (both 3) match. If they don't match, the multiplication is undefined.
Does the order of multiplication matter for compatible matrices?
Yes, order matters significantly. If A is 2×3 and B is 3×5, then AB is defined but BA is not (5 ≠ 2). Even when both AB and BA are defined, they generally produce different matrices with potentially different dimensions. Matrix multiplication is not commutative.
Can two square matrices always be multiplied together?
Two square matrices can be multiplied only if they are the same size. A 3×3 matrix and a 3×3 matrix are always compatible because the inner dimensions match. However, a 2×2 matrix and a 3×3 matrix are not compatible because 2 ≠ 3.
Compatible Matrices (for multiplication) vs. Compatible Matrices (for addition)
| Compatible Matrices (for multiplication) | Compatible Matrices (for addition) | |
|---|---|---|
| Condition | Columns of first = Rows of second (inner dimensions match) | Both matrices must have exactly the same dimensions |
| Example | A (2×3) and B (3×4) → product is 2×4 | A (2×3) and B (2×3) → sum is 2×3 |
| Result dimensions | Rows of first × Columns of second (outer dimensions) | Same dimensions as both original matrices |
| Order matters? | Yes — AB and BA may not both be defined | No — A + B = B + A always |
Why It Matters
You encounter compatible matrices whenever you solve systems of linear equations using matrix methods, apply transformations in computer graphics, or work with data in statistics. Checking compatibility is the very first step before performing any matrix multiplication — attempting to multiply incompatible matrices is undefined and a common source of errors in both hand calculations and programming. Understanding this concept also prepares you for linear algebra courses where matrix products appear constantly.
Common Mistakes
Mistake: Checking whether the rows (not columns) of the first matrix equal the columns (not rows) of the second matrix.
Correction: The rule involves the inner dimensions: columns of the first matrix must equal rows of the second. A quick way to remember: write the dimensions side by side (e.g., 2×3 and 3×4) and check that the two middle numbers match.
Mistake: Assuming that if AB is defined, then BA is also defined.
Correction: This is only guaranteed when both matrices are square and the same size. For non-square matrices, AB being defined says nothing about BA. Always check each product separately.
Related Terms
- Matrix — The fundamental object being multiplied
- Dimensions of a Matrix — Rows and columns that determine compatibility
- Matrix Multiplication — The operation that requires compatibility
- Column of a Matrix — Column count of first matrix must match row count of second
- Row of a Matrix — Row count of second matrix must match column count of first
- Square Matrix — Square matrices of the same size are always compatible
- Identity Matrix — Compatible with any same-sized square matrix, acts as multiplicative identity
