Show that if $g\circ f = g\circ\tilde{f}$ and $g$ is injective, then $f = \tilde{f}$

functionssolution-verification

Let $f:X\rightarrow Y$, $\tilde{f}:X\rightarrow Y$, $g:Y\rightarrow Z$, and $\tilde{g}:Y\rightarrow Z$ be functions. Show that if $g\circ f = g\circ\tilde{f}$ and $g$ is injective, then $f = \tilde{f}$. Is the same statement true if $g$ is not injective? Show that if $g\circ f = \tilde{g}\circ f$ and $f$ is surjective, then $g = \tilde{g}$. Is the same statement true if $f$ is not surjective?

MY ATTEMPT

We have to prove that $f(x) = \tilde{f}(x)$ for every $x\in X$. We know that a function $h:X\rightarrow Y$ is an injection if, given $x\in X$ and $y\in X$, $h(x) = h(y)$ implies that $x = y$. Based on such definition and the property that $g$ is injective, one has that
\begin{align*}
(g\circ f)(x) = (g\circ\tilde{f})(x) \Longrightarrow g(f(x)) = g(\tilde{f}(x)) \Longrightarrow f(x) = \tilde{f}(x)
\end{align*}

which implies the desired result.

In the case where $g$ is not injective, it does not hold in general. Consider, for instance, that $g(x) = 0$. Then we have that
\begin{align*}
(g\circ f)(x) = g(f(x)) = 0 = g(\tilde{f}(x)) = (g\circ\tilde{f})(x)
\end{align*}

independently of the expression of $f$ and $\tilde{f}$.

We have to prove that $g(y) = \tilde{g}(y)$ for every $y\in Y$. We know that a function $h:X\rightarrow Y$ is surjective if for every $y\in Y$ there is an $x\in X$ such that $y = h(x)$. Based on the assumption that $f:X\rightarrow Y$ is surjective, for every $y\in Y$ there corresponds an $x\in X$ such that $f(x) = y$. Consequently, for every $y\in Y$, we have that
\begin{align*}
g(y) = g(f(x)) = \tilde{g}(f(x)) = \tilde{g}(y) \Longrightarrow g = \tilde{g}
\end{align*}

which is the desired result.

If $f$ is not surjective, the same counter-example $f(x) = 0$ works, since we obtain that $g(0) = \tilde{g}(0)$, but we do not know what happens to the other points.

I would like to know if someone could check I am reasoning rightly as well as propose less artificial counter-examples.

Best Answer

Your solution looks correct. An alternative proof using RAA follows.

Assume that $f \ne \tilde{f}$ therefore there must exist an $x_0$ such that $f(x_0) \neq \tilde{f}(x_0)$.

Define $y_1$ and $y_2$ as follows $y_1 := f(x_0) $ and $y_2 := \tilde{f}(x_0)$.

Given $(g \circ f)(x_0) = (g \circ \tilde{f})(x_0)$ therefor $g(y_1) = g(y_2)$. However since $g$ is injective this is a contradiction.

Related Question