[Math] Find an infinite set $S$ and a function $g : S \to S$ that is surjective but not injective.

cardinalselementary-set-theoryfunctionslogic

Find an infinite set $S$ and a function $g : S \to S$ that is
surjective but not injective.

This is all that is given in the problem. Should I fix $S$ to be a certain set, like the integers, or natural numbers, and work from there? Or should I just create a function, like $f(x) = x^2$? Any guidance would be appreciated.

What about this: Let $S$ be $\mathbb{R}$, and let $g : S \to S$ be defined by $f(x) = x^2$. This is surjective but not injective.

EDIT 11/27, 3:53pm CT: I totally confused myself about what it means to be surjective. I'm not sure what I was thinking. Clearly, $f(x) = x^2$ is not surjective since each y-coordinate is not mapped to.

Best Answer

Your proposed function won't work because it is not surjective. For example, $-1$ has no preimage but $-1 \in \mathbb{R}$.

Possible direction:

To make it work, for example, you can let $S$ be the set of nonnegative integer.

Let $g(0)=0=g(1)$, $g(2)=1=g(3)$, and et cetera.

Try to come out with a rule to describe what I did.