Multiplication of matrices

Adding two matrices is easy: match up positions and add. Multiplying them is a different game entirely — you do not multiply entry by entry, you combine whole rows of one matrix with whole columns of another. This is the third and most demanding operation in the CBSE Class 12 Matrices chapter, and it is the one examiners lean on hardest, both for direct computation and for probing its strange behaviour. Unlike ordinary numbers, matrices generally do not commute: ABAB is usually not the same as BABA. Two nonzero matrices can even multiply to give the zero matrix, something that never happens with real numbers. This article builds the row-by-column rule from scratch, works it through fully with a 2×22\times2 example, shows exactly where the rule breaks down for students, and gives you a compact toolkit for exam day.

The core insight

Matrix multiplication ABAB exists only when the number of columns of AA equals the number of rows of BB, and its (i,j)(i,j) entry is the sum of row ii of AA multiplied term by term with column jj of BB.

The core idea

The compatibility rule. Matrix multiplication ABAB is defined only when the number of columns of AA equals the number of rows of BB. If AA is m×nm \times n and BB is n×pn \times p, the product ABAB exists and is an m×pm \times p matrix. Write the two orders side by side, (m×n)(n×p)(m \times n)(n \times p): the two inner numbers must match for the product to exist, and the two outer numbers survive to give the order of the result. If the inner numbers disagree, the product simply does not exist — there is no way to force it.

The row-by-column rule. Each entry of the product is built from one row of AA and one column of BB, multiplied term by term and added:

(AB)ij=∑k=1naik bkj(AB)_{ij} = \sum_{k=1}^{n} a_{ik}\,b_{kj}

where: aika_{ik} is the kk-th entry of row ii of AA, bkjb_{kj} is the kk-th entry of column jj of BB, and nn is the shared inner dimension — the number of terms in the sum. Entry (i,j)(i,j) of the product uses only row ii of AA and column jj of BB; every other row or column of either matrix is irrelevant to that one entry.

A⏟m×n×B⏟n×p=AB⏟m×p\underbrace{A}_{m \times n} \times \underbrace{B}_{n \times p} = \underbrace{AB}_{m \times p}

Non-commutativity and the zero-product surprise. Matrix multiplication generally does not commute: AB≠BAAB \neq BA in general, even when both products exist and have the same order. There also exist nonzero matrices M,NM, N with MN=OMN = O (the zero matrix) — a thing that is impossible for ordinary real numbers, where ab=0ab = 0 forces a=0a = 0 or b=0b = 0. The syllabus restricts illustrative examples of both facts to 2×22\times2 square matrices, which is exactly the size worked below.

Associativity carries over. Matrix multiplication is associative, (AB)C=A(BC)(AB)C = A(BC), so a chain of several products can be grouped and computed in any order without changing the answer. This property is used repeatedly later in the chapter when proving facts about invertible matrices.

Figure
Diagram of row by column multiplication for a 2 by 2 matrix product showing row 1 of A meeting column 1 of B
Row of A meets column of B A 1 2 3 4 B 5 6 7 8 AB 19 22 43 50 (1)(5) + (2)(7) = 19, so entry (1,1) of AB is 19 Row 1 of A pairs with Column 1 of B, term by term, then the products are added
Derivation AThe row-by-column rule computes a 2×22\times2 matrix product entry by entry

The goal is to compute ABAB for two given 2×22\times2 matrices using the row-by-column rule, checking dimension compatibility first and then working out all four entries of the product one at a time, so the mechanics of (AB)ij=∑kaikbkj(AB)_{ij} = \sum_k a_{ik}b_{kj} become completely explicit rather than a formula taken on faith.

Step 1. Take A=[1234]A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} and B=[5678]B = \begin{bmatrix} 5 & 6 \\ 7 & 8 \end{bmatrix}. Both are 2×22\times2, so the inner dimensions (2 and 2) match, the product ABAB exists, and it will be 2×22\times2.

Step 2. Entry (1,1)(1,1) comes from row 1 of AA, which is (1,2)(1,2), paired with column 1 of BB, which is (5,7)(5,7): (1)(5)+(2)(7)=5+14=19(1)(5) + (2)(7) = 5 + 14 = 19.

Step 3. Entry (1,2)(1,2) pairs row 1 of AA, (1,2)(1,2), with column 2 of BB, (6,8)(6,8): (1)(6)+(2)(8)=6+16=22(1)(6) + (2)(8) = 6 + 16 = 22.

Step 4. Entry (2,1)(2,1) pairs row 2 of AA, (3,4)(3,4), with column 1 of BB, (5,7)(5,7): (3)(5)+(4)(7)=15+28=43(3)(5) + (4)(7) = 15 + 28 = 43.

Step 5. Entry (2,2)(2,2) pairs row 2 of AA, (3,4)(3,4), with column 2 of BB, (6,8)(6,8): (3)(6)+(4)(8)=18+32=50(3)(6) + (4)(8) = 18 + 32 = 50. Assembling all four entries gives AB=[19224350]AB = \begin{bmatrix} 19 & 22 \\ 43 & 50 \end{bmatrix}.

