# Why the empty set isn't a terminal object in the $\mathcal{SET}$ as well as it is an initial object?

It is said that the $$\{\}$$ is the initial object of the $$\mathcal{SET}$$ - category of sets and functions.

By definition, it implies that for all $$S \in Obj(\mathcal{SET})$$ there is exactly one function $$f: \{\} \mapsto S$$. And that seems more or less all right to me - indeed, there is only one way you can define such $$f = \{\} \times S = \{\}$$.

The thing I can't get is why $$\{\}$$ isn't a terminal object? By the same logic, there is only one way to construct $$g: S \mapsto \{\} = S \times \{\} = \{\}$$.

What am I missing?

P.S. I know that any singleton set is a terminal object in the $$\mathcal{SET}$$. The question is not about it.

The point is that the subset $$f$$ of the cartesian product $$A\times B$$ (for an application $$f:A\to B$$) must check a property beginning with $$\forall a\in A,\exists b\in B \,\mathrm{s.t.}\dots,$$ so if $$A\neq\varnothing$$ and $$B=\varnothing$$, you can't construct a such subset since for a $$a$$ in $$A$$, we would have a $$b\in\varnothing$$, which is impossible.
If $$A\neq\varnothing$$ then no function $$A\to\varnothing$$ exists.
This is because for $$a\in A$$ there is no $$f(a)\in\varnothing$$.
So $$\varnothing$$ is not terminal in the category of sets.
The empty "function" $$g$$ you've constructed isn't a function $$S \rightarrow \emptyset$$ unless $$S$$ is empty. If $$S$$ is not empty then there is an element $$x \in S$$ which doesn't have an output so $$g$$ is not a function.
Therefore there are no functions from $$S$$ into the empty set, rather than a unique function.