[Math] A function that is surjective but not injective, and function that is injective but not surjective

functionsproof-writingreal-analysis

$(b)$ $f$ is surjective

$(c)$ $|A| = |B|$

Right now I'm having trouble coming up with examples that would not contradict what I proved. If the function is going from A to A, then the cardinality of the domain and codomain are the same, and if it is either surjective or injective, then wouldn't it have to also be injective or surjective, respectively?

Best Answer

$f(x) = x^3-3x$ is surjective but not injective

$g(x) = e^x$ is injective but not surjective.

And both are functions from $\mathbb R \to \mathbb R$