2

Take the case of this matrix multiplication: $$ A x= \begin{pmatrix} 1 & -1 & 2\\ 0 & -3 & 1\\ \end{pmatrix} \begin{pmatrix} 2 \\ 1 \\ 0 \end{pmatrix} $$
The answer of which is $ \begin{pmatrix} 1 \\ -3 \end{pmatrix} $.

Source: https://mathinsight.org/matrix_vector_multiplication

I understand there are three components in $A$ and $x.$ So how can matrix multiplication have two (not sure if the component will be the right term) terms as part of the answer leading to matrix multiplication? What is the way to visualize the result? I think with three components, the matrix multiplication should have the result in three parts. I know I am missing something.

Léreau
  • 3,246
  • 3
    One way of intuitively understanding matrix multiplication is that the first column gives the result for multiplying the matrix by a vector with a one in the first coordinate and zeroes everywhere else, and similarly for the other columns. Then, to get the product for any vector, just use the fact that matrix multiplication is linear and scale and add the columns to get the answer. Because you're adding the columns together to get the answer, now hopefully it will make sense that you get an answer with the dimension of the columns. – Stephen Donovan Jul 17 '21 at 06:05
  • @StephenDonovan The answer to the above sample example has 2 rows while the matrix A has two rows, three columns; vector x with 3 columns (or components if I am not wrong). – Splendid Digital Solutions Jul 17 '21 at 06:12
  • 2
    Presumably $x$ is a column vector so you could consider it as having $3$ rows. In any case I mean that if you look at any column of the matrix and consider it as a column vector, we end with an answer with that dimension. So because the matrix has $2$ rows, each column has $2$ elements. – Stephen Donovan Jul 17 '21 at 06:14
  • 1
    Welcome to MSE. For some basic information about writing mathematics at this site see, e.g., basic help on mathjax notation, mathjax tutorial and quick reference, main meta site math tutorial and equation editing how-to. – José Carlos Santos Jul 17 '21 at 06:20
  • @StephenDonovan Is there a way to visualize what it means by $$ \begin{matrix} 1 \ -3 \ \end{matrix} $$ in this context. When viewed graphically, since there are three components that are multiplied and the result has two elements, how do we visualize the result in a graph. Still easier will be to keep the component as two if that helps to visualize. – Splendid Digital Solutions Jul 17 '21 at 08:53
  • My intuition suggests that if I multiply two matrices with two components (x and y), the result of that multiplication should also have two components: one denoting x element of both the matrices multiplied and second denoting y element of both the matrices multiplied. – Splendid Digital Solutions Jul 17 '21 at 09:49
  • Okay, since dot product involves an output that is the product of two components (in two dimensions), the result should be one scalar quantity. – Splendid Digital Solutions Jul 17 '21 at 13:32
  • My favorite way to think about $Ax$ is "$Ax$ is a linear combination of the columns of $A$." – littleO Jul 19 '21 at 06:41
  • 2
  • 1
    A matrix vector multiplication is a linear mapping from $\mathbb{R}^{n}$ to $\mathbb{R}^{m}$. Because it is linear it is completely defined by how it works on the unit vectors (that is all vectors with all entries zero except for a single 1). – Elmex80s Jul 19 '21 at 12:06
  • @Splendid Digital Solutions. That is a legendary question title. – Star Alpha Jul 20 '21 at 10:37
  • 1
    I didn't really wanna write this as an answer, you managed to get some very good answers. Anyway here, A has 3 components, but x only has 2 (because of the 0) so it's on a "2d plane" so to speak, the dot product will therefore also only have 2 components because you essentially multiply the third component in A by 0 . – Some loony with a calculator Jul 21 '21 at 01:29
  • @Someloonywithacalculator Fail to understand that even if x has zero as one of the components, why not a three dimensional line or plane cannot exist with coordinates 2, 1, 0. – Splendid Digital Solutions Jul 21 '21 at 04:26
  • 1
    I @SplendidDigitalSolutions if I don't have any values in the third dimension, then I have a zero there and that x is essentially 2d, technically 3, but only 2 active components. No matter what, multiplying something times zero is zero. Think about this physically: electric flux is a dot product between a surface area and an electric field, this tells you how much "charge" is passing through. If my electric field is not travelling in the z (3rd) axis, it's not going to just bend upward when it passes through the face of a cube, for example. – Some loony with a calculator Jul 21 '21 at 05:21

2 Answers2

4

We look at the problem by considering two aspects. We start with matrix multiplication and we will see that multiplication of a matrix with a vector can be seen as special case of it. Then we look at how the elements of the product matrix in the current problem are calculated.

