For a composition to be defined: $Domf\circ g\subseteq Dom f, Im f\circ g \subseteq Im g$?

For a composition to be defined, is the following two a must?

$$f:A\to B, g: C\to D\\ f\circ g : C\to B \\ Domf\circ g\subseteq Dom f\\ Im f\circ g \subseteq Im g$$

Are there other conditionals for the composition to be defined? What about the sets?

• How is this different from your question here, and how is my answer there not answering this question as well? – Asaf Karagila Feb 7 '15 at 9:13
• @AsafKaragila good memory, you didn't mention the two inclusions in my question so I assumed there are more ways to define this. – shinzou Feb 7 '15 at 9:16
• How can you speak of ${\rm dom} f \circ g$ before you define it? The question seems ill-posed. Also, you seem to mixing up $f \circ g$ and $g \circ f$. – Lord_Farin Feb 7 '15 at 10:19

Let me take the same stance I took in my answer to your previous question. Function is just a set of ordered pairs, and writing $f\colon A\to B$ we declare that $\operatorname{dom}(f)=A$ and $\operatorname{rng}(f)\subseteq B$.

The composition of any two functions is always defined: $$g\circ f=\{\langle x,z\rangle\mid\exists y:f(x)=y\land g(y)=z\}$$

You can easily check that $g\circ f$ is a function if $g,f$ are functions.

The question is what is the domain of $g\circ f$, and it is not very hard to see that if $\langle x,z\rangle\in g\circ f$, then the witnessing $y$ is unique (since $f(x)$ is unique). Therefore $x\in\operatorname{dom}(g\circ f)$ if and only if $f(x)\in\operatorname{dom}(g)$. In other words, $$\operatorname{dom}(g\circ f)=\operatorname{dom}(f)\cap f^{-1}(\operatorname{dom}(g))=f^{-1}(\operatorname{dom}(g)).$$

The statement that $\operatorname{rng}(g\circ f)\subseteq\operatorname{rng}(g)$ is an easy consequence of the definition.

So, now, if we want $f\circ g\colon C\to B$ to be a true statement, then we need that $\operatorname{dom}(f\circ g)=C$. In other words, we need that $\operatorname{rng}(g)\subseteq\operatorname{dom}(f)=A$.

$f:A\to B,\; g:c\to D$.

For $f\circ g$ to be defined, the necessary and sufficient condition is that $A=D$. There must be a sequence $C\to D=A\to B$ in order to define $f\circ g$.

• What do you mean by a sequence? – shinzou Feb 7 '15 at 10:31
• @kuhaku: $\newcommand{\func}[1]{\overset{#1}{\longrightarrow}}$ $C\func g D \func f B$. – Lehs Feb 7 '15 at 10:40