Chapter 2 Functions

Functions, Names, Domain, Range

We say that a variable [Maple Math] is a function of another variable [Maple Math] , if given any value of [Maple Math] we have a well defined procedure to compute the value of [Maple Math] . The simplest example of a function is given by the equation [Maple Math] , which associates the value [Maple Math] to y when any value of x is chosen. Thus, if [Maple Math] , then [Maple Math] [Maple Math] . We will find it convenient to use names to denote such rules. Thus we may prefer to say [Maple Math] , where the function [Maple Math] . This notation has the advantage that we can describe the assignment of values to [Maple Math] in a concise fashion. Thus the sentence that ``if [Maple Math] , then [Maple Math] '' can be simply stated as [Maple Math] .

If we consider a new function [Maple Math] , then we see that [Maple Math] does not make sense and hence we should allow restrictions on the values allowed for the variable x. The set of such allowed values is called the domain of the function. Sometimes, we may want to restrict the values of the variable for practical reasons which may have little to do with evaluation problems.

For example, if [Maple Math] denotes the length of the side of a square and the function [Maple Math] denotes the area of such a square, then it makes sense to state that the domain of the function A(x) is the set of nonnegative real numbers, even though the formula [Maple Math] makes perfect sense for negative [Maple Math] also.

This [Maple Math] is an example of a function which is defined by a geometric procedure first, but then we make an algebraic formula. Sometimes we may need several algebraic formulas and sometimes the function may not have any known formula. For instance the daily average temperature at a place is a function of the date, but usually all we expect to know completely is a few values of this function! Sometimes, such functions are interpolated by ordinary mathematical functions for estimation and prediction, but in reality, we are only stipulating the existence of such functions!

Another example of a function without a formula is the one where the domain is a set of people and the function associates the chosen first name to each person. Here neither the domain nor the values of the function are real numbers and we don't expect any formulas. Fortunately, our functions would usually be about real numbers.

Given a domain [Maple Math] and a function [Maple Math] we say that the set of all possible values obtained by evaluating the function f(x) is said to be the image or the range of the function f . For instance, the range of the area function [Maple Math] described above is the set of all nonnegative real numbers.

Graphs of Functions

Mathematical functions can be usually described by a graph which consists of plotting all possible points ( [Maple Math] ) as [Maple Math] varies in the domain. Such graphs will usually look like curves. We now think about which curves can be graphs of functions. Given a graph and a value [Maple Math] , to get the value of [Maple Math] , we simply have to draw the vertical line [Maple Math] and see where it hits the graph: f(t) is the ``y-coordinate'' of the point of interesection. (If t is not in the domain then the vertical line fails to meet the graph at all).

The condition that the graph comes from a function states that every such vertical line (as x varies in the domain) must hit the graph at exactly one point. This is the so-called `` vertical line test ''. If we do not insist that x varies in the domain but rather varies over all real numbers then the test says that each vertical line meets the graph at at most one point. In this case the set of elements x for which the vertical line does meet the graph are the domain of the function. Those numbers c for which the horizontal line [Maple Math] meets the graph are exactly the members of the image or range of the function.


Given a value of x, a function has to give you only one value of y. Thus, vertical lines are not graphs of functions. For example, the line x=1 fails the test in two ways. If we take
[Maple Math] , then both ( [Maple Math] ) and ( [Maple Math] ) are on the graph, so the vertical line hits in more than one point. (Actually it hits infinitely often.) Also, if we take any other value, say [Maple Math] , then the vertical line does not hit the graph at all! So, we have a failure of the condition, if our domain contains at least one more point besides [Maple Math] .

[Maple Plot]

[Maple Plot]

[Maple Plot]

code for above diagrams

Natural Domains, Assymptotes, Independant and Dependant Variables

We have seen that the domain of a function is a matter of choice, as long we stick to points for which the function can be uniquely evaluated. Given a mathematical formula, it makes sense to think about a `` natural domain '', that is the largest set of real numbers which can be in the domain without violating the definition.

For example, the square-root function [Maple Math] is the rule which says, given an x-value, take the nonnegative number whose square is x. This rule only makes sense if x is positive or zero. We say that the natural domain of this function is [Maple Math] .

We often use a more precise notation which is:


The domain of the function
[Maple Math] is { [Maple Math] : [Maple Math] }

Alternately, we can use interval notation, and write that the domain is [ [Maple Math] ). (In interval notation, square brackets mean that the endpoint is included, and a parenthesis means that the endpoint is not included.) The fact that the domain of [Maple Math] is [ [Maple Math] ) means that in the graph of this function (see above) we have points ( [Maple Math] ) only above x-values on the right side of the x-axis. We may often drop the word ``natural'' and say that it is ``the domain'' of the given function.

