(Sorry in advance if I don't get all the terminology right, and for the lengthy question!)
Intro
I've got two 2x2 matrices called $\textbf{M}$ and $\textbf{N}$, which represent the linear transformations M and N respectively. $$\textbf{M} =\begin{bmatrix}a & b\\c & d\end{bmatrix}; \quad \textbf{N} =\begin{bmatrix}e & f\\g & h\end{bmatrix}$$ I've got two methods (A and B) to try and find $\textbf{P}=\textbf{MN}$ but the results they give me are inconsistent! Can anyone explain why??
(A) The Long-Winded Way
I know that the columns of a 2x2 matrix are the images of $\hat{\textbf{i}}$ and $\hat{\textbf{j}}$ respectively when I apply the linear transformation represented by that matrix to a coordinate axes, S, with unit vectors $\hat{\textbf{i}}$ and $\hat{\textbf{j}}$. And these images are described as column vectors 'as seen by' S - i.e. the column vectors are in 'the language of' $\hat{\textbf{i}}$ and $\hat{\textbf{j}}$. (I'll call this my 'theorem'.)
Let S' be the coordinate axes with unit vectors $\hat{\textbf{i}'}$ and $\hat{\textbf{j}'}$ and S'' be the coordinate axes with unit vectors $\hat{\textbf{i}''}$ and $\hat{\textbf{j}''}$. I'll also say that S' is the image of S under the transformation N and S'' is the image of S' under the transformation M. (I'm applying N before M!)
So using my theorem I know that:$$\hat{\textbf{i}'} = e\hat{\textbf{i}} + g\hat{\textbf{j}}$$ $$\hat{\textbf{j}'} = f\hat{\textbf{i}} + h\hat{\textbf{j}}$$ because the unit vectors of S' are the images of those of S, under the transformation that $\textbf{N}$ represents.
Similarly, I can reason that: $$\hat{\textbf{i}''} = a\hat{\textbf{i}'} + c\hat{\textbf{j}'}$$ $$\hat{\textbf{j}''} = b\hat{\textbf{i}'} + d\hat{\textbf{j}'}$$ because the unit vectors of S'' are the images of those of S' under the transformation M, and these images are described as column vectors (in terms of the unit vectors of S') in the columns of $\textbf{M}$.
So, by substituting the top 2 equations into the bottom 2:$$\hat{\textbf{i}''} = a(e\hat{\textbf{i}} + g\hat{\textbf{j}}) + c(f\hat{\textbf{i}} + h\hat{\textbf{j}}) = (ae+cf)\hat{\textbf{i}} + (ag+ch)\hat{\textbf{j}}$$ $$\hat{\textbf{j}''} = b(e\hat{\textbf{i}} + g\hat{\textbf{j}}) + d(f\hat{\textbf{i}} + h\hat{\textbf{j}}) = (be+df)\hat{\textbf{i}} + (bg+dh)\hat{\textbf{j}}$$
Now that I have expressed the unit vectors of S'' in 'the language of' S, I should be able to construct a matrix (call it $\textbf{P}$) which describes the single transformation from S to S''. It's LHS and RHS columns will be the unit vectors $\hat{\textbf{i}''}$ and $\hat{\textbf{j}''}$ expressed as column vectors in terms of $\hat{\textbf{i}}$ and $\hat{\textbf{j}}$. Therefore, $$\textbf{P} = \begin{bmatrix}(ae+cf) & (be+df)\\(ag+ch) & (bg+dh)\end{bmatrix}$$ But I also know that the matrix $\textbf{MN}$ describes the transformation N, followed by M. So if applied to S, it should transfrom it to S', then S'' - i.e. it would have the exact same effect as if we just applied the transfromation represented by $\textbf{P}$ to S! So $\textbf{MN} = \textbf{P}$ because they describe the same transformation, and therefore $$\textbf{MN} = \begin{bmatrix}(ae+cf) & (be+df)\\(ag+ch) & (bg+dh)\end{bmatrix}$$
(B) The Normal Matrix Multiplier Algorithm
For this method I just use the normal method where you go left to right along the rth row of $\textbf{M}$ and down the qth column of $\textbf{N}$, multiplying corresponding elements and adding all the products together, to get the element in the rth row and qth column of $\textbf{MN}$. $$\textbf{MN} = \begin{bmatrix}a & b\\c & d\end{bmatrix}\times \begin{bmatrix}e & f\\g & h\end{bmatrix} = \begin{bmatrix}(ae+bg) & (af+bh)\\(ce+dg) & (cf+dh)\end{bmatrix}$$
Conclusion
So why are the two methods giving me different results? Can anyone point out a mistake I made. I asked a friend studying maths at uni and he said it's got something to do with a 'change of basis' but I didn't really understand. (I fear that this might be a big concept so, if it is to do with this and it's too much to explain here, could anyone point me to good videos/websites/pdfs/online resources that explain it well?)
Thank you!
Your mistake occurs at the point “Similarly, I can reason that”. As already pointed out in the comments, the columns of $\mathbf{M}$ tell you the images (under the mapping $M$) of the unprimed basis vectors $\mathbf{i}$ and $\mathbf{j}$, not the primed vectors $\mathbf{i}'$ and $\mathbf{j}'$.
(The primed vectors are determined by the mapping $N$, and how would $M$ know what $N$ is doing? And they don't even need to form a basis, since $N$ could be singular.)
Instead, compute as follows. By linearity, $M$ maps $\mathbf{i}'$ to $$ M(\mathbf{i}') = M(e \mathbf{i} + g \mathbf{j}) = e M(\mathbf{i}) + g M(\mathbf{j}) = e (a \mathbf{i} + c \mathbf{j}) + g (b \mathbf{i} + d \mathbf{j}) = (ae+bg) \mathbf{i} + (ce+dg) \mathbf{j} , $$ which agrees with what you got in the first column of $\mathbf{M} \mathbf{N}$ when you did the matrix multiplication, and similarly for the second column.