Background
- $A$ is a matrix
- $B$ is a matrix
- $\bf{x}$ is a vector
Question:
Does $(AB)\bf{x}$ $=$ $A(B \bf{x})$ ?
Background
Question:
Does $(AB)\bf{x}$ $=$ $A(B \bf{x})$ ?
The equality does hold. $$\left(\left(\begin{matrix} a_{11} & \cdots & a_{1n}\\ \vdots & \ddots & \vdots\\ a_{n1} & \cdots & a_{nn}\end{matrix}\right) \left(\begin{matrix} b_{11} & \cdots & b_{1n}\\ \vdots & \ddots & \vdots\\ b_{n1} & \cdots & b_{nn}\end{matrix}\right) \right) \left(\begin{matrix} x_1\\ \vdots\\ x_n\end{matrix}\right) $$
$$=\left(\begin{matrix} \sum_{i=1}^n a_{1i}b_{i1} & \cdots & \sum_{i=1}^n a_{1i}b_{in}\\ \vdots & \ddots & \vdots\\ \sum_{i=1}^n a_{ni}b_{i1} & \cdots & \sum_{i=1}^n a_{ni}b_{in}\end{matrix}\right) \left(\begin{matrix} x_1\\ \vdots\\ x_n\end{matrix}\right) $$
$$ =\left(\begin{matrix} \sum_{j=1}^n x_j\sum_{i=1}^n a_{1i}b_{ij}\\ \vdots\\ \sum_{j=1}^n x_j\sum_{i=1}^n a_{ni}b_{ij}\\\end{matrix}\right) $$
$$ =\left(\begin{matrix} \sum_{j=1}^n \sum_{i=1}^n x_ja_{1i}b_{ij}\\ \vdots\\ \sum_{j=1}^n \sum_{i=1}^n x_ja_{ni}b_{ij}\\\end{matrix}\right) $$
$$\left(\begin{matrix} a_{11} & \cdots & a_{1n}\\ \vdots & \ddots & \vdots\\ a_{n1} & \cdots & a_{nn}\end{matrix}\right) \left(\left(\begin{matrix} b_{11} & \cdots & b_{1n}\\ \vdots & \ddots & \vdots\\ b_{n1} & \cdots & b_{nn}\end{matrix}\right) \left(\begin{matrix} x_1\\ \vdots\\ x_n\end{matrix}\right)\right) $$
$$=\left(\begin{matrix} a_{11} & \cdots & a_{1n}\\ \vdots & \ddots & \vdots\\ a_{n1} & \cdots & a_{nn}\end{matrix}\right) \left(\begin{matrix} \sum_{i=1}^nb_{1i}x_i\\ \vdots\\ \sum_{i=1}^nb_{ni}x_i\end{matrix}\right) $$
$$=\left(\begin{matrix} \sum_{j=1}^na_{1j}\sum_{i=1}^nb_{ji}x_i\\ \vdots\\ \sum_{j=1}^na_{nj}\sum_{i=1}^nb_{ji}x_i\end{matrix}\right) $$
$$=\left(\begin{matrix} \sum_{j=1}^n\sum_{i=1}^na_{1j}b_{ji}x_i\\ \vdots\\ \sum_{j=1}^n\sum_{i=1}^na_{nj}b_{ji}x_i\end{matrix}\right) $$
The variables $i$ and $j$ in the sum are dummy variables. Therefore, we can interchange them to see that the two results are the same.