Codomain vs image

A func­tion \(f : X \to Y\) with do­main \(X\) and codomain \(Y\) can­not nec­es­sar­ily pro­duce all val­ues in \(Y\). For ex­am­ple, con­sider the func­tion that takes a real num­ber and squares it. We could say that this func­tion has codomain \(\mathbb R\), be­cause it pro­duces a real num­ber, even though its image is the set of non-nega­tive real num­bers.

Domain, Codomain, and Image

If \(f\) maps \(X\) to a sub­set \(I\) of \(Y\), why not just say that its codomain is \(I\) and do away with the dis­tinc­tion be­tween codomain and image? There are at least two cases where the dis­tinc­tion is use­ful.

  1. It is use­ful to dis­t­in­guish codomain from image in cases where the type of thing that the func­tion pro­duces is easy to spec­ify, but the spe­cific val­ues are hard to calcu­late. Con­sider, for in­stance, the Ack­er­mann func­tion. It definitely pro­duces num­bers (i.e. its codomain is \(\mathbb N\)), but it’s not easy to figure out what num­bers (ex­actly) it pro­duces. When talk­ing about what sort of out­puts to ex­pect from the Ack­er­mann func­tion, the nat­u­ral an­swer is “a num­ber,” rather than “ei­ther 1 through 7, 9, 11, 13, 29, 61, 125, 65533, \(2^{65536} − 3\), or some other un­godly large num­bers that I lack the re­sources to calcu­late.” For this pur­pose, the codomain can be thought of as a nat­u­ral/​sim­ple bound­ary drawn around a com­plex image.

  2. Cases where we’re con­sid­er­ing a set of all func­tions that map into a cer­tain set. For ex­am­ple, if we’re dis­cussing all pos­si­ble func­tions from the nat­u­ral num­bers to the set \(\{0, 1\},\) we want to be able to talk about “func­tions with codomain \(\{0, 1\}\)” even if some of those func­tions are things like “always re­turn 0″ (which have an image smaller than \(\{0, 1\}\)). For this pur­pose, the codomain can be thought of as a con­text-de­pen­dent tool that’s use­ful when con­sid­er­ing (or mak­ing use of) a bunch of differ­ent func­tions that are all pro­duc­ing ob­jects of the same type.