# Understanding $\pmatrix{1 & 2 \\ 3 & 4} \pmatrix{2 & 0 \\ 1 & 2} ≠ \pmatrix{2 & 0 \\ 1 & 2} \pmatrix{1 & 2 \\ 3 & 4}$

Source

https://www.mathsisfun.com/algebra/matrix-multiplying.html

Seeking help if anyone could explain what is going under the hood.

How multiplication of x component with y component relates. It is said that you cannot compare apples with oranges but this multiplication of x component with y component appears to contradict. So while it is understood 1x2 (1x2+2x1) of the first row, first column as multiplication between x components, how 2 (x component) x 1 (y component) relates. It appears dot multiplication but an explanation will help.

• Well, the entries of the matrices are all (real) numbers, they can be all considered as 'apples'. Oct 25 at 8:40
• I meant x component and y component. Oct 25 at 9:56
• @Berci Indeed x + y is addition of apples and oranges. Oct 25 at 12:22
• From my novice status in mathematics, I believe that matrix multiplication should have been called with a different name, such as matrix transformation. This might reduce the otherwise confusion when we begin with an expectation of plain multiplication. Oct 26 at 1:56

For me, it's good to follow the way mathematicians have hopefully discovered it (Cayley in particular in the 1850s) by considering the matrix product as an operation :

$$\binom{x}{y} \xrightarrow{A=\begin{pmatrix}a&b\\c&d\end{pmatrix}} \binom{p}{q} \xrightarrow{B=\begin{pmatrix}e&f\\g&h\end{pmatrix}} \binom{u}{v}\tag{0}$$

We are going to suppress the intermediate variables $$p,q$$ by expressing directly $$u,v$$ as (linear) expressions in variables $$x,y$$.

(0) means that

$$\binom{p}{q}=\begin{pmatrix}a&b\\c&d\end{pmatrix}\binom{x}{y} \iff \begin{cases}p&=&ax+by\\q&=&cx+dy\end{cases}\tag{1}$$

and

$$\binom{u}{v}=\begin{pmatrix}e&f\\g&h\end{pmatrix}\binom{p}{q} \iff \begin{cases}u&=&ep+fq\\v&=&gp+hq\end{cases}\tag{2}$$

Now it remains to plug relationships (1) into relationships (2) to get:

$$\begin{cases}u&=&e(ax+by)+f(cx+dy)\\v&=&g(ax+by)+h(cx+dy)\end{cases} \iff$$

$$\begin{cases}u&=&\color{red}{(ea+fc)}x+\color{red}{(eb+fd)}y\\v&=&\color{red}{(ga+hc)}x+\color{red}{(gb+hd)}y\end{cases},$$

where we recognize in red the entries of matrix product $$BA$$ (not $$AB$$ because $$A$$ is applied first, then $$B$$: we proceed from right to left).

• "where we recognize in red the entries of matrix product BA (not AB because A is applied first, then B: we proceed from right to left)." Could it be further explained for better understanding. Oct 26 at 2:03
• A comparison can be made is with composition of functions. For example with affine functions $f(x)=ax+b$ and $g(x)=cx+d$ : $g(f(x))$ means that we apply $f$ at first, then $g$ giving $g(ax+b)=c(ax+b)+d=(ac)x+(cb+d)$ (which is different in general from $f(g(x))=f(cx+d)=a(cx+d)+b=(ac)x°(ad+b)$) Oct 26 at 8:10