How does matrix multiplication work when you have two parenthesis of two calculations? How do I calculate the following example:
$$(\lambda A-I)(\lambda A-I)$$
where A is any $n\,x\,n$ matrix of the same size as $I$? Do I multiply as regular algebra or what?
Is is:
$$(\lambda A)^2-2\lambda A + I$$
Why, why not?
Edit:
Or for the example
$$(A-2BC)(A-2BC)$$
where $A, B, C$ are three $3\,x\,3$ matrices.
 A: Matrix multiplication is distributive but since order matters you have to be careful not to commute any of the elements. Lets look at the example $(A-B)(C-D)$ since it's more general and assume all the matrices are square. We can do this two ways. First we can calculate $$(A-B)(C-D)=(A-B)C -(A-B)D=\\AC-BC-(AD-BD)=AC-BC-AD+BD$$
Or we could have distributed the other way with $$(A-B)(C-D)=A(C-D)-B(C-D)=\\AC-AD-(BC-BD)=AC-AD-BC+BD$$
And we can see by inspection that they are the same regardless of our choice in left or right distributivity.
A: Remember how matrix multiplication is defined:
Given a matrices $\mathbf A$ and $\mathbf B$ of size $m\times n$ and $n \times p$, we define the product $\mathbf C = \mathbf {AB}$ as the matrix of size $m \times p$, whose entries, $c_{ij}$ are given by the dot product between the $i$th row of $\mathbf A$ and the $j$th column of $\mathbf B$.
That is
$$
c_{ij} = \sum_{k=1}^{n} a_{ik}b_{kj}.
$$
Using this definition, we can satisfy ourselves that matrix multiplication does distribute over addition. Given matrices $\mathbf{L}$, $\mathbf{M}$ and $\mathbf{N}$, of suitable sizes, the product $\mathbf{L}(\mathbf M + \mathbf{N})$ will have coefficients given by
$$ \sum_k l_{ik}(m_{kj} + n_{kj}) = \sum_k l_{ik}m_{kj} + \sum_k l_{ik}n_{kj}$$
The two terms on the right are the coefficients of $\mathbf {LM}$ and $\mathbf{LN}$ respectively, and we conclude that $\mathbf{L}(\mathbf M + \mathbf{N}) = \mathbf{L}\mathbf M + \mathbf{L}\mathbf{N}$
