This site is devoted to mathematics and its applications. Created and run by Peter Saveliev.

# Functions

### From Mathematics Is A Science

## Contents

- 1 Sets and relations
- 2 Functions
- 3 How numerical functions emerge: optimization
- 4 How numerical functions emerge: motion
- 5 The real number line
- 6 Set building
- 7 The $xy$-plane: where graphs live...
- 8 Relations and curves
- 9 A function as a black box
- 10 Give the function a domain...
- 11 The graph of a function
- 12 Algebra creates functions
- 13 Algebra creates functions, continued
- 14 The image: the range of values of a function

## 1 Sets and relations

In mathematics, we refer to any loose collection of objects or entities -- of any nature -- as a *set*.

For example, is this a circle? No, the points it is made of aren't connected to each other or to any location.

One shake and the circle is gone!

The idea of set contrasts with such expressions as “a set of knives” when the word “set” suggests a certain structure. It is the same set: the knives arranged in box or piled up on the counter. Or, the books on a shelf arranged alphabetically or chronologically.

What creates a set is our knowledge or ability to determine whether an object *belongs or does not belong* to it.

**Example.** A roster of a class produces a set of the students in this class. On the other hand, the *female* students in the class also form a set even if there is no such list; we can just go down the roster and determine if a student belongs to this new set. $\square$

**Example.** A lot of sets examined early in this book will be sets of *numbers*. For example, take the set of even numbers; then we know that $2$ belongs to it but $3$ does not. Another example from mathematics is sets of *points* on the plane: straight lines, triangles, circles and other curves, etc.

We can tell whether a point belongs to the set... $\square$

**Exercise.** Give your own examples of sets and non-sets.

In the rest of this chapter we will use the following example. These five boys also form a set.

They are individuals. On the other hand, they are unrelated to each other: we can list them in any order, we can arrange them in a circle, a square, or at random, we can change the distances between them, and so on. It's the same set! The members of a set are called its *elements*.

A set is then nothing but a *list*:

- Tom,
- Ken,
- Sid,
- Ned,
- Ben.

Or: “Tom, Ken, Sid, Ned, Ben”, in any order. There is a specific mathematical **notation** for (finite) sets; we put the list in *braces*:
$$\begin{array}{lll}
&\{\text{ Tom }, \text{ Ken }, \text{ Sid }, \text{ Ned }, \text{ Ben }\}\\
=&\{\text{ Ned }, \text{ Ken }, \text{ Tom }, \text{ Ben }, \text{ Sid }\}\\
=&\{\text{ Ben }, \text{ Ken }, \text{ Sid }, \text{ Tom }, \text{ Ned }\}\\
=&\ ...
\end{array}$$
Repetitions aren't allowed!

Just as the boys have names, the set also needs one. We can call this set “Team”, or “Boys”, etc. To keep things compact, let's call it $X$:
$$X=\{\text{ Tom }, \text{ Ken }, \text{ Sid }, \text{ Ned }, \text{ Ben }\}.$$
We say then that Tom (Ken, etc.) is an element of set $X$, or we say that Tom *belongs* to set $X$.

We can form other sets from the same elements.

We can combine those five elements into any set with any number of elements as long as there is *no repetition*! For example, we might have these new sets:
$$\begin{array}{lll}
T=\{\text{ Tom }\},\quad K= \{\text{ Ken }\},\quad S= \{\text{ Sid }\},\quad N= \{\text{ Ned }\},\quad ...\\
A=\{\text{ Tom }, \text{ Ken }\},\quad B=\{\text{ Sid }, \text{ Ned }\},\quad ...\\
Q=\{\text{ Tom }, \text{ Ken }, \text{ Sid }\},\quad ...\\
\end{array}$$
These sets are called *subsets* of $X$. We will use the following **notation** to convey that idea:
$$T\subset X,\ K\subset X,\ A\subset X,\ Q\subset X,\ ...$$
The notation resembles the one for numbers: $1<2,\ 3<5$, etc. Indeed, a subset is, in a sense, “smaller” than the set that contains it.

**Example.** The diagram below shows the subset relations for the three numbers $1,2,3$:

Each arrow points from a set to another that contains it. $\square$

**Example.**

$\square$

Suppose there is another set, $Y$, the set of these four balls:

Once again, as a set $Y$ has no structure. It's just a list: $$\begin{array}{lll} Y&=\{\text{ basketball }, \text{ tennis }, \text{ baseball }, \text{ football }\}\\ &=\{\text{ football }, \text{ baseball }, \text{ tennis }, \text{ basketball }\}\\ &=\ ... \end{array}$$ We can add or remove balls from the set creating new sets freely. Let's put these together and ask ourselves, are these two sets related to each other somehow?

Yes, boys like sports! Let's make this idea specific. Each boy may be interested in a particular sport or he may not. For example, suppose this is what we know:

- Tom likes basketball,
- Ben likes basketball and tennis,
- Ken likes baseball and football, and
- Ben likes football.

So, an element of set $X$ is *related* to an element of set $Y$. There may be many more of these pairs. In order to visualize these relations, let's connect each boy with the corresponding ball by a line segment with arrows at the ends:

This visualization helps us discover that Ned doesn't like sports at all...

Such a combination of arrows is called a *relation* between sets $X$ and $Y$. A relation is a two-sided correspondence: neither of the two elements at the ends of the line comes first or second. The same applies to the sets: neither of the two sets comes first or second. In fact, we know this:

- basketball is liked by Tom and Ben,
- tennis is liked by Ben,
- baseball is liked by Ken,
- football is liked by Ken and Sid.

There may be many different relations between any two sets; let's call this one $R$:

Note that an element of neither set must have a corresponding element in the other.

Just as sets are lists, relations are *tables*. Let's make a table for $R$! We put the boys in the first column and the balls in the first row. If the boy likes the sport, we put a mark in the boy's row and the ball's column:

Or, we put the boys in the first row and the balls in the first column. In other words, we flip the table about its *diagonal*. This is the same relation! This is what it looks like when we use a *spreadsheet* instead:

**Exercise.** Based on the relation $R$ presented above, create a new one called, say, $S$ that relates the boys and the sports they *don't* like. Give an arrow and a table representations of $S$.

*Any* combination of marks in such a table creates a relation.

Throughout the early part of this book, we will concentrate on sets that consist of *numbers*. Even though the set of numbers does have a structure (explained later in this chapter), the ideas presented above still apply.

To illustrate these ideas, how about we simply *rename* the boys as numbers, $1-5$? And we rename the balls as numbers too, $1-4$. The table above takes this form (seen on left):

The axes are labelled to avoid confusion between the two, very different, sets. On right, the table is rotated ($90$ degrees counterclockwise) in order to present it in a more traditional way. This table is then called the *graph* of the relation. The two sets can still be interchanged.

**Exercise.** Finish the sentence: “This renaming of the boys (and the balls) is also a ...”.

What about spreadsheets? Once the elements of the sets are renamed as numbers, the graph of the relation can be plotted automatically. It is called a “scatter chart”:

**Example.** It is possible that the two sets in a relation coincide. For example, we can represent *friendship* among the boys as a relation on set $X$:

The nature of the relation isn't just two-sided, it's symmetric: if Tom is a friend of Ben then Ben is also a friend of Tom and vice versa. That is why each arrow in the diagram on the left is represented by *two* marks in the graph of the relation on the right. $\square$

**Exercise** If the five boys decided to have a ping-pong tournament, what relation does it create on $X$?

**Example.** We can also have relations for the sets on the plane. Suppose this set is a square. Then we can say, for example, that two points are related when then are on the opposite sides of the square. If we glue together each pair of such point, we will create a cylinder:

$\square$

## 2 Functions

Let's change the question from “What sports has the boy played today?” to “Which sport does the boy prefer to play?” This is the transition:

In a relation, the two sets involved play equal roles. Instead, we now take the point of view of the boys. We will explore a new relation:

- Tom prefers basketball,
- Ben prefers basketball,
- Ned prefers tennis,
- Ken prefers football,
- Sid prefers football.

We more from our two-ended arrows (or line segments) to regular arrows:

This is a special kind of relation called a *function*; let's call this one $F$. The two sets aren't treated equally anymore! In fact, we say that $F$ is a function *from* set $X$ *to* set $Y$. This is the common **notation**, which uses an arrow:
$$F:X\to Y.$$

Each element of $X$ has only one arrow originating from it. Then, the table of this kind of relation must have exactly one mark in each row:

Our function is a *procedure* that answers the question: which ball does this boy prefer to play with? In fact, it answers *all* these questions! Conversely, a function is nothing but these answers... Each arrow clearly identifies the *input* -- an element of $X$ -- of this procedure by its beginning and the *output* -- an element of $Y$ -- as its ending. Each arrow corresponds to a row of the table (and vice versa) and is written *algebraically*:

Thus, a function is nothing but a *list of inputs and their outputs*! This is the **notation**:
$$F(x)=y,$$
where $x$ belongs to $X$ and $y$ belongs to $Y$. The formula reads: “$F$ of $x$ is $y$”. In other words, we have:
$$F(\text{ input })=\text{ output }.$$
Here is another way to write this list:
$$\begin{array}{lll}
F(\text{ Tom })&=\text{ basketball },\\
F(\text{ Ned })&=\text{ tennis },\\
F(\text{ Ben })&=\text{ basketball },\\
F(\text{ Ken })&=\text{ football },\\
F(\text{ Sid })&=\text{ football }.\\
\end{array}$$
This notation will be by far the most common way of representing functions.

Our function -- in the form of this list or that table -- answers the question: which ball is this boy playing with? However, what if we turn this question around: which boy is playing with this ball? For example, “who is playing with the basketball”? Before answering it, we can give this question a more compact form, the form of an *equation*:
$$F(\text{ boy })=\text{ basketball }.$$
Indeed, we need to find the inputs that, under $F$, produce this output. We answer the question by erasing all irrelevant arrows:

These are a few of possible questions of this kind along with the answers:

- Who is playing with the basketball? Tom and Ben!
- Who is playing with the tennis ball? Ned!
- Who is playing with the baseball? No-one!
- Who is playing with the football? Ken and Sid!

It seems that there are several answers to each of these questions... Or are there? “Tom” and “Ben” aren't *two* answers; it's one: “Tom and Ben”! Indeed, if we provide one name and not the other, we haven't fully answered the question. We can also write the answer as: $\{$ Tom, Ben $\}$. It's a set!

So, the solution to an equation $f(x)=y$ is always a set (a subset of $X$) and its may contain *any* number of elements including none.

Throughout the early part of this book, we will concentrate on functions the inputs and the outputs of which are *numbers*. Even though the set of numbers does have a structure (explained later in this chapter), the ideas presented above still apply.

To illustrate these ideas, how about we simply *rename* the boys as numbers, $1-5$? And we rename the balls as numbers too, $1-4$. The table above takes this form (seen on left):

**Exercise.** Finish the sentence: “This renaming of the boys (and the balls) is also a ...”.

The values of $F$ have also been re-written (center). We also rotate the table counterclockwise because it is traditional to have the inputs along a horizontal line -- left to right -- and the outputs along a vertical line -- bottom to top. Then the table must have exactly one mark in each *column*. Every function can be represented by such a table. This table is then called the *graph* of the function. The arrows are still there:

We can put the data, once again, in a *spreadsheet*:

There is only one cross in every row!

**Example.** Here is an example of how common spreadsheets are discovered to contain relations and functions. Below, we have a list of faculty members in the first column and a list of faculty committees in the first row. A cross mark indicates what this faculty member sits on the corresponding committee while “C” stands for “chair”.

This is a relation between these sets: $X=\{$ faculty $\}$ and $Y=\{$ committees $\}$. In addition, there is a function: $$\{ \text{ committees } \} \to \{ \text{ faculty }\}$$ indicating the chair of the committee. More generally, an employer might maintain a list of employees with each person is identified as a member of one of the groups or project. $\square$

**Exercise.** Think of other functions present in the spreadsheet.

**Exercise.** What functions do you see below?

A common way to visualize the concept of set -- especially when the sets cannot be represented by mere lists -- is to draw a shapeless blob in order to suggest the absence of any internal structure or relation between the elements.

A common way to visualize the concept of function between such sets is to draw arrows.

**Definition.** A *function* is a rule or procedure $F$ that assigns to any element $x$ in a set $X$, called the *input set* or the *domain* of $F$, exactly one element $y$, **denoted** by:
$$y=F(x),$$
in another set $Y$. The latter set is called the *output set* or the *codomain* of $F$.

This definition fails for a relation that has too few or too many arrows for a given $x$. Below, we illustrate how the requirement may be violated, in the domain (left):

These are *not* functions. Meanwhile, we also see what shouldn't be regarded as violations, in the codomain (right).

Both choices for domain and codomain are equally possible.

**Theorem.** Suppose $X$ and $Y$ are sets and $R$ is a relation between $X$ and $Y$. Then (a) relation $R$ represents some function
$$F:X\to Y$$
if and only if for each $x$ in $X$ there is exactly one $y$ in $Y$ such that $x$ and $y$ are related by $R$; and (b) relation $R$ represents some function
$$G:Y\to X$$
if and only if for each $y$ in $Y$ there is exactly one $x$ in $X$ such that $x$ and $y$ are related by $R$.

When our sets are sets of numbers, the relations are often given by *formulas*. In that case, the above issue is resolved with algebra.

**Exercise.** What function can you think of from the set $X$ of the boys to the set of basic colors?

## 3 How numerical functions emerge: optimization