Matrix multiplication:

  • An $(m\times \color{blue}{n})$-matrix $A$ consisting of $m$ rows and $\color{blue}{n\ \mathrm{columns}}$ multiplied with an $(\color{blue}{n} \times q)$-matrix $B$ consisting of $\color{blue}{n\ \mathrm{rows}}$ and $q$ columns gives an $(m\times q)$-matrix $A\cdot B$.

  • A vector $x$ of dimension $n$ can be seen as $(\color{blue}{n}\times 1)$ matrix. Multiplication of an $(m\times \color{blue}{n})$-matrix $A$ with $x$ gives $Ax$ which is consequently an $(m\times 1)$ matrix.

  • Current problem: \begin{align*} A=\begin{pmatrix} 1 & -1 & 2\\ 0 & -3 & 1\\ \end{pmatrix} \end{align*} is a $(2\times 3)$ matrix. The vector $x=\begin{pmatrix} 2 \\ 1\\ 0 \end{pmatrix}$ is a $(3\times 1)$-matrix and we therefore obtain $Ax$, which is a $(2\times 1)$-matrix.

Elements of the matrix product:

  • With the settings from above we have $A\cdot B=C=\left(c_{i,j}\right)_{1\leq i\leq m,1\leq j\leq q}$. The element $c_{i,j}$ denotes the element in the $i$-th row and $j$-th column of $C$. We calculate $c_{i,j}$ by multiplying the elements of the $i$-th row and $j$-th column elementwise and adding them up.

We demonstrate this with the current problem. We consider \begin{align*} \color{blue}{Ax} &=\begin{pmatrix} 1 & -1 & 2\\ 0 & -3 & 1\\ \end{pmatrix} \begin{pmatrix} 2 \\ 1 \\ 0 \end{pmatrix}\\ \end{align*} and we know from above that $Ax=(c_{i,j})_{1\leq i\leq 2, 1\leq j\leq 1}$ gives a $(2,1)$-matrix with elements $c_{1,1}$ and $c_{2,1}$.

  • Element $c_{1,1}$: Multiplication of first row with first column gives \begin{align*} \left(\color{blue}{c_{1,1}}\right)&= \begin{pmatrix} 1 & -1 & 2\\ \end{pmatrix} \begin{pmatrix} 2 \\ 1 \\ 0 \end{pmatrix}\\ &=\left(1\cdot 2+(-1)\cdot 1+2\cdot 0\right)\\ &=(\color{blue}{1})\\ \end{align*}

  • Element $c_{2,1}$: Multiplication of second row with first column gives \begin{align*} \left(\color{blue}{c_{2,1}}\right)&= \begin{pmatrix} 0 & -3 & 1\\ \end{pmatrix} \begin{pmatrix} 2 \\ 1 \\ 0 \end{pmatrix}\\ &=\left(0\cdot 2+(-3)\cdot 1+1\cdot 0\right)\\ &=(\color{blue}{-3})\\ \end{align*}

We conclude \begin{align*} \color{blue}{Ax}=\begin{pmatrix} 1 & -1 & 2\\ 0 & -3 & 1\\ \end{pmatrix} \begin{pmatrix} 2 \\ 1 \\ 0 \end{pmatrix}= \begin{pmatrix} c_{1,1} \\ c_{2,1} \end{pmatrix}\color{blue}{=\begin{pmatrix} 1 \\ -3 \end{pmatrix}}\tag{1} \end{align*}

Note, with some experience this matrix calculation can be reduced to (1) without doing any intermediate steps.

Markus Scheuer
  • 112,413
3

Question: "Take the case of this matrix multiplication: $$ A x= \begin{pmatrix} 1 & -1 & 2\\ 0 & -3 & 1\\ \end{pmatrix} \begin{pmatrix} 2 \\ 1 \\ 0 \end{pmatrix} "$$

Answer: write the matrix $A$ as follows

$$ A x= \begin{pmatrix} v_1 & w_1 & z_1\\ v_2 & w_2 & z_2 \\ \end{pmatrix} $$

and let

$$ v= \begin{pmatrix} v_1 \\ v_2 \\ \end{pmatrix}$$

$$w= \begin{pmatrix} w_1 \\ w_2 \\ \end{pmatrix}$$

$$z= \begin{pmatrix} z_1 \\ z_2 \\ \end{pmatrix}. $$

When you use the definition of matrix multiplication and multiply out the producct $Ax$ you get the vector

$$Ax=2v+1w+0z=2v+w.$$

Question: "I think with three components, the matrix multiplication should have the result in three parts. I know I am missing something."

Answer: The vector $Ax:=2v+w$ is a sum of vectors "with two components", hence it follows $Ax$ is a vector with "two components". Look up the definition of "matrix multiplication" in a book on linear algebra - it seems you have misunderstood this definition.

hm2020
  • 10,015