Two matrices can be multiplied only if their sizes are compatible. Suppose that U is an m × n matrix, and that V is a p × q matrix. In order for U•V to make sense, what must be true of the dimensions of these matrices? Although matrix multiplication uses dot products, it is common to write UV without the dot, which will be done from now on.

In order for the product of matrices U and V, denoted as UV, to make sense, the number of columns in U must equal the number of rows in V.

Let's consider the dimensions of the matrices U and V. U is an m × n matrix, where m represents the number of rows and n represents the number of columns. V is a p × q matrix, where p represents the number of rows and q represents the number of columns.

For matrix multiplication, the number of columns in the first matrix (U) must be equal to the number of rows in the second matrix (V). Therefore, for UV to be well-defined, n (the number of columns in U) must equal p (the number of rows in V).

So, the condition for the matrices U and V to be compatible for multiplication is that n = p.

Once this condition is met, the resulting matrix UV will have dimensions of m × q, where m is the number of rows in U and q is the number of columns in V.

Remember that matrix multiplication is not commutative, meaning that U•V is not necessarily equal to V•U. The order matters, and for the product to be defined, the dimension compatibility condition must be satisfied.