**Problem:** A farmer with $100$ yards of fencing material wants to build as large a rectangular enclosure as possible for his cattle.

We will initially rely entirely on our common sense and some middle school math.

Recalling some geometry, we realize that “the largest enclosure” means the one with the largest *area*. Now what are the best dimensions?

*Trial and Error.* We start to randomly choose possible dimensions of the enclosure and compute their areas:

- $20$ by $20$ gives us the area of $400$ square yards,
- $20$ by $30$ gives us the area of $600$ square yards,
- $20$ by $40$ gives us the area of $800$ square yards...

It's getting better and better! But wait... $30$ by $30$ gives us $900$! We need to collect more data. Let's speed up this process with a spreadsheet.

*Collecting data in a spreadsheet.* We list all possible combinations -- every $10$ yards -- of a width, column $W$, and a depth, column $D$.

Both run through these $11$ values: $$W=0,\ 10,\ 20,\ ...,100 \text{ and } D=0,\ 10,\ 20,\ ...,100.$$ Together, they form a $10\times 10$ square of possible combinations (plotted in the middle). The last column, $A$, contains the area for each choice of dimensions, $W$ and $D$. It is computed as: $$A=W\cdot D.$$

In the plot on far right, we list the $10$ possible values of the width $W$ and then plot above that value the areas of all possible enclosures -- as the depth increases.

We can see that it's getting better and better as we increase the width or depth. But wait... the perimeter of a $20\times 40$ enclosure is $20+20+40+40=120$. Not enough fencing! Also, considering the $20 \times 20$ enclosure seems pointless too as it doesn't use all the fencing material...

We need to *test* whether a given combination of width and depth uses exactly $100$ yards of the fencing material. First, we choose to test each dimension, every $10$ yards, via these two *sets* named after these two quantities:
$$W=\{0,\ 10,\ ...,100\} \quad\text{ and }\quad D=\{0,\ 10,\ ...,100\}.$$
We have then $11\cdot 11=121$ possible combinations. We can now check whether such an enclosure satisfies $P=100$ and then mark that cell if it does. This is pure trial and error:

Then we have a *relation* between two the sets $W$ and $D$. The relation is defined by: two numbers $W$ and $D$ are related when
$$2( W + D )=100.$$
We see its graph above. The largest areas seem to be between $20\times 30 $ and $30 \times 20$, but we need more data.

If we go every single yard, $$W=\{0,\ 1,\ 2,\ ...,100\} \quad\text{ and }\quad D=\{0,\ 1,\ 2,\ ...,100\},$$ the manual data analysis above isn't possible anymore: we have $101\cdot 101=10,201$ possible combinations. What we can test instead of the exact equality $P=100$ is whether it is a good enough approximation, say, within $1$ yard. This is just another relation: two numbers $W$ and $D$ are related when $$99<P<101.$$ We also add another column, $P$, for the perimeter computed as follows: $$P=2( W + D ).$$

Let's examine the plots.

- First, the allowed pairs of dimensions, $W,D$, don't form a square anymore but a strip.
- Second, the plotted areas of these allowed pairs seem to form
*curves*.

The graphs seem to indicate that the best choice of a width is somewhere between $20$ and $30$.

This is a very rough estimate... However, when we try to improve our threshold, from $1$ yard to, say, $1/5$, our plot *disappears*!

There must be a better way... The problem is that selecting the allowable data from the whole table of pairs of $W$ and $D$ is too cumbersome. It would help if we had a direct flow of data from $W$ to $D$ to $A$.

What if we represent the relation between $W$ and $D$ *directly*? In other words, what if we express $D$ in terms of $W$? We need only the middle school algebra. We start with $2( W + D )=100$ and conclude:
$$D=50-W.$$
Such an explicit relation between the two sets -- or rather a dependence of one quantity on the other -- is a *function*. This is its data:
$$\begin{array}{l|lll}
W&D\\
\hline
0&50\\
10&40\\
20&30\\
30&20\\
40&10\\
50&0
\end{array}$$
Only $6$ pairs if we take it $10$ yards at a time. If it's $1$ yard at time, we have $51$, which is still manageable. We put those in a new spreadsheet. The first column is for the width $W$ running through: $0,\ 1,\ 2,\ ...,50$. The second is for the depth $D$, evaluated by $D=50-W$. What's left from a whole square of pairs is just a segment:

The areas are also evaluated as before and plotted for each width.

Looking at our plot, $W=25$ seems to be a clear choice. The corresponding area is $A=25\cdot 25=265$ square yards.

**Exercise.** What if we express $W$ in terms of $D$?

Unfortunately, the plot has *gaps*! What if there is such a width that it gives us the area bigger than $625$?

We can see a new function on this spreadsheet: $A$ depends on $W$ and $D$... but since $D$ depends on $W$, we conclude that $A$ depends on $W$ only! It's also a function. What is this function? Once we realize that $D$ is the same as $50-W$, they become interchangeable. With more middle school algebra, we make this function explicit: $$A=WD=W(50-W) . $$ We can now easily plot $100$ or $100,000$ points at as small increment as we like:

The answer remains the same:
$$W=25,\ A=625.$$
But there are still gaps; how can we be sure? Part I of this book will answer this question but for now we'll just use the fact that the graph of a quadratic function $A=W(50-W)=-W^2+50W$ is a *parabola*. What do we know about this curve?

A parabola has a *vertex*. Because we have “$-$” in the formula for $A$, this one opens *down*; therefore, we see the desired point in the middle. Where is this point? Parabolas are *symmetric*; therefore, this point lies the half-way between the two points on the $x$-axis. In our case, those are $0$ and $50$. Therefore, the vertex of the parabola is at
$$ x = \frac{ 0 + 50 }{ 2 } = 25. $$

Let's review. We named the quantities that appear in the initial problem and then translated its sentences into algebra. The result was the following *optimization problem*:

- Find the values of $W$ and $D$ such that $0\le W\le 50$ and $0\le D\le 50$ so that $A=WD$ is the largest, subject to the relation $W+D=50$.

Then using the function $D=50-W$ derived from the relation to eliminate $D$ from the problem by *substitution*:

- Find the value of $W$ such that $0\le W\le 50$ so that $A=W(50-W)$ is the largest.

**Exercise.** Solve a modified problem with a river adjacent to the enclosure, which will have, consequently, *three* sides.

**Exercise.** Solve a modified problem with a new kind of enclosures required by the problem: semicircles are attached to the rectangles.

We've solved the problem, but our knowledge is much more limited when functions more complicated than quadratic polynomials are involved. Calculus will help...

**Example.** Find two numbers whose difference is $100$ and the product is a minimum.

Step 1. Deconstruct:

- 1. two numbers, whose
- 2. difference is $100$, and
- 3. the product is a minimum.

Translate:

- 1. introduce the “variables”: $x$ is the first number, $y$ is the second number;
- 2. constraint: $x - y = 100;$
- 3. $P$ is their product: $P=xy$, minimize $P$.

This is a math problem now.

Step 2. Eliminate the extra variables to create a function of single variable to be maximized or minimized. The constraint, an equation connecting the variables, is: $$ x - y = 100.$$ Solve the equation for $y$: $$ y = x - 100 ,$$ and eliminate $y$ from $P$ by substitution: $$ P = xy = x(x - 100). $$

Step 3. Optimize this function: $$P(x) = x^{2} - 100x .$$ Its $x$-intercepts are $0$ and $100$, therefore, the vertex of this parabola corresponds to: $$x = 50.$$

Step 4. Provide the answer using the original language of the problem: substitute $x$ into $y$, $$\begin{aligned} y &= x - 100 \\ &= 50 - 100 \\ &= -50. \end{aligned}$$ Answer: the two numbers are $50$ and $-50$. $\square$

## 4 How numerical functions emerge: motion

As the sets we face get bigger and bigger, their visualization (if at all feasible) becomes more and more crucial. We use the tables and the graphs of functions to discover patterns in the data. However, this is only possible when the sets themselves have *structure*. For example, a deck of cards remains the same deck after it's been shuffled but there is also a hierarchical relation within the deck that makes all the difference to the players.

The simplest example of a set with a structure is a set of *locations* on a straight road.

We choose milestones to be such as set. It is their order that makes it impossible to reshuffle them without losing important information. We will use that to our advantage. We visualize the set of milestones as markings on a straight line, according to their *order* ($1<2<3<...$):

The exactly same representation is also used for *time*. Every marking on a line (another line) indicates a moment of time when some repeatable event, such as a bell ring or a clock's hand passing a particular position, occurs.

If $X$ is the set of time moments and $Y$ is the set of locations on the road, we can see a way to study *motion*! Indeed, a function $F:X\to Y$ answers a question:

- at every moment of time, where are we?

It is a function because we can be at two locations at the same time! To make this more precise, we may ask:

- at time $x$, which milestone $y=F(x)$ did we see last?

**Example.** This is the simplest example: suppose we move to the next milestone every minute for $2$ minutes starting at the $0$ location.

Then the *list* of values of $F$ is:
$$\begin{array}{l|l}
\text{ time, }X& \text{ locations, }Y\\
\hline
\text{ first moment }&\text{ first milestone }\\
\text{ second moment }&\text{ second milestone }\\
\text{ third moment }&\text{ third milestone }
\end{array}$$

The *table* of $F$ is:
$$\begin{array}{l|cc}
\text{ time \ location }&\text{ first milestone }&\text{ second milestone }&\text{ third milestone }\\
\hline
\text{ first moment }&\times \\
\text{ second moment }&&\times\\
\text{ third moment }&&&\times
\end{array}$$

This analysis forces us to choose the *domain* and the *codomain* appropriately:
$$X=\{0,1,2\}\quad\text{ and }\quad Y=\{0,1,2\}.$$
Note, however, that $Y$ can be chosen *larger* without harm: $Y=\{0,1,2,3\}$, etc.

Things become much simpler as we imagine that the milestone are *labelled* and so is the time (split into, say, one-minute intervals):
$$\begin{array}{c|c}
\text{ time, }X& \text{ locations, }Y\\
\hline
1&1\\
2&2\\
3&3
\end{array}\quad\text{ and }\quad\begin{array}{l|cc}
\text{ time \ location }&1&2&3\\
\hline
1&\times \\
2&&\times\\
3&&&\times
\end{array}$$

Finally, this is the *graph* of $F$:

$\square$

We can record numerous scenarios of driving on the road. Below are a few examples. In order to accommodate all possible locations, we can choose the codomain to be all integers between $-100$ and $100$: $$Y=\{-100,\ -99,\ ...,\ -1,\ 0,\ 1,\ ...,99,\ 100\}.$$

**Example.** Driving to the right at constant speed, i.e., we progress $2$ miles every minute:

Note, again, that the graph is just the table rotated counterclockwise. It looks like a *straight line*! $\square$

**Example.** But what if we drive slowly, covering only $1/2$ mile every minute? Then we don't see the next milestone until *two* minutes pass and the function doesn't record any progress:

One will notice a pattern if we extend the duration of the trip:

This is, once again, a straight line but with a smaller *slope*! $\square$

**Example.** Driving to the left at constant speed $2$ miles every minute:

$\square$

**Example.** Driving, stopping, and then resuming driving, backwards, at a higher speed:

$\square$

**Example.** The speed is constantly increasing:

$\square$

**Exercise.** Represent a round trip.

**Exercise.** Describe what happened below:

The case of slow motion deserves special attention. The data gives an impression that we stop periodically! So, in order to capture our motion more thoroughly, we simply introduce half-mile marks:

In other words, we keep the set of inputs $X$ of the function $F$ and change the set of outputs $Y$ from $\{0,1,2,3,4,5,...,9\}$ to
$$Y=\{0,.5,1,1.5,2,2.5,3,...,8.5,9\}.$$
The problem is solved... until we choose to drive even slower. Driving $1/4$ mile per minute will require the outputs to be
$$Y=\{0,.25,.5,.75,1,1.25,1.5,...,8.75,9\}.$$
We could continue to divide the intervals in half until it starts to look like a *ruler*:

And what about driving at the speed of $1/3$ mile per minute? In order to resolve this issue once and for all, we simply allow *all numbers* as outputs of $F$ (discussed in the next section). Now we can incorporate any speed:

Since it would require continuously inserting more and more columns, representing the function $F$ as a table is no longer possible.

Furthermore, if we shrink these graphs horizontally, the time axis disappears. With only the location left, we then can imagine that we see a *stroboscopic* snapshot of motion (light it turned on for an instant at equal intervals):

It is called the *path*. We see in the former case that the distance covered during each interval is the same (constant speed) and in the latter case this distance is increasing (accelerated motion).

By choosing appropriate set $Y$ of outputs, we can model “motion” through quantities other than locations: temperature, pressure, population, money, etc.

The functions with the set of inputs in the set of integers are called “sequences”. They represent processes that progress *incrementally*. While this is applicable to the change of such quantities as population or money, the change of temperature or pressure is commonly assumed to be *continuous*! We also think of motion as a continuous progress through the physical space. This is why we apply to time the same refinement process we used for space. Then not only the outputs take their values from among all numbers but also the inputs. This way, we can fully represent the locations that we have passed through as we drive.

But how do we visualize such functions? We still represent them as sequences of pairs of numbers -- and then plot their graphs -- but a clear understanding that some of the inputs are missing.

We insert more inputs as necessary. When there are enough of them, they start to form a curve! Or at least they do when the motion is “continuous” (to be discussed in Chapter 5).