Another basic example of a function whose domain is not the entire x-axis is: [Maple Math] = [Maple Math] , the reciprocal function. We know that we cannot substitute [Maple Math] in this formula. The function makes sense, however, for any nonzero [Maple Math] , so we get that the (natural) domain is: [Maple Math] . The graph of this function does not have any point ( [Maple Math] ) with [Maple Math] . As x gets close to 0 from either side, the graph goes off toward infinity. We call the vertical line [Maple Math] a (vertical) asymptote of the given graph.

To summarize, usually there are two reasons why certain x-values are excluded from the domain of a function: (i) we cannot divide by zero, and (ii) we cannot take the square root of a negative number. A possible third reason is that the variable x is associated with quantities for which only certain values are allowed. We have already illustrated this in the function above.

In a story problem, often letters different from x and y are used. In using a computer it is not uncommon to denote variables by entire words. For example, the volume V of a sphere is a function of the radius r, given by the formula [Maple Math] = [Maple Math] . Also, letters different from f may be used. For example, if y is the velocity of something at time t, we write [Maple Math] with the letter v (instead of f) standing for the velocity function (and t playing the role of x).
In using a computer system, it might make more sense to write
[Maple Math] = [Maple Math] . The computer can do the calculations in either symbolism with equal ease, but it is easy to recall your own reasoning after many days, if you use the long notations.

The letter playing the role of [Maple Math] is called the independent variable , and the letter playing the role of [Maple Math] is called the dependent variable (because its value ``depends on'' the value of the independent variable). In story problems, when one has to translate from English into mathematics, a crucial step is to determine what letters stand for variables. If only words and no letters are given, then you have to decide which letters to use. Some letters are traditional. For example, almost always, t stands for time.

Example 2.1 (Open-top box)

An open-top box is made from an a by b rectangular piece of cardboard by cutting out a square of side x from each of the four corners, and then folding the sides up. Find a formula for the volume V of the box as a function of x, and find the domain of this function.

Solution

Here the box we get will have height [Maple Math] , and rectangular base of dimensions [Maple Math] by [Maple Math] . Thus, [Maple Math] = [Maple Math] .
Here a and b are constants, and V is the variable that depends on x, i.e., V is playing the role of y. Note that for the problem to make sense, the constants a,b have to be positive!
This formula makes mathematical sense for any
[Maple Math] , but in the story problem the domain is much less. In the first place, x must be positive. In the second place, it must be less than half the length of either of the sides of the cardboard. Thus, the domain is { x : 0<x< [Maple Math] and 0<x < [Maple Math] }. In interval notation, we write: the domain is the interval (0, [Maple Math] [Maple Math] ).

We now give more examples of the domain of a purely mathematical function.

Example 2.2: Circle of Radius r centered at Origin.

The equation for this circle is usually given in the form [Maple Math] .
To write the equation in the form
[Maple Math] we solve for [Maple Math] , obtaining y = +/- [Maple Math] . But this is not a function, because when we have an x it does not give us a [Maple Math] value of y but rather [Maple Math] (provided that x is between [Maple Math] and [Maple Math] ). To get a function, we must choose one of the two signs in front of the square root. If we choose the positive sign, for example, we get the upper semicircle [Maple Math] = [Maple Math] . The domain of this function is the interval [Maple Math] , i.e., x must be between -r and r (including the endpoints). If x is outside of that interval, then [Maple Math] is negative, and we cannot take the square root. In terms of the graph, this just means that there are no points on the curve whose x-coordinate is greater than [Maple Math] or less than [Maple Math] .

Note that it is equally possible to take the negative square root and then the graph is that of the lower semicircle. This is a different function with domain [Maple Math] .

[Maple Plot]

[Maple Plot]

code for above diagrams

Example 2.3:

Find the domain of [Maple Math] = [Maple Math] .

Solution

To answer this question, we must rule out the x-values that make [Maple Math] negative (because we cannot take the square root of a negative) and also the x-values that make [Maple Math] zero (because if [Maple Math] , then when we take the square root we get 0, and we cannot divide by 0). In other words, the domain consists of all x for which [Maple Math] is strictly positive. We give three different methods to find out when [Maple Math] .

