YES x(AB) == (xA)B for scalar x.
Recall that xA means that every element of A is multiplied by x. Here is a demonstration of the rule:
Often a matrix-matrix multiplication can be simpified by factoring one of the matrices. See the question.
Compute the following:
10 0 20 20 40 10 0 20 10 -2 2 1 1 2 -2
10 0 20 20 40 10 0 20 10
-2 2 1 1 2 -2