**Exercise.** A car start moving east from town A at a constant speed of $60$ miles an hour. Town B is located $10$ miles south of A. Represent the distance from town B to the car as a function of time.

Note that we haven't used any algebra in our analysis, only the order.

Warning: By using negative numbers to indicate motion in the opposite direction we switch from “speed” to “velocity”.

## 5 The real number line

This is the summary of the analysis of the function that represents the preferences of the boys for different games presented earlier in the chapter:

The two graphs represent the same function! They only look different because we have rearranged the domain, $X$, and the codomain, $Y$. Such a move is no longer possible if we turn to *numerical functions*...

Numbers have an inherent structure, an *order*. For example, the table of the function on the left has no apparent pattern... until we re-arrange the rows according to their *order* of the numbers:

Similarly, a seemingly random list of pairs of numbers, $x$ and $y=F(x)$, produces a straight line when plotted against properly arranged numbers:

The good news is that its graph is an *unambiguous* visualization of a numerical function!

We set functions aside for now and turn to *sets of numbers* and their representations.

Sets get bigger and bigger and may seem to be infinite. Imagine facing a fence so long that you can't see its ends. We *zoom out* multiple times and there is still more left:

Is the size *infinite*? It may be. But for as long as this is *convenient*, we just assume that we can go on for as long as necessary.

We visualize the set as markings on a straight line, according to the order of the planks:

The assumption is that the line and the markings continue without stopping in both directions, which is commonly represented by “...”. The same idea applies to milestones. They are also ordered and might also continue indefinitely.

If we choose to speak of locations spaced over an infinite straight line we associate it with the set of *integers*, **denoted** by:
$${\bf Z}=\{...,-3,-2,-1,0,1,2,3,...\},$$
or its subset, the set of *natural numbers*:
$${\bf N}=\{0,1,2,3,...\} \subset {\bf Z}.$$

Suppose we *zoom in* on a piece of the fence. What if we see a shorter plank between the two?

If we keep zooming in, the result will look similar to a *ruler*:

It's as if we add *one mark* between two and then repeat this process. We'd have to stop eventually as this ruler goes only to $1/16$ of an inch. If we add *nine marks* at a time, the result is a *metric ruler*:

Here, we go from meters to decimeters, to centimeters, to millimeters, etc. Is the depth *infinite*? It may be. But for as long as this is *convenient*, we just assume that we can go on for as long as necessary.

To see it another way, we allow more and more decimals in our numbers: $$\begin{array}{rlllllll} 1/3:&.3&.33&.333&.3333&.33333&...;\\ 1:&1.&1.1&1.01&1.001&1.0001&...;\\ \pi:&3.&3.1&3.14&3.141&3.1415&.... \end{array}$$

In order to visualize *all numbers*, we arrange the integers in a line first. The line of numbers is built in several steps.

Step 1: a line is drawn, called an *axis*, usually horizontal.

Step 2: one of the two directions on the line is chosen as *positive*, usually the one to the right, then the other is *negative*.

Step 3: a point $O$ is chosen as the *origin*.

Step 4: a segment of the line is chosen as the *unit* of length.

Step 5: the segment is used to measure distances to locations from the origin $O$ -- positive in the positive direction and negative in the negative direction -- and add marks to the line, the *coordinates*.

Step 6: the segments are further subdivided to fractions of the unit, etc.

The end result depends on what the building block is. It may contain gaps and look like a ruler (or a comb) as discussed above. It may also be solid and look like a tile or a domino piece:

So, we start with integers as locations and then also include fractions, i.e., *rational numbers*. However, we then realize that some of the locations have no counterparts among these numbers. For example, $\sqrt{2}$ is the length of the diagonal of a $1\times 1$ square (and a solution of the equation $x^2=2$); it's not rational. That's how the *irrational numbers* came into play. Together they form the set of *real numbers*. It is often **denoted** by ${\bf R}$.

We use this set-up to produce a correspondence:

- location $P\ \longleftrightarrow\ $ number $x$.

It works in *both directions*, as follows.

- First, suppose $P$ is a
*location*on the line. We then find the nearest mark on the line. That's the “coordinate”, some*number*$x$, of $P$. - Conversely, suppose $x$ is a
*number*. We think of it as a “coordinate” and find its mark on the line. That's the*location*$P$ on the line.

The result may be described as the “$1$-dimensional coordinate system”. It is also called the *real number line* or simply *the number line*.

We have created a visual model of the set of real numbers. Now every subset $X$ of real numbers can also be made visible on this axis. Depending on the set of real numbers we are trying to visualize, the zero may or may not be in the picture. We also have to choose an appropriate length of the unit segment in order for $X$ to fit in.

In addition to the ruler, another way to visualize sets of numbers is with *colors*. In fact, in digital imaging the levels of gray are associated with the numbers from $0$ and $255$. We use a shorter scale, $\{1,2,...,20\}$ (top):

It is also often convenient to associate blue with negative and red with positive numbers (bottom).

## 6 Set building

All numerical sets we have seen so far are *subsets of the real number line* ${\bf R}$. So, numerical sets emerge as domains and codomains of numerical functions. They may also come from *solving equations*.

For example, consider these:

- We face the equation $x+2=5$. After some work, we find: $x=3$.
- We face the equation $3x=15$. After some work, we find: $x=5$. Is there more?
- We face the equation $x^2-3x+2=0$. After some work, we find: $x=1$. Is that it?
- We face the equation $x^2+1=0$. After all the work, we can't find any $x$. Should we keep trying?

Here, $x$ is a *label* that stands for an unspecified number that is meant to satisfy this condition.

First, how do we find those $x$'s? We seek such numbers that, when they replace $x$ in the equation, we see a true statement. Then, it could simply be trial and error. For the first equation, we have:

- Is $x=1$ a solution? Plug it in the equation: $x+2=5$ becomes $(1)+2=5$. False! This is
*not*a solution. - Is $x=2$ a solution? Plug it in the equation: $x+2=5$ becomes $(2)+2=5$. False! This is
*not*a solution. - Is $x=3$ a solution? Plug it in the equation: $x+2=5$ becomes $(3)+2=5$. True! This
*is*a solution. - Should we stop now? Why would we? For all we know, there may be more solutions...

We never say that we have found “the” solution unless we know for sure that there is only one.

**Exercise.** Interpret each of these equations as a relation.

But what does it mean to solve an equation? We have tried to find $x$ that satisfies the equation... But what are we supposed to have at the end of our work?

Let's consider this function again:

It tells us what game each boy prefers. What about backward? What boys prefer each game?

- What boys prefer basketball? It's not Tom and it's not Ben; it's Tom and Ben.
- What boys prefer tennis? Ned.
- What boys prefer baseball? No-one.
- What boys prefer football? Ken and Sid.

We answer the questions by reversing the arrows.

But each question -- one for each element of the codomain $Y$ -- is also an *equation*:

- Find $x$ with $F(x)=$ basketball. Tom is a solution and Ben is a solution. Combined, Tom and Ben are
*the*solutions. - Find $x$ with $F(x)=$ tennis. Ned is the solution.
- Find $x$ with $F(x)=$ baseball. No solutions.
- Find $x$ with $F(x)=$ football. Ken and Sid are the solutions.

This is how we understand this idea:

*To solve an equation with respect to $x$ is to find each element that, when put in the place of $x$ in the equation, gives us a true statement.*

So, we must present *all* $x$'s that satisfy the equation. In other words, the answer is a *set*! It is called *the solution set of the equation*:

- The solution set of the equation $F(x)=$ basketball is $\{$ Tom, Ben $\}$.
- The solution set of the equation $F(x)=$ tennis is $\{$ Ned $\}$.
- The solution set of the equation $F(x)=$ baseball is empty.
- The solution set of the equation $F(x)=$ football is $\{$ Ken, Sid $\}$.

All of these sets are subsets of the domain $X$.

For each equation, we have found *the* solution!

These sets can also be formed with the so-called **set-building notation**. The set
$$\{x:\ \text{ condition for } x\ \}$$
stands for the set of *all* $x$ that satisfy the condition. What kind of condition? Any condition will do as long as it is specific enough for us to answer the question, does $x$ satisfy it unambiguous. The set from which we pick $x$'s one at a time is assumed to be specified.

For example, the equations above are seen as conditions. Then, below, we list their solution sets, shown on left, that can be simplified, shown on right: $$\begin{array}{lll} \{x:\ F(x)= \text{ basketball } \} & = \{ \text{ Tom, Ben }\}, \\ \{x:\ F(x)= \text{ tennis } \} & = \{ \text{ Ned }\}, \\ \{x:\ F(x)= \text{ baseball } \} & = \{ \quad \}, \\ \{x:\ F(x)= \text{ football } \} & = \{ \text{ Ken, Sid }\}. \\ \end{array}$$ One can imagine that we simply went over the list of $X$ and test each of its elements. The third one is special.

**Definition.** A set with no elements is called *the empty set* and is commonly **denoted** by $\emptyset$.

**Exercise.** Simplify the following sets:
$$\begin{array}{lll}
\{x, \text{ boy }:\ \text{ his shirt is red } \},\\
\{y, \text{ ball }:\ \text{ is preferred by two boys } \},\\
\{y, \text{ ball }:\ \text{ is round } \}.
\end{array}$$

Let's take another look at the equations above assuming that the “ambient” set is the set of real numbers: $$\begin{array}{lll} \text{equation }& \text{answer? }& \text{ solution set }\\ x+2=5 & x=3 & \{3\} \\ 3x=15 & x=5 & \{5\} \\ x^2-3x+2=0 & x=1 \text{ and...}& \{1,2\} \\ x^2+2x+1=0 & \text{ no }x?& \{\quad\} \\ \end{array}$$ This is how we visualize these four sets:

Here we use the set-building notation again on right and then, one left, we see another, simpler, representation of the set: $$\begin{array}{lll} \{x:\ x+2=5 \}&=\{3\}, \\ \{x:\ 3x=15 \}& =\{5\}, \\ \{x:\ x^2-3x+2=0 \} & = \{1,2\}, \\ \{x:\ x^2+1=0 \}& = \{\quad\}=\emptyset. \\ \end{array}$$ The simplest way to represent a set is, of course, a list.

**Exercise.** Solve these equations:
$$x=x,\quad 1=1,\quad 1=0.$$

The condition in the set-building notation can also be an *inequality* or two:

These are also subsets of the real number line. In contrast to a ruler, as we zoom in on the real line, we see just as many numbers as before. This is the reason why there is no such thing as the list of all real numbers, even an infinite one! Since we can't test them one by one, *visualization* becomes especially important.

When inequalities are involved, the (universal) set-building notation is used along with a more compact **interval notation**.

We start with sets of real numbers contained between two numbers. For any two real numbers $a<b$, we have: $$\begin{array}{ll} \{x:&a\le x\le b&\}&=&[a,b],\\ \{x:&a\le x< b&\}&=&[a,b),\\ \{x:&a< x\le b&\}&=&(a,b],\\ \{x:&a< x< b&\}&=&(a,b). \end{array}$$

Second, one of the ends may be infinite: $$\begin{array}{ll} \{x:&a \le x < \infty &\}&=&[a,+\infty),\\ \{x:&a < x < \infty&\} &=&(a,+\infty),\\ \{x:&-\infty < x\le b&\} &=&(-\infty,b],\\ \{x:&-\infty < x< b&\} &=&(-\infty,b). \end{array}$$ Since $x$ is assumed to be a real number, inequalities that involve infinities, such as $-\infty < x$, are redundant. The whole set of real numbers can also be seen in a similar light: $$\begin{array}{ll} \{x:&-\infty < x< +\infty&\} &=&(-\infty,+\infty)&={\bf R}.\\ \end{array}$$

**Definition.** These nine types of subsets of the real line are called *intervals*.

If, on the other hand, we limit ourselves to the integers here, the same inequalities won't produce intervals but *lists*, some of them infinite, for example:
$$\begin{array}{ll}
\{x,\text{ integer}:&1\le x\le 4&\}&=&\{1,2,3,4\},&\quad&\{x,\text{ integer}:&1 \le x &\}&=&\{1,2,3,4,...\},\\
\{x,\text{ integer}:&1\le x< 4&\}&=&\{1,2,3\},&\quad&\{x,\text{ integer}:&1 < x &\} &=&\{2,3,4,...\},\\
\{x,\text{ integer}:&1< x\le 4&\}&=&\{2,3,4\},&\quad&\{x,\text{ integer}:& x\le 4&\} &=&\{...,1,2,3,4\},\\
\{x,\text{ integer}:&1< x< 4&\}&=&\{2,3\},&\quad&\{x,\text{ integer}:& x< 4&\} &=&\{...,1,2,3\}.\\
\end{array}$$
As you can see, an extra condition can be inserted before “:” in the set-building notation. For example,
$$\{x>0:\ \text{ is an integer }\}=\{1,2,3,...\}.$$

So, the bracket “[”, or “]”, is used in the interval notation when the number adjacent to it is included in the set and the parenthesis “(”, or “)”, is used when the number is excluded from the set. Infinity is always excluded because...

Warning: infinity is not a number. The issue is discussed in Chapter 4.

Once can *perceive* infinity as, for example, a “point” where a long fence disappears or where two railroad tracks meet on the horizon:

For visualization, we use little circle to indicate missing points at the ends of intervals:

As we saw in the last section, optimization problems require finding the largest output of a function. But these outputs form a set! Then, on a simpler level, we just need to understand the largest and smallest elements of sets.