First method. Factor [Maple Math] as [Maple Math] . The product of two numbers is positive when either both are positive or both are negative, i.e., if either [Maple Math] and [Maple Math] , or else [Maple Math] and [Maple Math] . The latter alternative is impossible, since if [Maple Math] is negative, then [Maple Math] is greater than 4, and so cannot be negative. As for the first alternative, the condition [Maple Math] can be rewritten (adding x to both sides) as [Maple Math] , so we need: [Maple Math] and [Maple Math] (this is sometimes combined in the form 4 > x > 0, or, equivalently, 0 < x < 4). In interval notation, this says that the domain
is the interval (0,4).

Second method. Write [Maple Math] as [Maple Math] , and then complete the square, obtaining - ( [Maple Math] ) = [Maple Math] . For this to be positive we need [Maple Math] , which means that [Maple Math] must be less than 2 and greater than -2: [Maple Math] . Adding 2 to everything gives [Maple Math] .

Third method. Again factor [Maple Math] as [Maple Math] . Thus the product is zero when [Maple Math] or [Maple Math] . Mark these two points on a usual number line. This yields three pieces of the number line which, in interval notation, are:

[Maple Math] , [Maple Math] , [Maple Math]

Our function [Maple Math] must keep a constant sign on each of these intervals. We can test the signs easily by testing any convenient point in each interval. For example, in [Maple Math] , try [Maple Math] and consider [Maple Math] . In [Maple Math] , try x=1 to get [Maple Math] and in [Maple Math] , try [Maple Math] to get [Maple Math] . So the needed interval is [Maple Math] . Since we need to avoid the zeros of our function, the answer is [Maple Math] =(0,4). In general, you will have to investigate the endpoints separately.

Piecewise Functions, Fuzzy Functions and Philosophy

A function does not always have to be given by a single formula. For example, suppose that [Maple Math] is the velocity function for a car which starts out from rest (zero velocity) at time [Maple Math] ; then increases its speed steadily to 20 m/sec, taking 10 seconds to do this; then travels at constant speed 20 m/sec for 15 seconds; and finally applies the brakes to decrease speed steadily to 0, taking 5 seconds to do this. The formula for [Maple Math] is different in each of the three time intervals. The graph of this function is shown below, along with the three formulas:


[Maple Math]

[Maple Plot]

code for the above diagrams

Not all functions are given by formulas. A function can be given by an experimentally determined table of values. For example, the population y of the U.S. is a function of the time t: we can write [Maple Math] . This is a perfectly good function --- you could graph it if you had data for various t --- but you couldn't find an algebraic formula for it.

Another inportant point is that this is a fuzzy function! Its mathematical form, once written down, gives a good function, but whether it is ``really equal'' to the actual function being discussed is always in doubt and subject to disputes and opinions. Even though the function may exist and be well defined,
it is impossible for anyone to claim to know it completely or to be able to prove the claim!

This raises an interesting philosophical question. Does a function exist if its description seems to make sense, but nobody can ever determine all its function values - or even a formula for it! The uncertainty principle of Physics makes this problem even more intriguing, since it states that it is impossible to precisely determine both the time and the position of a moving particle. In Mathematics, we don't have to worry about such uncertainties!

Shifts and Expansions

Many functions in applications are built up from simple functions by inserting constants in various places. It is important to understand the effect such constants have on the appearance of the graph.

Horizontal Shifts

If you replace x by x-C everywhere it occurs in the foumula for f(x), then the graph shifts over C to the right. (If C is negative, then this means that the graph shifts over [Maple Math] to the left.)

For example, the graph of [Maple Math] is the parabola [Maple Math] shifted over to have its vertex at the point 2 on the x-axis. The graph of [Maple Math] is the same parabola shifted over to the left so as to have its vertex at [Maple Math] on the x-axis.

If you have to do such sketches by hand, often the trick is to draw the original parabola [Maple Math] and then just shift the y-axis to the desired new location. Think why you must shift the y-axis for an apparent shift in x values. Also, you should remember that to shift a curve to the left is the same as shifting the y-axis to the right by the same amount.

Vertical Shifts

If you replace y by [Maple Math] , then the graph moves up D units. (If D is negative, then this means that the graph moves down [Maple Math] units.) If the formula is written in the form [Maple Math] and if y is replaced by [Maple Math] to get [Maple Math] , we can equivalently move D to the other side of the equation and write [Maple Math] . Thus, this principal can be stated: to get the graph of [Maple Math] , take the graph of [Maple Math] and move it D units up. For example, the function [Maple Math] = [Maple Math] can be obtained from [Maple Math] (see the last paragraph) by moving the graph 4 units down. The result is the [Maple Math] -parabola shifted 2 units to the right and 4 units down so as to have its vertex at the point ( [Maple Math] ).

Just as explained above, this can also be accomplished by shifting the x-axis accordingly. It is of course, much easier to redraw the axes in a different location than to redraw the whole curves.