Worked example

Show that matrix multiplication is not commutative using the same AA and BB, and give a nonzero-matrix pair whose product is the zero matrix.

Step 1. Compute BABA with B=[5678]B = \begin{bmatrix} 5 & 6 \\ 7 & 8 \end{bmatrix} and A=[1234]A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}. Entry (1,1)(1,1): (5)(1)+(6)(3)=5+18=23(5)(1)+(6)(3) = 5+18 = 23. Entry (1,2)(1,2): (5)(2)+(6)(4)=10+24=34(5)(2)+(6)(4) = 10+24 = 34. Entry (2,1)(2,1): (7)(1)+(8)(3)=7+24=31(7)(1)+(8)(3) = 7+24 = 31. Entry (2,2)(2,2): (7)(2)+(8)(4)=14+32=46(7)(2)+(8)(4) = 14+32 = 46. So BA=[23343146]BA = \begin{bmatrix} 23 & 34 \\ 31 & 46 \end{bmatrix}.

Step 2. Compare with AB=[19224350]AB = \begin{bmatrix} 19 & 22 \\ 43 & 50 \end{bmatrix} from the derivation above. The two products disagree in every entry, so AB≠BAAB \neq BA — matrix multiplication is not commutative here, and this single counterexample is enough to disprove commutativity in general.

Step 3. Now take M=[0100]M = \begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix} and N=[0100]N = \begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix}, both nonzero. Entry (1,1)(1,1) of MNMN: (0)(0)+(1)(0)=0(0)(0)+(1)(0) = 0. Entry (1,2)(1,2): (0)(1)+(1)(0)=0(0)(1)+(1)(0) = 0. Entry (2,1)(2,1): (0)(0)+(0)(0)=0(0)(0)+(0)(0) = 0. Entry (2,2)(2,2): (0)(1)+(0)(0)=0(0)(1)+(0)(0) = 0.

Step 4. So MN=[0000]MN = \begin{bmatrix} 0 & 0 \\ 0 & 0 \end{bmatrix}, the zero matrix, even though MM and NN are individually nonzero. Final results: AB=[19224350]≠BA=[23343146]AB = \begin{bmatrix} 19 & 22 \\ 43 & 50 \end{bmatrix} \neq BA = \begin{bmatrix} 23 & 34 \\ 31 & 46 \end{bmatrix}, and MN=[0000]MN = \begin{bmatrix} 0 & 0 \\ 0 & 0 \end{bmatrix} with M,NM, N nonzero.

Competitive stretch

If AA is 2×32\times3 and BB is 3×23\times2, then ABAB is defined and is 2×22\times2, but BABA is also defined — and is 3×33\times3. Since ABAB and BABA do not even have the same order here, they plainly cannot be equal; commutativity can fail not just by unequal entries but by the two products having entirely different shapes. Always check both orders before assuming BABA even makes sense.

Common traps

  • Trying to multiply matrices whose inner dimensions don't match — always verify columns of the first equal rows of the second before starting.
  • Multiplying entries position by position, as in addition, instead of doing the row-times-column sum — this is the single most common matrix-multiplication error.
  • Dropping a term from the sum (AB)ij=∑kaikbkj(AB)_{ij} = \sum_k a_{ik}b_{kj} — the number of terms must equal the shared inner dimension, or the entry comes out wrong.
  • Assuming AB=BAAB = BA out of habit from ordinary number multiplication — matrix multiplication is generally non-commutative, and even the order of the product can differ.
  • Concluding that AB=OAB = O forces A=OA = O or B=OB = O — unlike real numbers, this zero-product reasoning fails for matrices, as the M,NM, N example shows.

Ask the tutor: Want to practice the row-by-column rule on a rectangular (non-square) matrix pair, or see more nonzero-times-nonzero-equals-zero examples? Ask the AI tutor to walk through a few with you.

Why can't I just multiply matrices entry by entry, like I do for addition?

That operation exists and is called the Hadamard product, but it is not what "matrix multiplication" means in this chapter or in most applications, including the ones matrices were designed for, such as representing linear transformations or systems of equations. The row-by-column definition is the one that makes matrix multiplication correspond to composing transformations, which is why it is the standard rule tested on your board and used everywhere else.

How do I quickly check whether a product is even defined, without writing anything out?

Write the two orders next to each other as (m×n)(n×p)(m \times n)(n \times p). Look only at the two numbers touching in the middle — if they match, the product exists and its order is the two outer numbers, m×pm \times p. If the middle numbers disagree, stop: the product simply does not exist, no matter how the entries look.

If AB and BA are both defined and have the same order, are they ever equal?

Sometimes, but not in general — you cannot assume it. Special pairs of matrices do commute, for instance a matrix with itself, AA with the identity matrix, or two matrices that happen to be built from the same simpler structure. But for arbitrary matrices, as the worked example shows with AB≠BAAB \neq BA, equality is the exception rather than the rule, so always compute both if a question genuinely asks you to compare them.

Before this

Where this leads