In this section we cover Domain, Codomain and Range.

Here is a video on function contexts: The domain, codomain and range.
_

In the previous section we determined that a relationship requires context to be a function. The typical way to accomplish this is to supply a domain and a codomain for a function. We thus start with the definition of the domain and codomain.

Domain:
All of the (valid) input values for the independent variable(s).
Codomain:
A set of values that contains all the values a dependent variable can possibly be.

The definition of the codomain is often especially difficult to understand. It is helpful to instead think of the codomain as the entire list of the types of things that is output. As usual the best way to understand what the domain and codomain are, is with an example.

Recall in the soda machine example from the previous section we “put in the coordinates” and got out “our selected drink”. In this context the domain is the set of all possible letter and number combinations we could enter into the vending machine. In this case, we have all the combinations that start with a letter A-F and are followed by one of the numbers 1-5.

The codomain is a bit more tricky as it isn’t implicitly defined in our example. For the domain there is only one right answer, but for the codomain we could use any set of things that includes all possible outputs from the machine. So any set that includes the items Pepsi, Fanta, Sierra Mist, Blue Gatorade, Green Gatorade, Coke, Sprite, Crush, Root Beer, Cream Soda, and Water would be valid.

However, there are more natural codomains to use. For example, using the above list along with “skyscraper” and “vacuum” wouldn’t make much sense; after all “skyscraper” and “vacuum” have nothing to do with the other items in the list. Instead a good codomain to use would be the most specific category of things we can come up with that includes all those items we need. For example we could use as our codomain “the set of all drinks”. This clearly includes all the things we need (since everything in the vending machine is a drink of some kind) but doesn’t include unrelated and random stuff like skyscrapers or vacuums.

An astute student may ask why we don’t just use the list of things we needed to include without adding anything more. The answer is that we absolutely can do this! We could use, as our codomain, just the set of actually attainable outputs; Pepsi, Fanta, Sierra Mist, Blue Gatorade, Green Gatorade, Coke, Sprite, Crush, Root Beer, Cream Soda, and Water. This is such a nice codomain that we even give it its own term: the range of our function. In particular, the range of a function is a subset of the codomain that represents all values that the function actually can output. One should note that in some cases it is too difficult to list or even calculate the range of a function, which is why we don’t always use the range as our codomain.

To be clear then, in our example the range would be the list of possible drinks in the machine, ie ‘Pepsi, Fanta, Sierra Mist, etc...’ where we would list every drink type that is actually in that specific machine (as well as being a member of the given codomain).

Be careful though! Notice that the range may depend on the situation and the precise wording of the setting. For example, if the vending machine is sold out of Coke, then it would not be listed in our range. Similarly, if a diabetic has very high blood sugar but is dehydrated, their function’s codomain might be something like ’drinks without sugar’ in which case their range would be a very narrow subset of the vending machine’s list of drinks.

1 : An item is in the range if it is something that...
is a possible output of the function somehow. is a member of the codomain. is a possible output of the function for a given input that is in the domain. would drive a student mad and make them fail this question.
2 : An element is in the domain if...
it is something that the function can compute to a number. it is something that makes sense in the context of the problem. it is an element that was explicitly given in the problem. it is an element that satisfies any/all conditions that were provided in the problem to describe the domain.
3 : The best conceptual way to think of the codomain is ...
The collection of things that contains the range of the relation. All the possible outputs of the relation/function. The type of thing that the relation/function outputs. The type of thing that the input of the relation is. The (actually possible) inputs of a relation/function.