**Definition.** Suppose $X$ is a set of real numbers. Then the *minimum* of $X$ is such a number $a$ in $X$ that
$$a\le x\text{ for all } x \text{ in } X.$$
The *maximum* of $X$ is such a number $b$ in $X$ that
$$x\ge b\text{ for all } x \text{ in } X.$$
They are **denoted** by $\min X$ and $\max X$ respectively.

Here's a simple example: $$\min [a,b]=a,\quad \max [a,b]=b.$$

In fact, the two end points of these two intervals are the max and min of the set.

**Exercise.** Explain the grammar in the definition, why “the”?

What about these: $$\min (a,b)=?,\quad \max (a,b)=?$$ These aren't $a$ and $b$ because they don't belong to the set anymore. There is no maximum of minimum!

But the simplest case is a list of numbers arranged in increasing order; then the task is easy: $$\min \{-1,3,7,12,16\}=-1,\quad \max \{-1,3,7,12,16\}=16.$$ However, if the list grows unbounded, such as: $$X=\{1,2,3,4,5,...\},$$ there is no maximum! We can't say that the maximum is the infinity because...

Warning: infinity is not a number.

There is no maximum of minimum! And the whole set of real numbers ${\bf R}$ also has no maximum or minimum. In these three examples, the candidate for maximum doesn't belong to the set! Then, the question *what is the largest value?* may have to wait until we answer *is there the largest value?* This is how we approach this issue: if $2$ is not the maximum of $X=(1,2)$ then what is it?

**Definition.** Suppose $X$ is a set of real numbers. Then a number $A$ (it doesn't have to belong to $X$) is called an *lower bound* of $X$ if
$$A\le x\text{ for all } x \text{ in } X.$$
A number $B$ (it doesn't have to belong to $X$) is called an *upper bound* of $X$ if
$$B\ge x\text{ for all } x \text{ in } X.$$
A set that possesses both lower and upper bounds is called *bounded*, otherwise *unbounded*.

Then these are bounded: $$\{-1,3,7,12,16\},\ [a,b],\ (a,b),$$ and these are unbounded: $${\bf R},\ {\bf Z},\ \{1,2,3,4,5,...\}.$$

**Exercise.** Show that if $X$ is bounded, it is a subset of an interval $[A,B]$, where $A$ and $B$ are any of its lower and upper bounds respectively.

**Exercise.** What are the max, min, and bounds of the empty set? What about ${\bf R}$?

## 7 The $xy$-plane: where graphs live...

A relation or a function deals with two sets of numbers: the domain $X$ and the codomain $Y$. That's why we need two axes. How do we arrange them? We can use the method presented above: putting $X$ and $Y$ side-by-side and connecting them by arrows:

If $X$ is infinite, however, we would need infinitely many arrows. Is there a better way? We already know another approach: a *table*. Instead of side-by-side, we place $X$ horizontally and $Y$ vertically.

We start with a *real line* ${\bf R}$, or the $x$-axis, again. That's where the real numbers live and now $X$ and $Y$ are subsets of ${\bf R}$. So, we will need two of *copies* of the real line. We call them:

- the $x$-
*axis*and - the $y$-
*axis*.

Just as the inputs and outputs of a function have typically nothing to do with each other (such as time vs. space, or space vs. temperature), the two axes may have different unit segments:

That's step 1.

Next, we make a step toward the table we need and arrange the two coordinate axes as follows:

- the $x$-axis is usually horizontal, with the positive direction pointing right, and
- the $y$-axis is usually vertical, with the positive direction pointing up.

Usually, the two axes are put together so that their origins merge. That's step 2.

Finally, we use the marks on the axes to draw a (rectangular) grid.

That's step 3 and we have what we call the *Cartesian plane* or simply the $xy$-plane. It is made from a combination of two copies of ${\bf R}$ and is often **denoted** by ${\bf R}^2$.

It is sometimes acceptable to have the origins of the two axes misaligned:

The idea that the real line is like a ruler leads to the idea that the $xy$-plane is like *ruled paper*:

It is frequently the case that the relative dimensions of $x$ and $y$ are unimportant; then the plane can be resized arbitrarily as this spreadsheet:

**Example.** Below, we point out on the plane the locations of the graphs of any three functions with these domains and codomains:
$$F:[1,4]\to [-1,2],\quad G:{\bf Z}\to {\bf R},\quad H:\{0,1,2\}\to {\bf Z}.$$

$\square$

The idea of the *Cartesian coordinate system* is similar to the one for the real line but this time there are two coordinates. We use the above set-up to produce a correspondence:

- location $P\ \longleftrightarrow\ $ a pair of numbers $(x,y)$.

that works in *both directions*.

For example, suppose $P$ is a *location* on the plane. We then draw a vertical line through $P$ until it intersects the $x$-axis. The mark, $x$, of the location where they cross is the $x$-*coordinate* of $P$. We next draw a horizontal line through $P$ until it intersects the $y$-axis. The mark, $y$, of the location where they cross is the $y$-*coordinate* of $P$. Conversely, suppose $x$ and $y$ are *numbers*. First, we find the mark $x$ on the $x$-axis and draw a vertical line through this point. Second, we find the mark $y$ on the $y$-axis and draw a horizontal line through this point. The intersection of these two lines is a *location* $P$ on the plane.

The **notation** is as follows:
$$\big(\quad x-\text{coordinate}\quad, \quad y-\text{coordinate}\quad\big).$$
Thus, every point on the $xy$-plane is, or can be, labelled with a pair of numbers:

Warning: the notation $(a,b)$ is, unfortunately, the same for a point on the $xy$-plane with coordinates $a$ and $b$ and for an interval from $a$ to $b$ with the end-points excluded.

It is important to realize that what we are dealing with is a *set* too! It is a set of pairs of real numbers:
$${\bf R}^2=\{(x,y):\ x\text{ real}, y\text{ real }\}.$$
The $xy$-plane is just a visualization of this set.

One can think of the $xy$-plane as a *stack of lines*, vertical or horizontal, each of which is just a copy of one of the axes:

We can use this idea to reveal the internal structure of the coordinate plane.

**Theorem.**

- (a) If $L$ is a line parallel to the $x$-axis, then all points on $L$ have the same $y$-coordinate. Conversely, if a set $L$ of points on the $xy$-plane consists of all points with the same $y$-coordinate, $L$ is a line parallel to the $x$-axis.
- (b) If $L$ is a line parallel to the $y$-axis, then all points on $L$ have the same $x$-coordinate. Conversely, if a set $L$ of points on the $xy$-plane consists of all points with the same $x$-coordinate, $L$ is a line parallel to the $y$-axis.

Then, we have a compact way to represent these lines:

- horizontal: $y=k$, and
- vertical: $x=k$,

for some real $k$.

## 8 Relations and curves

We have examples of relations the graphs of which are lines:

- the relation $y=c$ produces a horizontal line because point $(x,y)$ as long as $y=c$ and there is no restriction on $x$;
- the relation $x=a$ produces a vertical line because point $(x,y)$ as long as $x=a$ and there is no restriction on $y$.

There are more relations represented by *straight lines*. Recall how, in the case of the farmer, his enclosure has width $x$ and height $y$ and there are related -- because of the amount of material for the fence available -- by an equation:
$$x+y=50.$$
We discovered the pattern in the table of the relation by coloring some of the cells in the array (left):

We furthermore color a very large array of cells (middle): the color of the $(x,y)$ cell depends on the value of $x+y$. It is as if we plot multiple relations $x+y=k$ for various values of $k$. The linear pattern along the diagonal is clear. The value of $k$ is also shown as the height of a surface above the plane (right).

But first, a (numerical) relation processes a pair of numbers $(x,y)$ as the input and produces an output, which is: related or not related, Yes or No. Then the graph of the relation starts with the same pair $(x,y)$ and then produces: a point or no point; for example: $$ \newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} % \begin{array}{lllll} & & & & &\text{output:} \\ & & & & &\text{plot point } (x,y) \\ \text{input:} & & \text{relation:} & & \nearrow_\text{Yes}& \\ (x,y) & \mapsto & \begin{array}{|c|}\hline\quad x+y=2? \quad \\ \hline\end{array} & \\ & & & & \searrow^\text{No}& \\ & & & & &\text{don't plot anything} \\ \end{array}$$ We can do it by hand, one at a time (left):

On right we show our conjecture about the graph of the relation; it looks like a straight line!

Note that the equation $2x+2y=4$ represents the same relation!

Warning: Just because both sets are numbers (for example, $X={\bf R}$ and $Y={\bf R}$), we shouldn't think of the relation as one of a set with *itself*.

**Definition.** Suppose $R$ is a relation between two sets $X$ and $Y$ of real numbers. Then the *graph* of $R$ is the set of all points on the $xy$-plane such that $x$ and $y$ are related by $R$.

This relation is, typically, an equation, which is to be satisfied by every point $(x,y)$ on the graph of the relation.

**Theorem.** The graph of any *linear* relation, i.e.,
$$Ax+By=C,$$
with either $A$ or $B$ not equal to zero, is a straight line.

It is called an *implicit equation of the line*. When we represent the line by a function (below), the equation becomes *explicit*.

**Theorem.** A linear relation,
$$Ax+By=C,$$
with either $A$ or $B$ not equal to zero, represents a *linear polynomial*, i.e., a function (a) from $X$ to $Y$ when $B\ne 0$:
$$y=F(x)=-\frac{A}{B}x+\frac{C}{B};$$
and (a) from $X$ to $Y$ when $A\ne 0$:
$$x=F(y)=-\frac{B}{A}y+\frac{C}{A}.$$

**Example.** Let's consider a more complicated relation:
$$
\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!}
\newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.}
%
\begin{array}{lllll}
& & & & &\text{output:} \\
& & & & &\text{plot point } (x,y) \\
\text{input:} & & \text{relation:} & & \nearrow_\text{Yes}& \\
(x,y) & \mapsto & \begin{array}{|c|}\hline\quad x^2+y^2=1? \quad \\ \hline\end{array} & \\
& & & & \searrow^\text{No}& \\
& & & & &\text{don't plot anything } \\
\end{array}$$
We test each of these pairs of $(x,y)$ with help of a spreadsheet:

The formula for the $x$-coordinate is: $$\texttt{ =IF(ABS(RC[-1])<R6C5,RC[-3],0)}.$$ The result looks like a circle. $\square$

We have come to a crucial realization: *graphs are sets* too; they are subsets of ${\bf R}^2$. In fact, we can still use the *set-building notation*:
$$\{(x,y): \ \text{condition on } x,\ y\}.$$
This condition, just as before, is often an equation. For example, the circle is:
$$\{(x,y): \ x^2+y^2=1\}.$$

**Example.** What happens if we vary the value of $k$ in the relation $x^2+y^2=k$? To begin with, we color the cells of a large array by the value of this expression:

The points that are too close to the origin are in blue and those too far are in red. The circular pattern is also clear. So, the radius of the circle varies with $k$:

We will show later that the *circle* of radius $r>0$ centered at $O$, which is the set of points $k$ units away from $O$, is given by the relation, $x^2+y^2=r^2$. $\square$

**Example.** We color the cells of an array according to the values of $xy=k$:

This is what the graphs of these the relations look like plotted for various $k$'s; they are curves called *hyperbolas*:

$\square$

**Example.** We color the cells of an array according to the values of $y-x^2=k$ plotted for various $k$'s

This is what the graphs of these the relations look like plotted for various $k$'s; they are curves called *parabolas*:

$\square$

But why are these graphs *curves*? We answer by finding *functions* in these relations.

**Example.** Is the graph of the relation $x^2+y^2=1$ a curve? We can't tell from the plotting we did above. Is there a function that represents this relation? Let's solve for $y$. Then,
$$y=\pm\sqrt{1-x^2}.$$
This is *not* a function; indeed, input $x=0$ produces *two* outputs, $y=1$ and $y=-1$! This is just a new relation; we substitute the original,

- $x$ and $y$ are related when $x^2+y^2=1$,

with the following:

- $x$ and $y$ are related when $y=\sqrt{1-x^2}$ or $y=\sqrt{1-x^2}$.

A closer examination reveals that we have *two* functions! And we can plot them separately:

The complete curve is a circle:

Since there can be only one point of the graph of a function above each $x$, the graph of either of the two functions is *one-point thick*! It may be a curve... $\square$

Even with a computer, verifying that every point on the whole $(x,y)$-plane satisfies a given relation is like looking for a needle in a haystack. In contrast, functions produce “allowed” pairs $(x,y)$ automatically, without needing to test each of them. Simply plug in a value, $x$, and the function will give you its mate, $y$.

Remember, all functions are relations but not all relations are functions:

This means that what we have said about relations will apply to functions, but we will be able to say more...

## 9 A function as a black box

Functions are *explicit relations*. Indeed, the two variables are still related to each other, but this relation is now unequal: the output is *dependent* this is a function. That is why we say that the input is the *independent variable* while the output is the *dependent variable*.

A function is a *black box*: something comes in and something comes out as a result. Like this:
$$\begin{array}{ccccccccccccccc}
\text{input} & \mapsto & \begin{array}{|c|}\hline\blacksquare\blacksquare\blacksquare \\ \hline\end{array} & \mapsto & \text{output}
\end{array}.$$
The only rule is that the same input produces the same output. For example, a vending machine will provide you with the item the code of which you have entered (if sufficient funds are inserted).

In the case of numerical functions, both are numbers. The black box metaphor suggests that while some computation happens inside the box, what it is exactly may be unknown: $$\begin{array}{ccccccccccccccc} \text{input} & & \text{function} & & \text{output} \\ \text{income} & \mapsto & \begin{array}{|c|}\hline\quad \text{IRS} \quad \\ \hline\end{array} & \mapsto & \text{tax bill} \end{array}$$ How things happen might be even unimportant; what's important is the rule a function has to follow: one $y$ for each $x$. For example, if you don't know how this function is computed, you can ask someone to do it for you: $$\begin{array}{ccccccccccccccc} \text{input} & & \text{function} & & \text{output} \\ x & \mapsto & \begin{array}{|c|}\hline\quad \cos \quad \\ \hline\end{array} & \mapsto & y \text{} \end{array}$$

If we are able to peek inside, we might see something very complex or something very simple: $$\begin{array}{ccccccccccccccc} \text{input} & \mapsto & \begin{array}{|c|}\hline\text{ multiply by }3 \\ \hline\end{array} & \mapsto & \text{output } \end{array}.$$

A function is what a function does! It may be simply a *sequence of instructions*

**Example.** For example, for a given input $x$, we do the following consecutively:

- add $3$,
- multiply by $2$,
- square.

Such a procedure can be conveniently visualized as a “flowchart”:

For example, if the input is $x=1$ then we acquire three more numbers in this order:
$$1\ \to\ 1+3=4\ \to\ 4\cdot 2=8 \ \to\ 8^2=64.$$
It can also be called an *algorithmic representation*.

Here is the algebra of what is going on inside of each of the boxes: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} % \begin{array}{ccccccccccccccc} x & \mapsto & \begin{array}{|c|}\hline\quad x+3 \quad \\ \hline\end{array} & \mapsto & y & \mapsto & \begin{array}{|c|}\hline\quad y\cdot 2 \quad \\ \hline\end{array} & \mapsto & z & \mapsto & \begin{array}{|c|}\hline\quad z^2 \quad \\ \hline\end{array} & \mapsto & u \end{array}$$ Note how the names of the variables match, so that we can proceed to the next step. A sequence of algebraic steps of this process is as follows: $$\begin{array}{lll} x&\to&x+3&=&y\\ &&&\to&y\cdot 2&=&z\\ &&&&&\to&z^2&=&u. \end{array}$$ $\square$

