Functions


 Functions

A function is a rule for transforming an object into another object. The object you start with is called the input, and comes from some set called the domain. What you get back is called the output; it comes from some set called the codomain. Here are some examples of functions:
 • Suppose you write f(x) = x2. You have just defined a function f which transforms any number into its square. Since you didn’t say what the domain or codomain are, it’s assumed that they are both R, the set of all real numbers. So you can square any real number, and get a real number back. For example, f transforms 2 into 4; it transforms −1/2 into 1/4; and it transforms 1 into 1. This last one isn’t much of a change at all, but that’s no problem: the transformed object doesn’t have to be different from the original one. When you write f(2) = 4, what you really mean
is that f transforms 2 into 4. By the way, f is the transformation rule, while f(x) is the result of applying the transformation rule to the variable x. So it’s technically not correct to say “f(x) is a function”; it should be “f is a function.”
 • Now, let g(x) = x2 with domain consisting only of numbers greater than or equal to 0. (Such numbers are called nonnegative.) This seems like the same function as f, but it’s not: the domains are different. For example, f(−1/2) = 1/4, but g(−1/2) isn’t defined. The function g just chokes on anything not in the domain, refusing even to touch it. Since g and f have the same rule, but the domain of g is smaller than the domain of f, we say that g is formed by restricting the domain of f.
 • Still letting f(x) = x2, what do you make of f(horse)? Obviously this is undefined, since you can’t square a horse. On the other hand, let’s set
h(x) = number of legs x has,
where the domain of h is the set of all animals. So h(horse) = 4, while h(ant) = 6 and h(salmon) = 0. The codomain could be the set of all nonnegative integers, since animals don’t have negative or fractional numbers of legs. By the way, what is h(2)? This isn’t defined, of course, since 2 isn’t in the domain. How many legs does a “2” have, after all? The question doesn’t really make sense. You might also think that h(chair) = 4, since most chairs have four legs, but that doesn’t work either, since a chair isn’t an animal, and so “chair” is not in the domain of h. That is, h(chair) is undefined.
• Suppose you have a dog called Junkster. Unfortunately, poor Junkster has indigestion. He eats something, then chews on it for a while and tries to digest it, fails, and hurls. Junkster has transformed the food into ... something else altogether. We could let
j(x) = color of barf when Junkster eats x,
where the domain of j is the set of foods that Junkster will eat. The codomain is the set of all colors. For this to work, we have to be confident that whenever Junkster eats a taco, his barf is always the same color (say, red). If it’s sometimes red and sometimes green, that’s no good: a function must assign a unique output for each valid input.
Now we have to look at the concept of the range of a function. The range is the set of all outputs that could possibly occur. You can think of the function working on transforming everything in the domain, one object at a time; the collection of transformed objects is the range. You might get duplicates, but that’s OK. So why isn’t the range the same thing as the codomain? Well, the range is actually a subset of the codomain. The codomain is a set of possible outputs, while the range is the set of actual outputs. Here are
• If f(x) = x2 with domain R and codomain R, the range is the set of nonnegative numbers. After all, when you square a number, the result cannot be negative. How do you know the range is all the nonnegative numbers? Well, if you square every number, you definitely cover all nonnegative numbers. For example, you get 2 by squaring √2 (or−√2).
• If g(x) = x2, where the domain of g is only the nonnegative numbers but the codomain is still all of R, the range will again be the set of nonnegative numbers. When you square every nonnegative number, you still cover all the nonnegative numbers.
 • If h(x) is the number of legs the animal x has, then the range is all the possible numbers of legs that any animal can have. I can think of animals that have 0, 2, 4, 6, and 8 legs, as well as some creepy-crawlies with more legs. If you include individual animals which have lost one or more legs, you can also include 1, 3, 5, and 7 in the mix, as well as other possibilities. In any case, the range of this function isn’t so clear-cut; you probably have to be a biologist to know the real answer.
 • Finally, if j(x) is the color of Junkster’s barf when he eats x, then the range consists of all possible barf-colors. I dread to think what these are, but probably bright blue isn’t among them.

Comments

Popular Posts