# $f$ has a left inverse iff $f$ is injective

From wiki, I got every injection $$f$$ with a non-empty domain has a left inverse $$g$$. I know how to prove the proposition but just curious why we need to stress the non-empty domain.

If the domain or codomain (or the domain and the codomain) is empty, then the only choice for $$f$$ is $$\emptyset$$, then all the statements for $$f$$ are vacuously true, not alone $$f$$ has a left inverse, I can even say it has an inverse?

The statement I want to prove is: Let $$f$$ is a function from $$A$$ to $$B$$,

$$\forall x,y \in A, f(x)=f(y) \longrightarrow x=y$$ $$\Leftrightarrow$$ $$\exists f^{-1} \subset B \times A, f^{-1} f=Id_{A}$$

Suppose $$X$$ and $$Y$$ are not empty, I have three special cases

$$\Longrightarrow$$

Case 1: $$f:X \rightarrow \emptyset$$

Vacuously True

Case 2: $$f:\emptyset \rightarrow \emptyset$$

$$\exists f^{-1} \subset \emptyset, f^{-1} f=\emptyset=Id_{\emptyset}$$

Case 3: $$f:\emptyset \rightarrow Y$$

$$\exists f^{-1} \subset \emptyset, f^{-1} f=\emptyset=Id_{\emptyset}$$

Only "for all" statements are vacuously true. You ask about a "there exists" statement:

$$f$$ has a left inverse

means

There exists $$g$$ from the codomain (target) of $$f$$ back to the empty set such that $$g \circ f = \operatorname{id}_{\varnothing}$$.

Write $$X$$ for the codomain of $$f$$ so that $$f\colon \varnothing \to X$$. Assuming $$X$$ is nonempty, there are no functions at all $$X\to \varnothing$$, so no $$g$$ can exist.

• Then why $X$ is empty, the statement is true? Oct 15, 2023 at 23:35
• I don't know which statement you mean. The empty function $g\colon \varnothing \to \varnothing$ is an inverse of the empty function $f\colon \varnothing \to \varnothing$, since their composition $g\circ f$ is the also the empty function, which is equal to $\operatorname{id}_{\varnothing}$ Oct 15, 2023 at 23:38
• Never mind. I got your point. Thank you. Oct 15, 2023 at 23:48
• Sorry, I am lost again. I edited my question, can you explain my wrongness? Oct 16, 2023 at 10:17
• The statement with quantifiers as you wrote is incorrect, assuming you want $f^{-1}\colon B \to A$ to be a function (not just a relation). It fails in your Case 3: there are no functions $Y\to\varnothing$, so you have not successfully produced a left-inverse. Oct 16, 2023 at 18:10