TITLE: What is the purpose of the Codomain?
QUESTION [5 upvotes]: If the Domain of a function is all acceptable inputs, 
and the image of a function is the output, what is the point of using the word Codomain?
For example, 
I could say the cosine function maps R to R which means that the domain is R, and the codomain is R. The image however of cosine, would be the numbers between -1 and 1 inclusive, so of course they are within the real numbers. 
Any thoughts?

REPLY [2 votes]: Sometimes we don't know what the range is, but we do know that it's contained in some other set. In this case we can specify a valid domain and codomain even though we don't know what the range is.
We are often interested in surjectivity. Surjectivity is fundamentally tied to the codomain of a function. Concretely, if we have a surjective function $f : A \to B$ and a set $C \supsetneq B$, we can define a function $g : A \to C$, with $g(x)=f(x)$. Then $g$ is not surjective even though $f$ is. So if we drop the distinction between "codomain" and "range", then the notion of surjectivity becomes trivial.
Sometimes we want to study all functions with some fixed domain and codomain (or perhaps a certain large collection of such functions). For instance, all one-variable calculus is about functions from $\mathbb{R}$ to $\mathbb{R}$. Such functions are related to one another even when they have different ranges.