Last week we looked at what functions are; but many students wonder **why it all matters**. What makes them useful? What makes functions worth distinguishing from non-functions? Why do we make the distinction we do? We love “why” questions, because they make us think more deeply!

## Why do we need functions at all?

The following 2002 question will start us off:

Why Do We Have Functions?Why do we have functions?For example, f(x) = x^2, then f(2) = 2^2 = 4. Or why do we have things like g(x) = x + 3, find g[f(2)] ?

The question appears to be about the value of the notation, and also about the concept itself.

### To name them

I answered:

Hi, Lisa. Basically, the concept of functionsgives us a way to name the whole processof evaluating a particular expression, so we can talk about it as a whole. We cancompare different functions, discuss theirproperties, or actually operate on functions tomake new functions. It also broadens the concept, because not all functions can be written as a simple expression. These two processes, naming things and extending them, are central to what mathematics is all about. For example, the first function you showed can be called 'squaring', and the second can be called 'adding 3'; but most functions would have to have much more complicated names. By calling one f and the other g, we have a simple way to discuss them. Some functions, like the square root and the absolute value, can't be expressed in terms of more basic functions, but only by inventing a whole new symbol. In fact, we like to write the square root as 'sqrt(x)', using function notation, because we don't have the symbol available in e-mail.

That is, \(\sqrt{x}\) is really a special symbol for a function, and when you can’t type the symbol, you can use more typical function notation, \(\text{sqrt}(x)\), and mean exactly the same thing. But whether you use a special symbol or a letter or a word (like “sin” or “log”), it’s important to have a name.

### To manipulate them

We can alsotreat these names like variables, where we don't know what specific functions we are calling f and g, yet we can say general things about the relation of f and g, proving that something is true for ANY functions, or at least for any functions of a certain type, all at once. That is powerful!

For example, just as we can use variables to stand for any number and say that \(a+b=c\), which generalizes the specific fact that \(3+4=7\), we can talk about a function \(f+g=h\), defined as \(h(x)=(f+g)(x)=f(x)+g(x)\), where *f* and *g* could be any functions at all.

### To do algebra with them

Composition of functionstakes two functions and makes a new one out of them. Theinverseof a function is a new function that has some important properties; in fact, if you think of composition as a sort of "multiplication" of two objects (which are whole functions), then the inverse function is sort of a "reciprocal". In fact, that's why we use the notation we do for inverse functions. We've taken a familiar idea from arithmetic and applied it to something far bigger, largely just by having named functions.

The **composition** of two functions *f* and *g*, written as \(f\circ g\), produces a new function *h* defined by $$h(x) = (f\circ g)(x)=f(g(x))$$ The **identity** function *id* is defined by \(id(x)=x\) for any *x*. The **inverse** of a function *f* is a function \(f^{-1}\) such that \(f\circ f^{-1}=id\) and \(f^{-1}\circ f=id\); that is, $$f(f^{-1}(x))=x\text{ and }f^{-1}(f(x))=x\text{ for all }x$$ This is similar to the fact that 1 is the (multiplicative) identity, and the reciprocal, \(x^{-1}=\frac{1}{x}\) of a number *x* is the number \(y=x^{-1}\) such that \(xy=1\text{ and }yx=1\). In fact, that parallel is the reason for the superscript -1 notation.

Composition can be thought of as something like plumbing or electrical wiring, where we buy parts off the shelf and connect them end-to-end to make a new device or to wire a house or factory according to our needs. We know how each pipe, wire, switch, etc. functions (pun intended), and we know how they combine, sowe can understand the whole complicated system in terms of its parts. Without the function concept, we couldn't do that in math.

Without functions, we couldn’t name the parts!

### Especially for calculus

The concept is most useful when you get tocalculus, and find that thederivativeand theintegralareoperations on functions: given one function f, you can make a new function f' out of it, that has certain important properties. This moves math up one level from algebra. So the concept of functions is essential for a good understanding of calculus.