Warning: such a sequence of commands might have to split in order to represent more complex functions.

Thus, we represent a function diagrammatically as a box that processes the input and produces the output:
$$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!}
\newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.}
%
\begin{array}{ccccccccccccccc}
\text{input} & & \text{function} & & \text{output} \\
x & \mapsto & \begin{array}{|c|}\hline\quad f \quad \\ \hline\end{array} & \mapsto & y
\end{array}$$
Here, $f$ is *the name of the function* (in fact, “$f$” stands for “function”). In this example, we use a letter to indicate an *abstract* function while in the examples below functions may be *specific* with specific names, such as:

- $\sqrt{(\quad)}$ for the square root,
- $\exp (\quad )$ or $e^{(\quad)}$ for the exponential function,
- $\sin (\quad ) $ for the sine, etc.

Numerical functions come from many sources and can be expressed in different forms:

- a list of instructions (an algorithm),
- an algebraic formula,
- a list of pairs of inputs and outputs,
- a graph,
- a transformation.

We will be transitioning from one to the next as needed with the exception of the last item which is postponed until the next chapter.

An algorithm is commonly a list of instructions given to a computer, i.e., a *program*. A function to be examined or manipulated by a person is better to be given in the form of a *formula*.

An *algebraic representation* is exemplified by $y = x^2$. In order to properly introduce this as a function, we give it a name, say $f$, and write:
$$f(x)=x^2.$$
Let's examine this **notation**. The letters used in the left-hand side are all *names*!
$$\begin{array}{r|ccccccc}
&y&=&f&( &x&)&=&x^2\\
&\uparrow&&\uparrow&&\uparrow&&&\uparrow\\
\text{name: }&\text{dependent }&&\text{function }&&\text{independent }&&&\text{independent}\\
&\text{variable }&&\text{ }&&\text{variable }&&&\text{variable}
\end{array}$$
The names are mostly arbitrary. They have to vary when there is more than just one function involved, for example:
$$\begin{array}{r|ccccccc}
&z&=&g&( &t&)&=&t+5\\
&\uparrow&&\uparrow&&\uparrow&&&\uparrow\\
\text{name: }&\text{dependent }&&\text{function }&&\text{independent }&&&\text{independent}\\
&\text{variable }&&\text{ }&&\text{variable }&&&\text{variable}
\end{array}$$

Warning: it is often acceptable (or even preferable) to omit the name of the function and concentrate on the variables, as we did in the above example.

Thus, the independent variable is the input and the dependent variable is the output. When the independent variable is specified, so is the dependent variable, via the *substitution*:
$$\begin{array}{ccccccc}
f&( &3&)&=&3^2\\
\uparrow&&\uparrow&&&\uparrow\\
\text{function }&&\text{input }&&&\text{output }
\end{array}$$
We can think of this notation as a “black funnel”:

Here $x$ enters through the funnel and then -- after processing -- $y$ appears from the other end. We can also replace $x$ in the formula with a blank box as an entry gate: $$\begin{array}{ccccccc} f&( &\square &)&=&\square ^2\\ &&\uparrow&&&\uparrow\\ &&\text{ insert input }&&&\text{insert input} \end{array}$$

**Example.** For a more complex function, there may be several boxes, but the idea remains the same: insert the input value in all of these boxes. For example, this function:
$$f\left(x \right)=\frac{2x^2-3x+7}{x^3+2x+1},$$
can be understood and evaluated via this diagram:
$$f\left( \square \right)=\frac{2\square^2-3\square+7}{\square^3+2\square+1}.$$
For example, we just insert $3$ at each of these windows:
$$f\left( \begin{array}{|c|}\hline\ 3 \ \\ \hline\end{array} \right)=\frac{2\begin{array}{|c|}\hline\ 3 \ \\ \hline\end{array}^2-3\begin{array}{|c|}\hline\ 3 \ \\ \hline\end{array}+7}{\begin{array}{|c|}\hline\ 3 \ \\ \hline\end{array}^3+2\begin{array}{|c|}\hline\ 3 \ \\ \hline\end{array}+1}.$$
It is as if the opening of the funnel is split and the value of $x$ is copied to several tubes that feed this value to these locations within the formula. $\square$

Warning: when substituting, use parentheses generously!

**Example.** If you substitute mindlessly expressions that are more complex, errors are inevitable. For example, consider the same function as above but evaluate it at $x=-2$. “Plugging in” might produce this gibberish:
$$f\left(-2 \right)=\frac{2-2^2-3-2+7}{-2^3+2-2+1}.$$
One may consider a slightly different diagram:
$$f \begin{array}{|c|}\hline\ (x) \ \\ \hline\end{array} =\frac{2\begin{array}{|c|}\hline\ (x) \ \\ \hline\end{array}^2-3\begin{array}{|c|}\hline\ (x) \ \\ \hline\end{array}+7}{\begin{array}{|c|}\hline\ (x) \ \\ \hline\end{array}^3+2\begin{array}{|c|}\hline\ (x) \ \\ \hline\end{array}+1}.$$
In other words, we don't substitute $x$ but $(x)$, just as the function notation suggests. Then, we have
$$f\left(-2 \right)=\frac{2(-2)^2-3(-2)+7}{(-2)^3+2(-2)+1}.$$
$\square$

**Exercise.** Evaluate $f(z^2)$ for the function given above.

**Example.** We can also take the function from the beginning of the section; it requires several stages:
$$y=x+3,\quad z=y\cdot 2,\quad u=z^2,$$
can be written as:
$$\square\ \to\ \square+3\ \to\ \square\cdot 2\ \to\ \square^2\ \to\quad . $$
We compute it for input $x=2$ consecutively:
$$2\to 2+3=5\to 5\cdot 2=10 \to 10^2\to 100. $$
$\square$

**Example.** Consider this formula:
$$f(x)=\sqrt{x^2-3}+5.$$
To represent this function as a list of instructions, we just read the formula starting with $x$:
$$\begin{array}{ccccccccccccccc}
\text{input} & \mapsto & \begin{array}{|c|}\hline\text{ square } \\ \hline\end{array} & \mapsto & \begin{array}{|c|}\hline\text{ subtract }3 \\ \hline\end{array} & \mapsto & \begin{array}{|c|}\hline\text{ take square root}\\ \hline\end{array} \mapsto & \begin{array}{|c|}\hline\text{ add }5 \\ \hline\end{array} & \mapsto & \text{output }
\end{array}.$$
$\square$

**Exercise.** Represent this function as a list of instructions:
$$f(x)=\big( \sqrt{x}+2\big)^3.$$

Conversely, a diagram can be converted to a single formula.

**Example.** Let's take one from the example above and *substitute* along the arrows:
$$\begin{array}{lll}
x&\to&x+3&=&y\\
&&&&\downarrow\\
&&&&y\cdot 2&=&z\\
&&&&&&\downarrow\\
&&&&&&z^2&=&u,
\end{array}\quad\begin{array}{lll}
x&\to&&&\\
&&&&\\
&&&&(x+3)\cdot 2&=&z\\
&&&&&&\downarrow\\
&&&&&&z^2&=&u,
\end{array}\quad\begin{array}{lll}
x&\to&&&\\
&&&&\\
&&&&\\
&&&&&&\\
&&&&&\to&\big((x+3)\cdot 2\big)^2&=&u.
\end{array}$$
In other words, our function is given by:
$$u=f(x)=\big((x+3)\cdot 2\big)^2.$$
Note that to recover the operations from the formula, we just read it *from inside out*:
$$\begin{array}{ccc}
x\\
x+3\\
(x+3)\\
(x+3)\cdot 2\\
\big((x+3)\cdot 2\big)\\
\big((x+3)\cdot 2\big)^2
\end{array}$$
$\square$

**Exercise.** Find a formula for the following function:
$$\begin{array}{ccccccccccccccc}
\text{input} & \mapsto & \begin{array}{|c|}\hline\text{ divide by }2 \\ \hline\end{array} & \mapsto & \begin{array}{|c|}\hline\text{ take its reciprocal } \\ \hline\end{array} & \mapsto & \begin{array}{|c|}\hline\text{ subtract } 1\\ \hline\end{array} \mapsto & \text{output }
\end{array}.$$

A function can also be represented by a *list of pairs of inputs and outputs*. This list is a table with two columns, for $x$ and $y$:
$$\begin{array}{l|ll}
x&y=f(x)\\
\hline
0&1\\
1&3\\
2&4\\
3&0\\
4&2\\
...&...
\end{array}$$
This is a *numerical representation* as the list contains only numbers. Any list like this would do as long as there are no repetitions in the $x$-column!

To create larger lists, one uses a spreadsheet.

Then each value in the $y$-column is computed from the corresponding value in the $x$-column via some formula. For example, for $y=x^2$, we write in the $y$-column the following:
$$\texttt{ =RC[-1]^2 } .$$
However, it is possible that a function is pure *data* and there is no formula! Indeed, these may be made-up numbers such as the ones in the table above. One can also imagine that the table has come from a measuring device (say, a thermometer) that takes readings at equal intervals of time.

Even though the data in the list represents the same function as above, as we can see, there are gaps in the data. We can't tell, for example, what $1.5^2$ is or what $100^2$ is. Thus, our algebraic representation is complete, but the numerical representation given by the list is not. However, this list does represent *a* function, with smaller domain than the original.

The advantage of numerical representation is that it has been calculated for you so that you can see patterns; for example,

- if $x$ is increasing, then $y$ is increasing;
- if $x$ grows faster, $y$ also grows faster, etc.

We can use the list data to plot points, which leads us to the *graphical representation*. We just repeat the definition we had for relations:

- the
*graph*of a numerical function $y=f(x)$ is the set of points in the $xy$-plane that satisfy $y=f(x)$.

In other words, it is the following set: $$\{(x,y):\ y=f(x)\}.$$

For example, we can plot the above data; just the points that have been provided:

We speak of *a graph* when the set we face is *the graph* of some function. This means that there are no two points on the same vertical line.

Meanwhile, spreadsheet software comes with graphic capabilities. It will plot all points you have in the list:

It can also automatically add a curve connecting these points.

Note that when $x$ and $y$ represent two variables that have nothing to do with each other -- such as time and location -- neither do the two axes. In that case, neither the unit lengths nor the locations of the origins have to match:

A *transformation* takes the domain $X$, a subset of the real line, transforms it -- shift, stretch, flip, etc. -- and places the result on the codomain $Y$. It is discussed in the next chapter.

An *algorithm* is a verbal representation of a function. It may contain no explicit algebra. Instead, it tells us how to get a certain output given any input.

For example,

- Question: How do we get from $x$ to $y$?
- Answer: Let $y$ be equal to the square of $x$.

This representation also gives us compete information about the function.

**Example.** Describe what this function does:
$$f(x)=\dfrac{x^{2} + 1}{x^{2} -1},$$
verbally:

- Step 1: multiply $x$ by itself, call it $y$;
- Step 2: add 1 to $y$, call it $z$;
- Step 3: subtract 1 from $y$, call it $u$;
- Step 4: divide $z$ by $u$.

$\square$

A (numerical) *function* is a rule or procedure $f$ that assigns to any number $x$ in a set $X$, called the *set of inputs* or the *domain*, one number $y$ in another set of real numbers $Y$, called the *set of outputs* or the *codomain* of $f$.

In other words,

- 1. each $x$ in $X$ has a counterpart in $Y$, and
- 2. there is only one such counterpart.

