0
$\begingroup$

This question already has an answer here:

Let's say we have a function f (x) = x and define its domain D to be the integers. Then according to calculus the image K of f is the set of all integers. However, I cannot quite understand the need to define codomain because isn't the codomain A of f just a set of numbers such that K is a subset of A? Because if that were the case, couldn't we chose any of Q, R, C or even the extended complex plane as the codomain of f? What have I gotten wrong, and what is the motivation for Codomain? :)

$\endgroup$

marked as duplicate by Eric Wofsey, Leucippus, Namaste calculus Jul 9 '17 at 1:09

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2
$\begingroup$

Any function $f:D\to A$ does in fact correspond to a surjective function $f:D\to K =f(D)$. That said, the concept of codomain is very useful when the image of $f$ is either unspecified, or is not known a priori. Consider for example the following.

  • "A function $f:\mathbb{Q} \to \mathbb{R}$ cannot be surjective". In this case the function $f$ is unspecified, thus so is its image. However, the proposition is true, and easy to state in terms of codomain.

  • "Define $f:\mathbb{N}\to\mathbb{N} \cup \{0\}$ as $f(n)$ is the number of ways that $2(n+1)$ can be written as a sum of two primes". It is not currently known whether $0$ does in fact belong to the image of $f$ i.e. whether $\,0 \in f(\mathbb{N})\,$ (though of course Goldbach's conjecture strongly suggests it doesn't).

$\endgroup$