Warning: Do not confuse [Maple Math] and [Maple Math] . For example, if [Maple Math] is the function [Maple Math] , then [Maple Math] is the function [Maple Math] , while f(x+2) is the function [Maple Math] . To sketch [Maple Math] , the graph of [Maple Math] has to be pushed up by 2 units; but to sketch the graph of [Maple Math] , the same graph has to be pushed to the left by two units.

Example : (Shifting Circles)

An important example of the above two principles is the circle [Maple Math] . This is the circle of radius r centered at the origin. (As we saw, this is not a single function [Maple Math] , but rather two functions y=+- [Maple Math] put together; in any case, the two shifting principles apply to equations like this one which are not in the function form [Maple Math] .) If we replace [Maple Math] by [Maple Math] and replace [Maple Math] by [Maple Math] --- getting the equation [Maple Math] --- the effect on the circle is to move it C to the right and D up, thereby obtaining the circle of radius r centered at the point (C,D). This tells us how to write the equation of any circle, not necessarily centered at the origin.
We will later want to use two more principles concerning the effects of constants on the appearance of the graph of a function.

Horizontal Expansion

If A is positive and x is replaced by x/A in a formula, then the effect on the graph is to expand it by a factor of A in the x-direction (away from the y-axis). This wording supposes that A>1. If A is between 0 and 1, then ``expand by a factor of A'' means ``contract by a factor of 1/A.'' For example, replacing x by [Maple Math] has the effect of contracting toward the y-axis by a factor of 2.

If A is negative, then we expand by a factor of [Maple Math] and then flip about the y-axis. Thus, replacing x by -x has the effect of taking the mirror image of the graph with respect to the y-axis. For example, the function [Maple Math] , which has domain [Maple Math] , is obtained by taking the graph of [Maple Math] and flipping it around the y-axis into the second quadrant.

Vertical expansion:

If B is positive and y is replaced by [Maple Math] in a formula, then the effect on the graph is to expand it by a factor of B in the vertical direction, away from the x-axis.

Note that if we have a function [Maple Math] , replacing y by [Maple Math] is equivalent to multiplying the function on the right by [Maple Math] : [Maple Math] . The effect on the graph is to expand the picture away from the x-axis by a factor of [Maple Math] if [Maple Math] , and to contract it toward the x-axis by a factor of [Maple Math] if 0< [Maple Math] <1. If [Maple Math] <0, then as before the operation is to expand by [Maple Math] a nd then flip about the x-axis.

As above, we can avoid redrawing the graph in the case of vertical or horizontal expansions. We simply choose an appropriate new scale on the axes, keeping our original curve in tact. While this may be convenient, it may not be the best visual illustration. As we will illustrate below, we can declare a circle to be an ellipse or an ellipse to be a circle by a simple change of scales on the axes. Thus, if we want comparable scales on the two axes, then this trick is not available. See the illustrations below.

[Maple Plot]

[Maple Plot]

[Maple Plot]

[Maple Plot]

[Maple Plot]

code for the above diagrams

Example: (Ellipses)

A basic example of the two expansion principles is given by an ellipse of semimajor axis a and semiminor axis b . We get such an ellipse by starting with the unit circle --- the circle of radius 1 centered at the origin, the equation of which is [Maple Math] --- and stretching it by a factor of a horizontally and by a factor of b vertically. To get the equation of the resulting ellipse, which crosses the x-axis at +-a and crosses the y-axis at +-b, we replace [Maple Math] by [Maple Math] and [Maple Math] by [Maple Math] in the equation for the unit circle. This gives

[Maple Math]


Finally, if you want to analyze a function that involves both shifts and expansions, it is usually necessary to deal with the expansions first, and then the shifts. For instance, if you want to expand a function by a factor of
[Maple Math] in the x-direction and then shift [Maple Math] to the right, you do this by replacing x first by [Maple Math] and then by [Maple Math] in the formula. As an example, suppose that, after expanding our unit circle by a in the x-direction and by b in the y-direction to get the ellipse in the last paragraph, we then wanted to shift it a distance [Maple Math] to the right and a distance [Maple Math] upward, so as to be centered at the point ( [Maple Math] ). The new ellipse would have equation


[Maple Math]

A concrete example might be the function [Maple Math] . Naturally, you want to start with the model parabola [Maple Math] . Then you should first do the vertical expansion [Maple Math] , either by just renaming the scale or preferably by sketching the curve again in the new formula. The resulting curve can then be shifted horizontally and vertically as needed. You should experiment with changing the order of these operations and see what trouble you get into.

table of contents