If $f\circ g = g \circ f$ does that mean that both functions are to and from the same set and both are bijections? Does it tell us anything else? If $f\circ g = g \circ f$ does that mean that both functions are to and from the same set and both are bijections? Does it tell us anything else?
 A: They need not be bijections. $g(x)=x$ and $f(x)=0$ for all $x$. Then $f \circ g =0 = g \circ f$. $f$ is as far from a bijection as you will get.
A: Let $X$ be a non-empty set and $f$, $g:X \to X$ mappings.


*

*If $f = g$ is arbitrary, then $f \circ g = g \circ f$.

*If $g$ is the identity mapping, then $f \circ g = g \circ f$ for every $f$.

*If there exists an $x_{0}$ in $X$ such that $g(x) = x_{0}$ for all $x$, then $f \circ g = g \circ f$ for every $f$ that fixes $x_{0}$.
Etc., etc. As others have noted, you cannot deduce that $f$ and $g$ are bijections, but that's arguably something of an understatement.
A: Strictly speaking, in order for $f\circ g$ and $g\circ f$ to both be defined and equal, then yes, $f$ and $g$ must both be functions $f:X\to X$ and $g:X\to X$ for some set $X$. (However, some people would allow the composite $k\circ h$ of functions $h:A\to B$ and $k:Y\to Z$ as long as $B\subseteq Y$, and are less strict about what it means for two functions to be equal.)
However, there is absolutely no reason for them to be bijections. For example, consider the functions $f:\mathbb{Z}\to\mathbb{Z}$ and $g:\mathbb{Z}\to\mathbb{Z}$ defined by
$$f(x)=0\text{ for all }x\in\mathbb{Z},\qquad g(x)=2x\text{ for all }x\in\mathbb{Z}$$
