When is $g \circ f$ defined

functions

I am trying to understand when the composition of $g \circ f$ is defined. The strictest possible definition states that the codomain of $f$ must equal the domain of $g$. However, this doesn't seem completely necessary, as we really only require that the codomain of $f$ be contained within the domain of $g$. Furthermore, we only seem to require that the image of $f$ be contained in the domain of $g$. We could have a case, for example, where the image of $f$ is a proper subset of the codomain of $f$ , which is a proper subset of the domain of $g$.

Is my understanding here correct? Have I overlooked anything? The textbooks I have read through often use words like 'range', 'codomain' and 'image' interchangeably, so it's sometimes difficult to keep up.

Best Answer

It's easier to understand if we give notations to everything. Let's say $f:A\to B, g:C\to D$. By definition $g\circ f(x)=g(f(x))$. So this is well defined if and only if $f(x)$ belongs to $C$ for all $x\in A$. Hence the only thing we have to require is $f(A)\subseteq C$. It really doesn't matter what is the relation between $B$ and $C$, they might be very different sets. However the specific subset $f(A)\subseteq B$ (which might be only a very small part of $B$) has to be a subset of $C$.

Related Question