# Matrix and scalar multiplication

Say we have the following variables:

• A, a matrix that is nxn in size containing complex numbers
• B, a matrix that is also nxn in size containing complex numbers
• x, a scalar

If you multiply, does it matter whether you multiply in either of the following orders:

• (AB)x
• (Ax)B

if:

• x is a real number
• x is a complex number
• Scalar multiplication is commutative, so no, it doesn't make a difference. May 27 '16 at 20:14
• @DougM I knew it was commutative, but I didn't know whether it was associative with matrices and whether it plays a role that $x$ is in $\mathbb{C}$ and A and B are in $\mathbb{C^{n \cdot n}}$ May 27 '16 at 23:33
• @M.Vinay Thanks for pointing that out. I indeed know that in a lot of cases the brackets are only needed when multiple characters need to be \somefunctionhere'd. I just do it out of force of habit :P May 28 '16 at 2:43

$x(AB)=(xA)B=A(xB)=A(Bx)=(AB)x=(Ax)B$
When matrices are being multiplied by a scalar element, the order in which multiplication takes place can be disregarded

It runs down to the axiom of commutativity of multiplication in fields (a scalar is element of a field) $$\forall a, b \in F: a b = b a$$ and the commutative property of scalar multiplication: $$x A = x(a_1, \dotsc, a_n) = (x a_1, \dots, x a_n) = (a_1 x, \dots, a_n x) = (a_1, \dotsc, a_n) x = A x$$ where $x \in F$ and $A$ is a matrix over $F$. For matrix multiplication we have $$x \sum_j a_{ij} b_{jk} = \sum_j (x a_{ij}) b_{jk} = \sum_j a_{ij} (x b_{jk}) = \left(\sum_j a_{ij} b_{jk} \right) x$$ or $$x(AB) = (xA)B = A(xB) = (AB)x$$

• Ok, that is a very sound explanation for real numbers. I verified that it is also true for complex numbers: a+ib = (a b, -b a) -> (a+ib)(c+id) = (a b, -b a)(c d, -d c) = (ac-bd ad+bc, -(ad+bc) ac-bd) = ac-bd + i(ad+bc). (c+id)(a+ib) = (c d, -d c)(a b, -b a) = (ca-db cb+da, -(cb+da) ca-db) = (ac-bd ad+bc, -(ad+bc) ac-bd) = ac-bd + i(ad+bc) QED May 27 '16 at 23:09
• I also overlooked that you mentioned $∀a,b∈F:ab=ba$, Also, I forgot the formatting for the matrices, can you fix that? I don't have the right to edit after 5 min. May 27 '16 at 23:13
• Complex numbers form a field, so they have commutative multiplication and more.
– mvw
May 27 '16 at 23:19

Scalar multiplication actually is short hand for multiplication by a diagonal matrix full of the scalar. In other words:

$$sA = \left[\begin{array}{ccc}s&0&0\\0&\ddots&0\\0&0&s\end{array}\right]A$$

You can convince yourself that this will be the same when multiplying from the left as from the right.