# Very basic linear algebra question

by 1MileCrash
Tags: algebra, basic, linear
 P: 239 If $f:V\to W$ and $g:X\to Y$ are linear transformations, it only makes sense to talk about the composition $g\circ f$ if $W=X$. In particular, if $f:\mathbb R^K \to \mathbb R^L$ and $g:\mathbb R^J \to \mathbb R^I$ are linear transformations, it only makes sense to talk about the composition $g\circ f$ if $\mathbb R^L=\mathbb R^J$, i.e. if $L=J.$ Phrasing the last point a different way now: If $F$ is an $L\times K$ matrix and $G$ is an $I\times J$ matrix, it only makes sense to talk about the matrix product $GF$ if $L=J$. So the matrix dimension rule you learned is really there exactly because only certain functions can be composed. The expression $g\circ f$ only has meaning if the outputs of $f$ are valid inputs for $g$.