There is proper procedure to multiply two matrices. First, we need to check if the two matrices are eligible for multiplication. To multiply two matrices, the number of columns of first matrix must be equal to number of rows of the second matrix. For example, we have Matrix A (2 X3 ) and Matrix B (3 X6). The number of columns in matrix A (3) is equal to number of rows in matrix B. Hence, they are eligible for multiplication which means we can calculate AB. Note that we cannot calculate BA here because number of columns in matrix B is not equal to number of rows in matrix A.
To learn the whole procedure and for better clarification just go through the files.