askvity

How to Multiply in Matrices?

Published in Matrix Operations 6 mins read

To multiply matrices, you combine the rows of the first matrix with the columns of the second matrix through a process of element-by-element multiplication and summation.

Understanding the Core Process

Matrix multiplication involves a specific procedure, which is consistent regardless of the size or "order" of the matrices involved. As highlighted by the provided information, the fundamental steps are:

  1. Row-by-Column Multiplication: You take the elements of a row from the first matrix and multiply them, element by element, with the corresponding elements of a column from the second matrix.
  2. Summation: After multiplying the corresponding elements, you add all the resulting products together.
  3. Placement: The sum obtained from multiplying a specific row of the first matrix by a specific column of the second matrix becomes a single element in the resulting product matrix. Specifically, if you multiply the i-th row of the first matrix by the j-th column of the second matrix, the sum goes into the element at the i-th row and j-th column of the resulting matrix.

Key Insight: This process means that to find each single element in the resulting matrix, you perform a sequence of multiplications and one summation.

Matrix Dimensions and Compatibility

Before you can multiply two matrices, let's call them Matrix A and Matrix B, their dimensions must be compatible.

  • If Matrix A has dimensions m x n (m rows, n columns)
  • And Matrix B has dimensions p x q (p rows, q columns)

For the multiplication A B to be possible, the number of columns in the first matrix (n) must equal the number of rows in the second matrix (p*). That is, n = p.

If this condition is met, the resulting product matrix (A B) will have the dimensions of m x q*.

For example, as stated in the reference, the product of two 2x2 matrices results in a 2x2 matrix. Here, m=2, n=2, p=2, q=2. Since n=p (2=2), multiplication is possible, and the result is m x q (2 x 2).

Step-by-Step Example: Multiplying Two 2x2 Matrices

Let's illustrate the process with a common example, multiplying two 2x2 matrices, as mentioned in the reference.

Suppose we have Matrix A and Matrix B:

A = $\begin{pmatrix} a & b \ c & d \end{pmatrix}$ , B = $\begin{pmatrix} e & f \ g & h \end{pmatrix}$

The resulting matrix, C = A * B, will also be a 2x2 matrix:

C = $\begin{pmatrix} C{11} & C{12} \ C{21} & C{22} \end{pmatrix}$

Here's how to calculate each element of C:

  • To find C₁₁ (element in row 1, column 1 of C):

    • Take Row 1 of Matrix A ($\begin{pmatrix} a & b \end{pmatrix}$)
    • Take Column 1 of Matrix B ($\begin{pmatrix} e \ g \end{pmatrix}$)
    • Multiply corresponding elements: ($a \times e$) + ($b \times g$)
    • Add the products: $C_{11} = ae + bg$
  • To find C₁₂ (element in row 1, column 2 of C):

    • Take Row 1 of Matrix A ($\begin{pmatrix} a & b \end{pmatrix}$)
    • Take Column 2 of Matrix B ($\begin{pmatrix} f \ h \end{pmatrix}$)
    • Multiply corresponding elements: ($a \times f$) + ($b \times h$)
    • Add the products: $C_{12} = af + bh$
  • To find C₂₁ (element in row 2, column 1 of C):

    • Take Row 2 of Matrix A ($\begin{pmatrix} c & d \end{pmatrix}$)
    • Take Column 1 of Matrix B ($\begin{pmatrix} e \ g \end{pmatrix}$)
    • Multiply corresponding elements: ($c \times e$) + ($d \times g$)
    • Add the products: $C_{21} = ce + dg$
  • To find C₂₂ (element in row 2, column 2 of C):

    • Take Row 2 of Matrix A ($\begin{pmatrix} c & d \end{pmatrix}$)
    • Take Column 2 of Matrix B ($\begin{pmatrix} f \ h \end{pmatrix}$)
    • Multiply corresponding elements: ($c \times f$) + ($d \times h$)
    • Add the products: $C_{22} = cf + dh$

Putting it all together, the resulting matrix C is:

C = $\begin{pmatrix} ae + bg & af + bh \ ce + dg & cf + dh \end{pmatrix}$

Visualizing the Process

While the reference mentions an image, the core idea is multiplying horizontally across the first matrix and vertically down the second matrix to get each element of the result.

Here's a simple table structure to help visualize the row-by-column interaction:

Element in Result Row from Matrix A Column from Matrix B Calculation (Multiply elements & Sum)
C₁₁ Row 1 Column 1 $(a \times e) + (b \times g)$
C₁₂ Row 1 Column 2 $(a \times f) + (b \times h)$
C₂₁ Row 2 Column 1 $(c \times e) + (d \times g)$
C₂₂ Row 2 Column 2 $(c \times f) + (d \times h)$

Applying the Process to Any Order

The process described for 2x2 matrices is indeed the same for matrices of any valid order. If you are multiplying an m x n matrix by an n x q matrix, you will create an m x q resulting matrix.

  • To find the element in the i-th row and j-th column of the result, you take the i-th row of the first matrix and the j-th column of the second matrix.
  • You multiply the first element of the i-th row by the first element of the j-th column, the second element by the second, and so on, up to the n-th element.
  • Finally, you sum up all n of these products to get the single value for that position in the result matrix.

This repeated row-by-column multiplication and summation is the fundamental rule for matrix multiplication.

Related Articles