This rule can be violated when there are too few or too many arrows for a given $x$:

Then this is *not a function*. It is OK, however, to have too few or too many arrows for a given $y $!

Next, let's revisit the rule -- how to get $y$ from $x$ -- that defines a function. It must satisfy:

*there is only one $y$ for each $x$*.

Let's illustrate how the rule might visibly fail for each of these four representations of $f$.

$\bullet$ Algebraic: $$y=\pm x.$$

$\bullet$ Numerical: $$\begin{array}{rlr|lll} &&x&y\\ \hline &&...&...\\ &&0&22\\ &\nearrow&...&...&\nwarrow\\ \text{same!}&&...&...&&\text{different!}\\ &\searrow&...&...&\swarrow\\ &&0&55\\ &&...&... \end{array}$$

$\bullet$ Algorithmic:

- Step 1: ...
- ...
- Step 50: add today's date to the output of step 49.
- ...
- Step 100: ...

$\bullet$ Graphical:

For the graphical representation, all it takes is a glance.

**Theorem (Vertical Line Test).** A relation is a function if and only if every vertical line crosses the graph at one point or none.

**Example.** $\square$

## 10 Give the function a domain...

A function is not a function without a specified domain!

Recall that a function $F:X\to Y$ is *defined* as a correspondence between two sets, its domain $X$ and its codomain $Y$. What if $F$ is specified but $X$ and $Y$ are not?

**Example.** The choices may be obvious when the function is visualized:

As you can see Ken has no preferred ball and, therefore, cannot be a part of the domain $X$. Baseball isn't chosen by anyone and can, but doesn't have to, be excluded from the codomain $Y$. $\square$

**Example.** Choosing a domain is often a matter of *convenience*. For example, recall the problem from the beginning of the chapter about a farmer with $100$ yards of fencing material who wants to build as large a rectangular enclosure as possible for his cattle.

The area of the enclosure was expressed in terms of its width by the formula:
$$A=W(50-W).$$
But we also made the implicit choice of the domain:
$$X=[0,50].$$
Even though the formula makes sense for *any* value of $W$, we chose to concentrate on those that can be legitimate solutions to the problem at hand.

In the absence of such a test, we seek another approach. $\square$

When we concentrate on *numerical functions*, it is easy to make a mistake of dismissing the issue by saying that both $X$ and $Y$ are “just numbers”. We can sometimes get away with that when this is about $Y$ because $y=f(x)$ is allowed to miss any number of values in the codomain (no arrows arriving to a particular $y$). However, giving the function as an input a number that it can't handle is unacceptable: don't plug in $x=0$ into $f(x)=1/x$!

If we have nothing but a formula, the other two attributes are missing, and we need to make some decisions. First, the codomain. What is the advantage of one codomain over another? The size. A smaller codomain is a constraint on what we can do with the function and we, therefore, choose the “largest possible codomain”. Of course, this is the set of all real numbers. So, unless specified otherwise, every numerical function is: $$f:X\to {\bf R}.$$ Now, the domain.

Suppose our function is a list of instructions (an algorithm) and it is used to create a computer program. In this case, $x$, the input, passes through a black box and out comes $y $. But we must be careful. If our algorithm requires the computer to divide by $x$ and we give it $x=0$ as an input, it might do exactly that and there will be *trouble*:

So, if we have a function and the domain isn't specified, it's an oversight. Specify it!

We then need to choose a set of allowable inputs for the function that we already have. Algebraically, we plug various $x$'s into the formula and see if it works.

**Example.** Let
$$ f(x) = \frac{1}{x} .$$
It works for all positive and all negative numbers... but let's try $x = 0$. The function fails because $\frac{1}{0}$ is undefined. Since $\dfrac{1}{x}$ is defined for all $x \neq 0$, we can choose the domain to be *all* these numbers:
$$X=\{x:\ x\ne 0\},$$
or
$$X=\{x:\ x<0 \texttt{ OR } x>0\}.$$
So, it contains both intervals
$$( - \infty, 0 ) \text{ and } ( 0, +\infty). $$
What if we take just one of them,
$$X = (0, \infty )?$$
It is also a valid choice. Any set that excludes $0$ will do:
$$\{...,-2,-1,1,2,...\},\ [1,2],\ (-1,0),\ ...$$
So, whatever the choice of $X$ is we have a function $f:X\to {\bf R}$. $\square$

**Example.** If the function is given by a list of inputs and corresponding outputs, the domain can be simply the set of all entries in the first column.

Here we have a function, $f:\{0,1,2,3,4,5\}\to {\bf R}$. $\square$

**Example.** If the function is given by its graph and nothing else, the domain is found by following each point on the graph to the $x$-axis in this manner:

It's especially easy when the graph is made of disconnected points:

We can imagine that the blue points were suspended in the air -- as the graph -- and then dropped on the ground -- producing the domain point on the $x$-axis. Here the domain is $X=\{1,1.5,2,2.5,3,3.5\}$. When the graph is a curve, we need to push (we say “project”) the whole graph down on the $x$-axis:

$\square$

What is the advantage of one domain over another? The size. A smaller domain is a constraint on what we can do with the function and we, therefore, choose the “largest possible domain”. A more precise way to describe this choice is as a certain set.

**Definition.** The *implied domain* (or the *natural domain*) of a formula is the set of all inputs for which the formula makes sense.

To find it, we need to look at the formula and answer the question, what can go wrong?

**Example.** Let
$$f(x) = \frac{x^{2} + 1}{x^{2} - 1};$$
find the implied domain. We need to ensure that the input $x$ doesn't produce a $0$ in the denominator. Solve
$$x^{2} - 1 = 0.$$
We see that $x^{2} = 1$. Thus $x = -1$ and $x = + 1$. The function is defined by all values except $\pm 1$. Therefore, the implied domain is:
$$X=\{x:\ x\ne 0\},$$
in the set-building notation, and, in the interval notation, it is the *union* of these three intervals:
$$X = ( \infty, -1 ) \cup (-1 , 1) \cup ( 1, \infty).$$
$\square$

So, while technically a function isn't a function without a domain, a formula carries with it its own domain!

All algebraic operations are fine: any two numbers can be added, or subtracted, or multiplied, but division has an exception. What else can go wrong? Square roots of negative numbers are undefined (because the square of two negative numbers is positive).

**Example.** Consider
$$f(x)=\sqrt{x-1}.$$
To find its domain, we need to make sure that the input of the square root isn't negative. What we *don't* want to have is written simply as:
$$x-1< 0.$$
Solving this *inequality* gives us:
$$x< 1.$$
If in the previous example we took the solution set of an equation and excluded it from the domain, we now do that with the solution set of this inequality . Therefore, the implied domain is:
$$X=\{x:\ x\ge 1\}=[1,\infty).$$
$\square$

These are only a couple of “problematic” algebraic operations:

- division (possibly by $0$),
- even degree roots (of possibly negative numbers).

The problem of finding the domain is solved by the following methods, respectively,

- set the denominator equal to $0$ and solve the equation,
- set the expression under the radical less than zero and solve the inequality.

In either case, we produce the solution set that is then excluded from the set of real numbers. The result is the domain.

**Example.** What if the function is given by a list of instructions? For example, let's find the domain of the following function:
$$\begin{array}{ccccccccccccccc}
\text{input} & \mapsto & \begin{array}{|c|}\hline\text{ multiply by }2 \\ \hline\end{array} & \mapsto & \begin{array}{|c|}\hline\text{ add }2 \\ \hline\end{array} & \mapsto & \begin{array}{|c|}\hline\text{ take the reciprocal }\\ \hline\end{array} \mapsto & \begin{array}{|c|}\hline\text{ subtract }55 \\ \hline\end{array} & \mapsto &...& \text{output }
\end{array}.$$
Step 3 is the problem! Through trial and error, we can discover that input $x=-1$ causes an “explosion” at step 3:
$$\begin{array}{llllllll}
-1 & \mapsto & (-1)\cdot 2=-2 & \mapsto & (-1)+2=0 & \mapsto & \frac{1}{0}= \bigotimes & \\
\end{array}$$
How do we find the answer? The input of step 3 can't be $0$. But how do we make sure that this won't happen? First, the input of step 3 is the output of step 2. Therefore, its output can't be $0$. How do we ensure that? The input of step 2 can't be $-2$! Second, the output of step 1 can't be $-2$ and, therefore, its input can't be $-1$. This is the only number we don't allow as an input of the whole function. In other words, we *trace back* $z=0$ -- solving equations along the way -- to the corresponding value of $x$:
$$\begin{array}{llllllll}
x & \mapsto & x\cdot 2=y & \mapsto & y+2=z & \mapsto & \frac{1}{z}=u& \mapsto & u-55=w & \mapsto &...\\
x & \mapsto & x\cdot 2=y & \mapsto & y+2=z & \mapsto & z\ne 0& \\
x & \mapsto & x\cdot 2=y & \mapsto & y+2=z\ne 0 & \mapsto \\
x & \mapsto & x\cdot 2=y\ne -2 & \mapsto \\
x \ne -1 & \mapsto
\end{array}$$
So, the implied domain is:
$$X=\{x:\ x\ne -1\}.$$
Note that the operations that come *after* division in step 3 won't change our decision about excluding $x=-1$ from the domain but might produce more exclusions. $\square$

**Exercise.** Show that the appearance of a division or a square root in the formula of the function doesn't always cause the domain to lose points:
$$f(x)=\frac{1}{x^2+1},\quad g(x)=\sqrt{x^2+1}.$$

## 11 The graph of a function

A function may be given to us in the form of a table, a formula, or a list of instructions. Those deal with the function one input at a time. This is why one will find it hard to discern *patterns* that may be hidden in the function. Graphs provide a way to have a bird's eye view of the function.

Recall that the *graph* of a relation is the set of points in the $xy$-plane that satisfy the relation. In the case of a function then, the graph of a function $y=f(x)$ is the set of points in the $xy$-plane that satisfy $y=f(x)$. In other words, it is the set of all possible points in the form $(x,f(x))$.:
$$\text{graph of }f\ = \ \{(x,y):\ y=f(x)\}.$$

Graphs provide a way to visualize functions.

**Example.** Suppose we have a function represented by a table of values. We can use the table data to plot points, which leads us to the graphical representation. The table and the first graph below has been seen before. We simply treat each of the rows of the table as the two coordinates of a point on the $xy$-plane:

The domain of the function is just these five values of $x$. Furthermore, we may try to *extrapolate* the data to the whole interval. The first graph is data, the rest are just guesses. $\square$

**Example.** What if, instead of a table, the function is given by a formula, say, $y=f(x)=x^2$? We just build the table (two columns, for $x$ and $y$) from the formula one row at a time:
$$\begin{array}{l|ll}
x&y=x^2\\
\hline
0&0\\
1&1\\
2&4\\
3&9\\
4&16\\
\end{array}$$
We then plot the point just as before:

Note that there are gaps in the data; we can't tell, for example, what $1.5^2$ is. The data also don't go far enough; we can't tell what $100^2$ is. Thus, our algebraic representation (the formula) is complete but the numerical representation given by the table is not. We can guess what happens in between or we have a spreadsheet plot the points you have in the table and then automatically add a curve connecting them. $\square$

**Exercise.** Plot the graph of the function given by the list of instructions: 1. add $3$, 2. divide by $2$, 3. square the outcome.

**Example.** If it is known that our function is just a snapshot of a “continuous” process, such as motion, we just collect more information:

We, for example, look at the odometer every minute instead of every hour. $\square$

Note that when $x$ and $y$ represent two variables that have nothing to do with each other -- such as time and location -- neither do the two axes. In that case, neither the unit lengths nor the locations of the origins have to match:

Warning: The graph of a function isn't a function; it is only a visualization of its function.

Can we find the function if we only have its graph? Yes, if it's small enough.

**Example.** We go from point to point and find its coordinates. Then we put these pairs of points one under the other in a table:

The domain of the new function is automatically constructed in the first column of the table. $\square$

Of course, if we start with a table, plot the graphs, then the table build from the graph as above is the original table! However, we can hope to recover an infinitely long table nor a formula.

Even though we should normally refer to it as “the graph of a function”, we may informally refer to a curve that passes the Vertical Line Test as “a graph”.

Can we ever treat a graph as a function? Let's recall the idea of function as a *black box* that processes the input and produces the output:
$$\begin{array}{ccccccccccccccc}
\text{input} & & \text{function} & & \text{output} \\
x & \mapsto & \begin{array}{|c|}\hline\quad f \quad \\ \hline\end{array} & \mapsto & y
\end{array}$$
$$\begin{array}{ccccccc}
f&( &3&)&=&3^2\\
\uparrow&&\uparrow&&&\uparrow\\
\text{function }&&\text{input }&&&\text{output}
\end{array}$$

Now, suppose we already have a graph. Where in the graph is that black box? In other words, where are the arrows that we used to visualize functions in the beginning of the chapter?

Suppose we have a graph that passes the Vertical Line Test. Let's build a black box for the function, $f$, it represents. For each $x$, we need to find $y$ using nothing but the graph. How?

We just reverse the process of building the graph from a table of values. This is what we do one input at a time:

For as many locations on the $x$-axis as possible, we draw a red vertical line until it crosses the graph. For that point we draw a green horizontal line until it crosses the $y$-axis. This is the totality of inputs and outputs connected by arrows:

These arrows give us a visualization our newly-built function. We can, furthermore, represent this function as a list of instructions:

- 1. $x$ is an input, a number;
- 2. plot the point with
*that*coordinate on the $x$-axis of the $xy$-plane; - 3. draw through
*that*point a vertical line in the $xy$-plane; - 4. find the point of intersection of
*that*line with the graph; - 5. draw through
*that*point a horizontal line in the $xy$-plane; - 6. find the point of intersection of
*that*line with the $y$-axis; - 7. find the coordinate of
*that*point; - 8. this number, $y=f(x)$, is the output.

Just as in the last section, we can examine the list to find what can go wrong with the procedure.

The first (and also last) step that may cause trouble is #4. Indeed, what if there is no intersection? If there is no point in common of the vertical line -- the input of this step -- and the graph, then there is no such point -- the output of this step. As a result, the function breaks down (just as $f(x)=1/x$ breaks down if the input is $x=0$). This means that *that* $x$ is in not in the domain of our function! We can see this happening with the graph above for the values of $x$ that are too small or too large. So, the implied domain of this function is
$$\text{ domain }= \{x:\ \text{ there is a point on the graph with its }x\text{-coordinate equal to }x\}.$$

What else can go wrong with this step? We can imagine that there are more than one such points of intersection (such as with a circle), then what? Then the *Vertical Line Test* is violated and this is simply not a function!

**Example.** Write a list of instructions of how to obtain a table of values from a graph.

## 12 Algebra creates functions

The dependence of $x$ on $y$ in a numerical function can be very simple. However, the simplest kind of function is such that its output does not change with the input! This is a *constant function*, i.e., it is given by a formula:
$$f(x)=k\text{ for all } x,$$
for some predetermined number $k$. Its implied domain is, of course, $X=(-\infty,\infty)$. Its computation is non-existent; for example, when $k=3$, we have:
$$\begin{array}{ccccccccccccccc}
\text{input} & \mapsto & \begin{array}{|c|}\hline\text{ produce }3 \\ \hline\end{array} & \mapsto & \text{output }
\end{array}.$$
As you can see, the input is thrown away. This is the table of values of this function:
$$\begin{array}{l|ll}
x&y=f(x)\\
\hline
0&3\\
1&3\\
2&3\\
3&3\\
4&3\\
...&...
\end{array}$$
Plotting a few of these points reveal that the graph is a horizontal line:

Indeed, its equation is $y=3$.

The next simplest function is the one that does nothing to the input; i.e., it is given by a formula: $$f(x)=x.$$ Its implied domain is, of course, $X=(-\infty,\infty)$. Its computation is trivial: $$\begin{array}{ccccccccccccccc} \text{input} & \mapsto & \begin{array}{|c|}\hline\text{ pass it } \\ \hline\end{array} & \mapsto & \text{output } \end{array}.$$ This time, the input isn't thrown away but there was still no algebra needed. This is its table of values: $$\begin{array}{l|ll} x&y=f(x)\\ \hline 0&0\\ 1&1\\ 2&2\\ 3&3\\ 4&4\\ ...&... \end{array}$$ Plotting a few of these points reveal that the graph is the $45$ degree line:

Indeed, its equation is $y=x$.

Warning: if we say that $y$ *is* $x$, then the $xy$-plane should have the same units for the two axes.

**Exercise.** Plot the function that represents the location as it depends on time if the speed is one foot per second.

So far, no algebra!

Linear polynomials are the next level of complexity...

A *linear polynomial* is a function given by this formula:
$$f(x) = m\cdot x +b ,$$
for some predetermined numbers $m$ and $b$.

So, the simplest algebra has appeared: addition/subtraction and multiplication by a constant number. They are visible in its flow-chart: $$\begin{array}{ccccccccccccccc} f:& x & \mapsto & \begin{array}{|c|}\hline &x&\mapsto& \begin{array}{|c|}\hline\quad \text{ multiply by }m \quad \\ \hline\end{array} & \mapsto & \begin{array}{|c|}\hline\quad \text{ add }b \quad \\ \hline\end{array} & \mapsto & y \\ \hline \end{array} & \mapsto & y. \end{array}$$

The formula is commonly called its *slope-intercept form* of the function:
$$\begin{array}{lll}
f(x) = & m&\cdot &x & +&b \\
& \uparrow &&&& \uparrow \\
& \text{slope} &&&& y\text{-intercept}
\end{array}$$

**Definition.** Suppose we choose two points on a line in a specified order, say, $A$ then $B$. Then, defined the *slope* by thee formula:
$$\text{slope } =\frac{\text{rise}}{\text{run}}=\frac{\text{change of }y}{\text{change of }x}.$$

**Exercise.** Can the rise be zero? Can the run?

The geometric meaning of the numerator and denominator is seen below:

Warning: “Rise” and “run” in this context aren't meant to substitute for “lengths of these segments” or “distances between those points”. In contrast to plain geometry, one or both of them can be negative! This is also why the word “steepness” should be used with caution.

If we know the coordinates of the points, $$A=(a_1,a_2),\quad B=(b_1,b_2),$$ the slope is computed by: $$m=\frac{\text{change from }a_2 \text{ to } b_2}{\text{change from }a_1 \text{ to } b_1}=\frac{b_2 -a_2}{b_1 -a_1}.$$ Using the word “difference” will also be very common in the future.

Another explanation of slope, one will be important throughout calculus, is the *rate of change*.

The result is, of course, the same if we reverse the order: $B$ first, $A$ second.

Indeed, both numerator and denominator simply flip their signs: $$\text{change from }b_2 \text{ to } a_2=-(\text{change from }a_2 \text{ to } b_2)$$ and $$\text{change from }b_1 \text{ to } a_1=-(\text{change from }a_1 \text{ to } b_1).$$ Algebraically: $$\frac{a_2 -b_2}{a_1 -b_1}=\frac{-(b_2 -a_2)}{-(b_1 -a_1)}=\frac{b_2 -a_2}{b_1 -a_1}=m.$$

This is how a negative slope appears:

**Exercise.** Any two points chosen on the line will produce the same slope. Explain why.

Below we arrange all linear polynomials according to their slopes (as if the $y$-intercept is the same)):

It's as if changing the slope *rotates* the line. This diagram will be very useful even when we deal with non-linear functions.

**Exercise.** Is the vertical line missing?

Of course, we can study this “rotation” via the angles. The approach via the slopes, however, is simpler! The slope is $m$ means that, as we flow the line, we make a step of $1$ unit to the right and then $m$ units up (it translates into a down step when $m<0$).

Warning: The slope is meaningless unless there are axes as a frame of reference.

**Exercise.** What happens to the slope of a line drawn on a piece of paper if for different choices of the axes?

It is also easy to determine that:

- if $m > 0$, then the outputs $y=f(x)$ are increasing as the inputs $x$ are increasing;
- if $m < 0$, then the outputs $y=f(x)$ are decreasing as the inputs $x$ are increasing;
- if $m = 0$, then the outputs $y=f(x)$ remain the same as the inputs $x$ are increasing; i.e., $f$ is a constant function.

Furthermore, the slope is the characteristic of a linear polynomial that tells us *how fast* the output is changing relative to the change of the input. An important illustration of this idea we saw early in this chapter when these were time and location respectively; then the slope is the *velocity*. The examples also showed how the velocity may change incrementally and cause the location to change linearly interval by interval:

In fact, we might be able to zoom in on a curve and see the same pattern...

**Exercise.** Suppose both the domain and the codomain of a linear polynomial are the integers (as in the picture above). What can you say about the slope in this case?

Warning: The meaning of the slope is lost if we resize the plot. Straight lines remain straight lines though.

**Exercise.** Arrange all linear polynomials with the same slope according to their $y$-intercepts.

The slope gives us the *direction* of the line. That's how the slope-intercept formula, $y=mx+b$, works: we start at the $y$-intercept, $(0,b)$, and the proceed in the direction provided by the slope, $m$. In the same manner, we can start at *any* point. Suppose a point is given, say, $A=(x_0,y_0)$. From there, we go as described above: $1$ unit right (the run) and $m$ units up (the rise), repeated as many times as necessary:
$$(x_0,y_0)\ \leadsto\ (x_0+1,y_0+m)\ \leadsto\ (x_0+2,y_0+2m)\ \leadsto\ (x_0+3,y_0+3m)\ \leadsto\ ...$$

What about an arbitrary point $X=(x,y)$ on the line? The run is $x-x_0$ and the rise is $y-y_0$. Therefore,
$$m=\frac{y-y_0}{x-x_0}.$$
This equation doesn't capture the whole line because $x$ cannot be equal to $x_0$. Instead, we rewrite this formula in a *point-slope form*.

**Theorem (Point-slope form).** A line with slope $m$ passing through point $(x_0,y_0)$ is given by:
$$\begin{array}{|c|}\hline\quad y-y_0 = m\cdot (x -x_0).\quad \\ \hline\end{array}$$

This equation is a *relation*! Even though we can solve for $y$ any time we want, this form is preferable because in it the rise and the run are still visible:
$$\begin{array}{ccccc}
\text{rise}&&\text{slope}&&\text{run}\\
(y-y_0) &= & m&\cdot &(x -x_0)& \\
\end{array}$$
The coordinates of a fixed point $A=(x_0,y_0)$ and a variable point $X=(x,y)$ on the graph are visible too:
$$\begin{array}{cccc}
\text{point }X&&&& &&\text{point }X\\
\downarrow&&&& &&\ \ \downarrow\ \\
y&-&y_0 &= & m&\cdot &(x& -&x_0)& \\
&&\uparrow&& &&&&\uparrow\ \\
&&\text{point }A&& &&&&\text{point }A&
\end{array}$$

**Exercise.** Find the slope-intercept from the point-slope form.

A slightly different approach emerges when we make $p$ steps right and $q$ step up as we follow the line.

Then the equation becomes: $$p(y-y_0) =q(x -x_0).$$ The slope is $m=q/p$.

## 13 Algebra creates functions, continued

We now introduce new algebra into functions building: multiplication of the input of the function by itself. What is the difference between multiplication in $3\cdot x$ and in $x\cdot x$? To begin with, the former is about tripling a quantity of any nature, while the latter may be about the *area* of a square $x\times x$. Second, computing the latter requires -- in contrast to most previous examples of functions -- making a *copy* of the input first:
$$\begin{array}{ccccccccccccccc}
x & \mapsto & \begin{array}{|c|}\hline
&
\begin{array}{ccccc}
x&\mapsto &\begin{array}{|c|}\hline\quad \text{ pass it } \quad \\ \hline\end{array} \\ &&\downarrow\\
x&\mapsto &\begin{array}{|c|}\hline\quad \text{ multiply by }x \quad \\ \hline\end{array} & \mapsto&y \\
\end{array}\\ \hline
\end{array} & \mapsto & y
\end{array}.$$

Now the attributes of this function. First, without division or roots, the *domain* is everything: $(-\infty ,+\infty )$. Second, the *values* cannot be negative. Third, let's have a small table of values:
$$\begin{array}{r|c}
x&y=f(x)=x^2\\
\hline
-3&9\\
-2&4\\
-1&1\\
0&0\\
1&1\\
2&4\\
3&9\\
\end{array}$$
We notice right away that the values (outputs) of $f$ first decrease, up to $x=0$, and then increase. That's different from linear polynomials!

We also notice something else that distinguishes this function from all linear (non-constant) polynomial: different inputs can produce same outputs: $$(-1)^2=1^2.$$ In fact, a pattern starts to emerge: $$\text{different inputs }\left\{\begin{array}{c} -3\ 9\\ \left\{\begin{array}{c} -2\ 4\\ \left\{\begin{array}{c} -1\ 1\\ \ \ 0\ 0\\ \ \ 1\ 1\\ \end{array}\right\}\\ \ \ 2\ 4\\ \end{array}\right\}\\ \ \ 3\ 9\\ \end{array}\right\}\text{ same outputs }$$ They are paired up! There seems to be a large-scale symmetry among the values: they start to repeat themselves -- in reverse order -- after we pass $x=0$. The symmetry becomes vivid once we plot these seven points:

When we connect the points to create a curve, we see that its left branch is a mirror image of its right branch.

Alternatively, we can fold the plane in half along the $y$-axis and make one branch land on top of the other.

**Exercise.** Suggest examples of other objects with a mirror symmetry.

This graph is called a *parabola*.

Why do we connect these points in this manner? We try to avoid these two undesirable features in the graph:

- gaps and breaks,
- corners and cusps.

Keeping in mind the possibility that the function might model *motion*, these are to be avoided because they represent certain implausible events:

- the former would represent an abrupt or even
*instant*change of position and - the latter a sudden or even instant change of velocity or direction.

It is, however, not usual for man-made objects or quantities to change incrementally. These issues are addresses in full in Chapters 4 and 5 respectively.

Another thing we notice that distinguishes this function from all linear polynomials is the slope. It is, in fact, *slopes*; they are different in different locations!

Indeed,

- the slope from $(0,0)$ to $(1,1)$ is $\frac{1-0}{1-0}=1$, but
- the slope from $(1,1)$ to $(2,4)$ is $\frac{4-1}{2-1}=3.$

There are no straight lines!

While the square function above may be about the *area* of a square $x\times x$, the next one,
$$f(x)=x^3,$$
may be about the *volume* of a cube $x\times x\times x$.

The *domain* is everything: $(-\infty ,+\infty )$. In contrast, the values *can* be negative:
$$\begin{array}{r|c}
x&y=f(x)=x^2\\
\hline
-3&-9\\
-2&-4\\
-1&-1\\
0&0\\
1&1\\
2&4\\
3&9\\
\end{array}$$
We notice right away that the values (outputs) of $f$ increase throughout! That's different from the square function.