The derivative of a function *f* is a new function \(f’\) such that \(f'(x)\) gives the rate of change of *f* at a given input *x*. It is a function *derived* from the function *f* in a particular way. And this realization that what differentiation does it to turn one function into another function helped in making sense of the whole idea.

The concept of a function is also central tocomputer programming, though the details are somewhat different there. Most of what a programmer writes consists of 'functions' that do parts of the work of the program. By designing functions that do little pieces, we can string them together to do more complicated things without looking so complicated. For example, thesqrtfunction I mentioned gets its name from many computer programming languages that provide this and many other built-in functions so we don't have to write them ourselves. By making that just part of a more general concept of functions, we are able to write our own functions, and then put those together to make larger functions.

The idea of a function originated with Leibnitz, one of the originators of calculus, in the 1600’s, and the notation \(f(x)\) originated with Euler in the 1700’s. The notation \(f'(x)\) originated with Lagrange around 1800. All of these were working in calculus; the more general idea of relations, which is used in many different ways, came later.

## Why do we care whether something is a function?

A 2005 question sounds a lot like the last one, but has a different focus:

Why Are Functions Important? Why does it matterif something is a function or not?

We define a function as having only one output for a given input; if that isn’t true, it isn’t a function. Why do we care?

I answered, first referring to the question above:

Hi, Pardue. That depends on the context, of course. I suppose you're asking why we teach how to determine whether a relation is a function or not. For some ideas on whythe concept of a functionis important, see Why Do We Have Functions? http://mathforum.org/library/drmath/view/62559.html As towhy we would want to determine whether something is a function, consider the definition of a function. First, if it is a function, then we can calculate its value given the input; there is only one answer.If it is not a function, then we can't know which answer to choose.That's certainly worth knowing. For example, we know that the square root would not be a function if we allowed it to mean either root, so we choose to define the radical symbol as representing only the principal root. That decision was made essentially so that we would have a function, and expressions involving it would not be ambiguous.We want a symbol to have only one meaning, where possible.It's also worth knowing that when we work with complex numbers, the square root is NOT a function; there is no way to consistently define the square root as having only one value. Knowing that can help us avoid some common mistakes.

Although it *is* actually possible to define a principal square root of a complex number, that can’t be done in a way that makes it always true that \(\sqrt{x}\sqrt{y}=\sqrt{xy}\); that’s what I mean by “consistent”.

The important thing here is that function notation would be useless if \(f(x)\) didn’t have a single value.

### Well-defined functions

Similarly, in certain fields of math we define functions in roundabout ways, and have to show that it is "well-defined", meaning that itreally has just one valuethat is not dependent on how we define it. As an example, you might define a function on rational numbers based on the numerator and denominator of the fraction, and you have to make sure that you will get the same answer regardless of which equivalent fraction you use to do the calculation. That is an example of determining whether something is a function, and it amounts to asking, does what I'm doing make sense at all?

For example, if we defined a function \(f(\frac{p}{q})=q-p\), giving the difference between the numerator and denominator of a fraction, then \(f(\frac{2}{3})=3-2=1\) but \(f(\frac{4}{6})=6-4=2\), so it would not be a function of the *value* of the fraction, but of *how it is written*. It would not be a function of a rational *number*. On the other hand, the sine function is defined as the ratio of the opposite side to the hypotenuse of a right triangle with a given angle (that is, the definition is based on an arbitrary triangle representing the angle); to prove that it *is* a function of the angle, we have to show that we get the same value for *any* right triangle with that angle. (See What Are Trig Functions, Really?)

### Calculus again

Further, there aresome things we can do only with functions-- differentiating and integrating in calculus come to mind, and it is my understanding that the concept of function was invented primarily so that we could talk about what those operations do (change one function into another). We have to know we have a function in order to do those things. Then, too, the fact that a relation is a function is just one more thing to know about it, which can help in graphing it or otherwise working with it.

Recall that a **relation** is a generalization of the concept of a function, in which we don’t have to have a unique “output”, but are merely matching up values from one set with values from another, with duplicates allowed. Relations give us a way to name what we are doing when we don’t need a single output, or when we don’t yet know whether we do.

## Why does a function have to have one value?

This question from Cindy in 1997 is specifically about determining whether a relation is a function:

Function Tests I am currently studying functions and am not finding them terribly difficult. However, I do have a question aboutthe reasoning behind the nature of functions. I understand the rules quite well that say, in order to be a function, a relation must pass thevertical line test. I also understand that for a function to be one-to-one, it must pass thehorizontal line testand only functions that pass the horizontal line test can have inverses. What I don't understand is the reasoning behind the rules. My teacher said this is simply the definition of a function so I shouldn't worry about it. Can you explain to me why it is necessary for every domain value to have one range value, but one range value can have more than one domain value? I don't understand why these definitions were made for functions. It just doesn't make intuitive sense to me. Perhaps you can tell mewhat types of problems mathematicians use functions to solve that make these definitions necessary. The examples in the book don't really answer this question. That y is a function of x seems to be a law of physics in the math books I've consulted. Please don't tell me I don't know enough math to understand the answer; or, if you do, tell me what math I need to learn to understand it, at the very least, and I will look it up in the library.

Do we just have to accept the definition, or is there a good reason for it?

Doctor Ceeks answered:

The reason why functions must pass the vertical line test is, indeed, part of the definition of a function. But it is something worth thinking about. The notion of function is certainly one of the most important notions in all of mathematics andhas its origins in some very concrete examples. Consider this situation: every item in a store has a cost, but no item has two different prices attached to it. When you ask: "what is the price of this object?" you can think of it as asking for the value of a certain function. This function is a function whosedomainis the items in the store, and whoserangeis nonnegative numbers (usually, the store doesn't pay you when you buy something, which is why I'm saying nonnegative numbers!). You can actually say, let P be the function which gives the price of the object. Then P(soap) = 1.29, P(cereal) = 2.29, P(toothbrush) = 2.25 and so on.

The key idea is that an item should have only one price; otherwise, we couldn’t ask for “the price”, and we wouldn’t know what to pay.

The "vertical line test," in the context of the above example, says that no item has two or more prices (or, in other words,every item has a unique price). The "horizontal line test," in the context of the above example, asks whether, for a given price, there can be more than one item. That is, can different items have the same price? And the answer is, sure they can. It wouldn't surprise me at all if the price of a sponge and the price of a box of tea bags were the same.

When a relation is *not a function*, it may be able to be used in some way, but not in the way we need here (and in many other situations). When a relation is *not one-to-one*, it just means we can’t do a “reverse lookup”, finding a unique item with a given price. On the other hand, such a relation *does* have an inverse *relation*; it just isn’t a *function*. (We could use it to find *all* items with a given price.)

The notion of function grew into its important place because people began recognizing functions everywhere. For example, in physics, they sometimes ask about the height of a falling ball as a function of time. In this example, the "vertical line test" asks whether at a given time, a ball can be in two different places. This is impossible! The "horizontal line test" asks whether the ball can be at a certain height at different times. If you think of a basketball going up, then down, you can see that yes,it can have the same height at two different times.

And it might be useful to find both of those times!