How does matrix multiplication work?
Matrix multiplication is done by taking the dot product of rows from the first matrix with columns of the second matrix. For an m x n matrix multiplied by an n x p matrix, the result is an m x p matrix. Each element (i,j) of the result is the sum of products of elements from row i of matrix A and column j of matrix B. Note that matrix multiplication is not commutative: A*B does not necessarily equal B*A.