We also notice something else that distinguishes this function from the last: different inputs *cannot* produce same outputs:
$$(-1)^3\ne 1^3.$$
This is the pattern:
$$\text{different inputs }\left\{\begin{array}{c}
-3\ -9\\
\left\{\begin{array}{c}
-2\ -4\\
\left\{\begin{array}{c}
-1\ -1\\
\ \ 0\quad 0\\
\ \ 1\quad 1\\
\end{array}\right\}\\
\ \ 2\quad 4\\
\end{array}\right\}\\
\ \ 3\quad 9\\
\end{array}\right\}\text{ outputs with opposite signs}$$
They are paired up as before but differently. There seems to be a large-scale symmetry among the values: they start to repeat themselves -- in reverse order with opposite signs -- after we pass $x=0$. The symmetry becomes vivid once we plot these seven points:

In contrast, the left branch is *not* a mirror image of its right branch:

It there another symmetry? Yes, it's a rotation $180$ degrees around the origin.

Alternatively, we can fold the plane in half along the $y$-axis and then along the $x$-axis to make one branch land on top of the other. Yet another view is that of *central symmetry*:

**Exercise.** Suggest examples of other objects with a central symmetry.

**Exercise.** Express the symmetry of this graph in terms of two consecutive mirror symmetries.

Once again, the *slopes* are different in different locations!

Indeed,

- the slope from $(0,0)$ to $(1,1)$ is $\frac{1-0}{1-0}=1$, but
- the slope from $(1,1)$ to $(2,8)$ is $\frac{8-1}{2-1}=7.$

As building blocks for future more complex functions, we introduce the (positive) *power functions* :
$$ \underbrace{x^{0} = 1}_{\text{constant}}, \underbrace{x}_{\text{linear}}, \underbrace{x^{2}}_{\text{quadratic}}, \underbrace{x^{3}}_{\text{cubic}}, ...\ , \underbrace{x^{n}}_{n\text{th degree}}, ... $$
Beyond the first few, we use the power of $x$, called the *degree*, to identify these functions. But first, let's see how they are computed:
$$\begin{array}{ccccccccccccccc}
x^4:& x & \mapsto & \begin{array}{|c|}\hline
&\begin{array}{ccccc}
x&\mapsto &\begin{array}{|c|}\hline\quad \text{ pass it } \quad \\ \hline\end{array} \\ &&\downarrow\\
x&\mapsto &\begin{array}{|c|}\hline\quad \text{ multiply by }x \quad \\ \hline\end{array} \\&&\downarrow\\
x&\mapsto &\begin{array}{|c|}\hline\quad \text{ multiply by }x \quad \\ \hline\end{array} \\&&\downarrow\\
x&\mapsto &\begin{array}{|c|}\hline\quad \text{ multiply by }x \quad \\ \hline\end{array} & \mapsto&y \\
\end{array}\\ \hline
\end{array} & \mapsto & y
\end{array}.$$

The same questions are asked and answered about these new functions: the domains are all real numbers, etc.

The magnitude of the degree affects the shape of the graph:

The higher the degree, the slower the graph grows from $x=0$ and the faster it rises from $x=1$. They all meet at $(0,0)$ and $(1,1)$.

We can see a pattern below:

One might be tempted to say that all the graphs in the first row -- these are the even powers -- “look like” parabolas.

Warning: the graph of $y=x^4$ is *not* a parabola.

We recognize that $x^4,\ x^4,\ ...$ have flatter bottoms (relative to the growth that follows). When the power is odd, the graphs “look like” that of $x^3$ but flatter around $0$. Thus, the *parity* of degree, i.e., even vs. odd, significantly affects the shape of the graph:

- the graphs of the even degree powers have mirror symmetry about the $y$-axis, while
- the graphs of the odd degree powers have central symmetry about the origin.

Understandably, functions with the former kind of symmetry are called “even” and the latter “odd”. These functions are discussed in Chapter 3.

Also,

- the outputs of the even degree powers go down and then up, while
- the outputs of the odd degree powers go only up.

No division until now!

Next,
$$f(x)=\frac{1}{x}.$$
We see the difference right away. We can't divide by $0$ and, therefore, the *domain* is:
$$\{x:\ x\ne 0\}=(-\infty,0)\cup(0,+\infty).$$

A few values: $$\begin{array}{r|c} x&y=f(x)=1/x \\ \hline -3&-1/3\\ -2&-1/2\\ -1&-1\\ \hline \hline 1&1\\ 2&1/2\\ 3&1/3\\ \end{array}$$ We notice right away that the values (outputs) of $f$ decrease throughout either of the two halves of the domain! That's different from all the rest.

Just as with $x^3$, different inputs *cannot* produce same outputs but there is another pattern:
$$\text{different inputs }\left\{\begin{array}{c}
-3\ -1/3\\
\left\{\begin{array}{c}
-2\ -1/2\\
\left\{\begin{array}{c}
-1\ -1\\
\ \ \quad \\
\ \ \ 1\quad 1\\
\end{array}\right\}\\
\ \ \ 2\quad 1/2\\
\end{array}\right\}\\
\ \ \ 3\quad 1/3\\
\end{array}\right\}\text{ outputs with opposite signs}$$
The symmetry is visible in the graph:

However, the pattern of behavior to the right and to the left of these points isn't entirely clear yet. Adding a couple at either end shows that the graph starts to approach the $x$-axis, seems to almost merge with it but never actually reach it:

We say that $y=0$ (the $x$-axis) is a “horizontal asymptote” of the graph.

But what is going on closer to the *hole in the domain*, $0$? We need to *insert* points in the middle:
$$\begin{array}{l|cccc}
x&-3&-2&-1&-1/2&-1/3&-1/4&-1/5&\circ &1/5&1/4&1/3&1/2&1&2&3\\
\hline
y=1/x&-1/3&-1/2&-1&-2&-3&-4&-5&&5&4&3&2&1&1/2&1/3
\end{array}$$
The result shows that the graph starts to approach the $y$-axis, seems to almost merge with it but never actually reach it:

We say that $x=0$ (the $y$-axis) is a “vertical asymptote” of the graph. This curve is called a *hyperbola*.

Again, the symmetry is a rotation $180$ degrees around the origin (a central symmetry):

**Exercise.** The graph has also a mirror symmetry; point it out.

As there are more and more functions, we can't devote as much time and attention to each and every one of them. Often, we will get only a bird's eye view of *classes* of functions...

In addition to the positive power functions, we introduce the *negative power functions*, or *reciprocal power functions*, as the reciprocals of the former:
$$x^{-1}=\frac{1}{x^1},\ x^{-2}=\frac{1}{x^2},\ x^{-3}=\frac{1}{x^3},\ ....,\ x^{-n}=\frac{1}{x^n},... $$

They are easy to compute if we have the previous functions available. For example, this is how one computes $1/x^3$: $$\begin{array}{cccc} x&\mapsto &\begin{array}{|c|}\hline\quad \text{cube it} \quad \\ \hline\end{array}&\mapsto &\begin{array}{|c|}\hline\quad \text{ take its reciprocal} \quad \\ \hline\end{array} & \mapsto&y. \end{array}$$

The main difference from the positive powers is in the domains. The *domains* of all of these functions are the same:
$$\{x:\ x\ne 0\}=(-\infty,0)\cup(0,+\infty).$$

Instead of just recognizing patterns in a behavior of a single function, we try to see them in a whole *group of functions*.

The magnitude of the degree affects the shape of the graph:

The higher the degree, the faster the graph drops from $x=0$ and the slower it declines from $x=1$. They all meet at $(1,1)$.

We recognize that as we more along the sequence of functions $1/x^3,\ 1/x^4,\ ...$, the graphs are getting *flatter and flatter*: almost vertical or almost horizontal! When the power is odd, the graphs “look like” that of $1/x$ but flatter around $0$. Once again, the parity of degree significantly affects the shape of the graph:

- the graphs of the even degree reciprocal powers have mirror symmetry about the $y$-axis, while
- the graphs of the odd degree reciprocal powers have central symmetry about the origin.

Also,

- the outputs of the even degree reciprocal powers go up and then down, while
- the outputs of the odd degree reciprocal powers go only down, within either of the two halves of the domain.

Warning: we can't simply say that the values of the odd degree reciprocal powers decrease, not across the hole in the domain.

We have learned that we should address the issue of the domain -- all possible *inputs* -- early on. What about all possible *outputs*?

## 14 The image: the range of values of a function

**Example.** Let's go back to the set $X$ of boys, the set of balls $Y$, and the “I prefer” function $F$ from $X$ to $Y$. A simple question we may ask about it is, *what do they like as a group?* It has a simple answer, a list: basketball, tennis, and football. We just have to look at the arrow and record those elements of $Y$ that have an arrow arriving at it. This set,
$$V=\{ \text{ basketball, tennis, football }\}\subset Y,$$
is a subset of the codomain $Y$ and represents all possible values of $F$.

In other words, this is the range of values of the function. It can be, but is not in this case, the whole codomain. $\square$

**Definition.** The *image*, or the *range*, of a function $F:X\to Y$ is the set of all of its values, i.e.,
$$\{y:\ F(x)=y \text{ for some }x\}.$$

Note that if we keep the values but change the original codomain of $F$ to its range $V$, we have a new, and different, function $G:X\to V$.

Now numerical functions... You get an idea about the range by simply looking at the $y$-column of the *tables of values* of the function (just as looking at the $x$-column gives you an idea about the domain). However, finding the set requires some algebra.

Linear polynomials are easy:
$$y=mx+b \ \Longrightarrow\ x=\frac{y-b}{m},$$
for $m\ne 0$. So, *there is an $x$ for every $y$*. We have proven the following.

**Theorem.** The range of a linear polynomial $y=mx+b$ is the set of real numbers, $V={\bf R}$, unless the slope is zero, $m=0$ (constant); in that case, the range is a single point, $V=\{b\}$.

**Example.** Can we make the same argument for $f(x)=x^2$? Of course not: squares can't be negative! What about the rest of $y$'s?
$$y\ge 0 \ \Longrightarrow\ y=\left(\sqrt{y}\right)^2.$$
Therefore, the range of $x^2$ is
$$\{y:\ y\ge 0\}=[0,+\infty).$$
What about $x^3$? It works for *any* $y$:
$$y=\left(\sqrt[3]{y}\right)^3.$$
Why such a difference? In addition to the algebra above, we will appreciate the difference between the two functions by examining their graphs, especially if we thicken them and shrink the $xy$-plane:

So, the “spread” of the graph vertically gives us the range (the “spread” of the graph horizontally gives us the domain). This is how the range of $y=x^2$ is seen as a ray in the $y$-axis:

$\square$

Generally, to find the range of a numerical function the graph of which is supplied, we draw a horizontal line through every point on the graph and note where it crosses the $y$-axis. Conversely, we try to find a counterpart for *each* $y$ going backwards:

**Example.** The example of $y=1/x$ is a bit more complex. What $y$ can come from this formula? To answer, find $x$:
$$y=1/x\ \Longrightarrow\ x=1/y \ \Longrightarrow\ y\ne 0.$$
In other words, the equation $1/x=0$ has no solution. We come to the same conclusion be examining the graph and discovering that it cannot touch the $x$-axis:

Therefore, the range is $$\{y:\ y\ne 0\}=(-\infty,0)\cup (0,+\infty).$$ The solution and the range are exactly the same for the rest of the reciprocal powers... $\square$

So, these graphs cannot touch or cross the $x$-axis and that is the same as to say that $0$ isn't in the range. In the meantime, their graphs cannot touch or cross the $y$-axis and that is the same as to say that $0$ isn't in the domain. That's the analogy -- and the symmetry -- of the problems of the domain and the range (not codomain). It is the symmetry of the $x$- and the $y$-axes in the $xy$-plane.

Any set (in the $y$-axis) can be the range of some function. For example, this function's range is a bounded interval:

**Definition.** If the range of a function is bounded, the function is called *bounded*, otherwise *unbounded*.

The linear polynomials are unbounded (except for the constant ones) and so are all quadratic polynomials. These are some ways a function can exhibit unbounded behavior:

If the domain and the range are intervals, the graph of the function is contained in the rectangle with these sides:

**Example.** It is often the case that the domain is an interval and the codomain is typically chosen to be $Y={\bf R}$. So is the range:

However, the range may skip values when there are breaks in the graph:

This issue is discussed in Chapter 5. $\square$

Another question we can ask about boys and balls is, *who likes basketball? or baseball, etc.?* We just look at the arrow, or arrows, that arrives to this ball and note where it comes from. The result is a subset of $X$.

**Definition.** The *preimage* of an element $b$ in a set $Y$ under a function $F:X\to Y$ is the set of all $x$ the value of which is $b$, i.e.,
$$\{x:\ F(x)=b\}.$$

If we carry out this computation for every ball and discover that the preimage of baseball is the empty set. This is always the case with outputs outside the range!

The picture below illustrates how to find the preimage of a point of a numerical function.

Some answers we already know:

- the preimages under a constant function are empty with an exception of a single value the preimage of which is the whole $x$-axis;
- the preimages under linear (non-constant) polynomials are single points;
- the preimages under even powers are two-point sets for positive $y$'s, a single point for $y=0$, and empty for negative $y$'s;
- the preimages under odd powers are single points.

**Exercise.** Prove the above statements.

**Exercise.** What are the preimages of the reciprocal powers?