##### Tools

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

# Functions

## 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! (This is in contrast to “a set of knives” that suggests a certain structure.)

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. In order 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.

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. We can even form a new set that consists of all the boys and all the balls:

Instead, can these two sets be related to each other somehow? Yes, boys like sports! Let's make this idea more specific. Each boy may be interested in a particular sport or he may not. For example, suppose this is what we know:

• 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 has to 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 the arrow and the 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.

In order 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”:

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 however is two-sided; not only Tom is a friend of Ben but also Ben is a friend of Tom. 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.

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

## 2 Functions

In a relation, the two sets involved play equal roles. Instead, let's now take the point of view of the boys. This time, we concentrate on the possibility that every boy has a sport that he likes the best! We will explore a new relation:

• Ned prefers tennis,
• Ken prefers football,
• Sid prefers football.

Then our line segments become 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 as follows:

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}$$

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.

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?

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.

In order 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.

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 co-domain 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 co-domain (right).

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 may emerge...

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

We initially decide to rely entirely on the 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 mus 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.

We list all possible combinations -- every $10$ yards -- of a width, column $W$, and a depth, column $D$. Both run through these $10$ values: $$W=10,20,...,100 \text{ and } D=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 single yard: $$W=1,2,...,100 \quad D=1,2,...,100.$$ We have then $100\cdot 100=10,000$ possible combinations. We also add another column, $P$, for the perimeter computed as: $$P=2( W + D ).$$ We can now check whether such an enclosure satisfies $P=100$ and then plot this point if does. Then we have a relation between two sets $X$ and $Y$ either of which is the set of real numbers. The relation is defined by: two numbers $W$ and $D$ are related when $$2( W + D )=100.$$ What we have to test, to be precise, isn't the exact equality $P=100$ but whether it is a good enough approximation, say, within $1$ yard. This is another relation: two numbers $W$ and $D$ are related when $$99<P<101.$$

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...

What if we represent this relation explicitly? What if we express $D$ in terms of $W$? It requires only the middle school algebra. We start with $2( W + D )=100$ and conclude: $$D=50-W.$$ Such an explicit relation between two variables -- or rather a dependence of one variable on the other -- is a function. This is its data: $$\begin{array}{l|lll} W&L\\ \hline 10&40\\ 20&30\\ 30&20\\ 40&10\\ 50&0 \end{array}$$ Only $5$ pairs if we take it $10$ yards at a time. If it's $1$ yard at time, we have $50$. We put those in a new spreadsheet. The first column is for the width $W$ running through: $1,2,...,50$. The second is for the depth $D$, evaluated by $D=50-W$. What's left 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.

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$. With more middle school algebra, we make it explicit: $$A=W(50-W).$$ We can restate our original problem as follows: $$A=-W^2+50W, \text{ find the largest possible values of } A.$$ With such an explicit representation, we can 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 this 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.$$

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 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:

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?

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

Just as before, we can visualize this function as a table or a graph. This is the simplest example: suppose we move to the next milestone every minute. 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}$$ Things become much simpler if 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}$$

We can record numerous scenarios of driving on the road. Below are a few examples.

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

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

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

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

The speed is constantly increasing:

Exercise. Represent a round trip.

The case of slow motion serves a special attention. It gives an impression that we stop periodically! 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 $\{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:

We'd have to stop eventually such as this ruler that goes up to $1/8$ of an inch:

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$! 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.

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.

## 5 The real number line and sets of numbers

So, we label sets with numbers. In particular, we labelled milestones with several consecutive integers: $$\{n,n+1,n+2,...,m\}.$$ The idea is very productive whenever the set has 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.

We then turn to sets of numbers. For now, we only use the order of numbers and ignore other structures such as algebra and geometry.

Sets get bigger and bigger and may seem to be infinite. Imagine facing a fence so long that you can't see its end. It is then convenient to assume that there is no end!

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. We can speak then of locations spaced over an infinite straight line.

We can label the planks (just as we did milestones) with numbers.

Such a set we associate with the set of natural numbers : $${\bf N}=\{0,1,2,3,...\},$$ or the set of integers: $${\bf Z}=\{...,-3,-2,-1,0,1,2,3,...\}.$$

What about fractions, i.e., the rational numbers. In order to visualize these 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 direction 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 result looks similar to a ruler:

The idea is to use this set-up to produce a correspondence:

• location $P\ \longleftrightarrow\$ number $x$,

that works in both directions.

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 then this mark on the line. That's the location $P$ on the line.

Just as in the last section, 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. That's how the irrational numbers -- $\sqrt{2},\ \pi$, etc. -- came into play. Together they for the set of real numbers explained later in this book. Then this $1$-dimensional coordinate system is called the real number line or simply the number line. It is often denoted by ${\bf R}$.

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.

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

For example, consider these:

• We face the equation $x+2=5$. Then through some manipulations we find $x=3$.
• We face the equation $3x=15$. Then through some manipulations we find $x=5$. Is there more?
• We face the equation $x^2-3x+2=0$. Then through some manipulations we find $x=1$. Is that it?
• We face the equation $x^2+1=0$. Then after all manipulations we can't find $x$. Should we keep trying?

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?

We must present all numbers $x$ that satisfy the equation. In other words, the answer is a set! It is called the solution set of the equation.

Let's take another look at the equations above: $$\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}$$ The last one is called the empty set and is commonly denoted by $\emptyset$. This is how we visualize these four sets:

Solution sets of inequalities also produce subsets of the real number line:

The standard set-building notation is then replace with a more compact interval notation, as follows: $$\begin{array}{ll} \{x:&a\le x\le b&\}&=&[a,b],&\quad&\{x:&a \le x < \infty &\}&=&[a,+\infty),\\ \{x:&a\le x< b&\}&=&[a,b),&\quad&\{x:&a < x < \infty&\} &=&(a,+\infty),\\ \{x:&a< x\le b&\}&=&(a,b],&\quad&\{x:&-\infty < x\le b&\} &=&(+\infty,b],\\ \{x:&a< x< b&\}&=&(a,b),&\quad&\{x:&-\infty < x< b&\} &=&(+\infty,b).\\ \end{array}$$

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 and the 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 $$b\ge x\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.$$

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: $$\{1,2,3,4,5,...\},$$ there is no maximum! And the whole set of real numbers ${\bf R}$ has no maximum or minimum. This is how we deal with this issue.

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,...\}.$$

When the set $X$ has no lower bound, we use the notation: $$\min X=-\infty,$$ and the set $X$ has no upper bound, we use: $$\max X=+\infty,$$

Here's a simple example: $$\min [a,+\infty)=a,\quad \max [a,+\infty)=+\infty.$$

The set $(a,b)$ is bounded but still has no maximum or minimum. We will deal with this issue in Chapter 4.

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\}$, below:

It will be also very useful to associate blue with negative and red with positive numbers.

## 6 The Cartesian plane: where graphs live...

A relation or a function deals with two sets of numbers: the domain $X$ and the co-domain $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 these:

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

Just as the inputs and outputs of a function have typically nothing to do with each other, the two axes may be unrelated with different unit segments presented accordingly:

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 not necessary as we saw in the last section. 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. It is made from a combination of two copies of ${\bf R}$ and is often denoted by ${\bf R}^2$.

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:

The idea of the Cartesian coordinate system is similar to the one for the real line, to use this 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 Cartesian plane is also called the $xy$-plane.

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$.

## 7 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.


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$.

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}.$$


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

This is what happens if we start to increase the radius:

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=k^2$.

The curves below are the graphs of the relation $xy=k$ plotted for various $k$'s; they are called hyperbolas:

The curves below are the graphs of the relation $y-k=x^2$ plotted for various $k$'s; they are called parabolas:

Even with a computer, verifying that every point on the 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$.

## 8 A function as a black box

What makes functions explicit relations? The two numerical variables are related when this is a relation but they are dependent this is a function. In other words, the input is the independent variable while the output is the independent variable.




• $\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:

• an algebraic formula;
• a list of values;
• a graph;
• a transformation;
• an algorithm (i.e,, a sequence of computational steps).

We will be transitioning from one to the next as needed.

An algebraic formula 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.$$ The letters used in the above notation are the names of the following: $$\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}$$ 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}$$

There still a way interpret this algebra via a diagram. We replace $x$ in the formula with a blank box: $$\begin{array}{ccccccc} f&( &\square &)&=&\square ^2\\ &&\uparrow&&&\uparrow\\ &&\text{ insert input }&&&\text{insert input} \end{array}$$ In 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 diagram $$f\left( \square \right)=\frac{2\square^2-3\square+7}{\square^3+2\square+1},$$ is used to compute the function: $$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},$$ 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 .$$ We compute it for input $x=2$ consecutively: $$2\to 2+3=5\to 5\cdot 2=10 \to 10^2\to 100.$$

A function can also be represented by a list of values. This 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}.$$

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 set of inputs (its domain).

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.

Definition. The graph of a numerical function $f$ 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 $$(x,f(x)).$$

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

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 algebra. Instead it tells us how to get a certain output given a any given 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$

An algorithm can be used to create a computer program. In this case, $x$ is the input, it 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$, there will be trouble.

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 co-domain 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$!

Algebraically, we plug $x$ into the formula and see if it works.

Example. Let $$f(x) = \frac{1}{x} .$$ Let's try $x = 0$. The formula doesn't work because $\frac{1}{0}$ is undefined. If we keep trying, we realize that $\dfrac{1}{x}$ is defined for all $x \neq 0$. Then, we can choose the domain to be all these numbers: $$X = ( - \infty, 0 ) \cup ( 0, +\infty).$$ What about $$X = (0, \infty )?$$ It is also a valid choice. There are many: $$\{...,-2,-1,1,2,...\},\ [1,2],\ (-1,0),\ ...$$ $\square$

What is the advantage of one domain over another?

Definition. The largest possible domain for a given formula is called its implied domain (or the natural domain).

Example. Let $$f(x) = \dfrac{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$, or $$D = ( \infty, -1 ) \cup (-1 , 1) \cup ( 1, \infty).$$ $\square$

These are some “problematic” algebraic operations:

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

Next, let's revisit the 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 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$

## 9 The graph of a function

Graphs provide a way to visualize functions.


$$\begin{array}{ccccccc} f&( &3&)&=&3^2\\ \uparrow&&\uparrow&&&\uparrow\\ \text{function }&&\text{input }&&&\text{output} \end{array}$$

For example, the absolute value function $$f(x) = \begin{cases} -x & \text{ if } x < 0, \\ x & \text{ if } x \geq 0. \end{cases}$$

A function can also be represented by a table of values. Such a table has 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}$$

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 table is not.

We can use the table data to plot points, which leads us to the graphical representation.

The graph of a function $f$ 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 $$(x,f(x)).$$

A spreadsheet will plot all points you have in the table:

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:

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

Warning: Graphs aren't functions; they are only visualizations of functions.


Suppose we have a graph that passes the Vertical Line Test. Let's build a black box for it. 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:

## 10 Monotonicity and extreme values

When we say that a function increases, we mean that the graph rises and we say it decreases when its graph drops:

This verbal definition is simple and the geometric meaning is very clear. However, both are imprecise. Even though we understand increasing functions as ones with graphs rising and decreasing functions as one with graphs falling, the precise definition has to rely on considering one pair of points at a time.

Definition. A function $y=f(x)$ is called increasing on interval $(A,B)$ if $$f(a)<f(b) \text{ for all } A<a<b<B;$$ a function $y=f(x)$ is called decreasing on interval $(A,B)$ if $$f(a)>f(b) \text{ for all } A<a<b<B.$$ The function is also called non-decreasing and non-increasing respectively if we replace the strict inequality signs “$<$” and “$>$” with non-strict “$\le$” and “$\ge$”.

Example. Note that a constant function is both non-decreasing and non-increasing but neither decreasing nor increasing. $\square$

How do we verify these conditions? Let's work out some examples algebraically.

Example. We utilize what we know about the algebra of inequalities.

First, we can multiply both sides of an inequality by a positive number: $$a<b\ \Longrightarrow\ 3a<3b.$$ Therefore, the function $f(x)=3x$ is increasing.

Second, if we multiply both sides of an inequality by a negative number, we have to reverse the sign: $$a<b\ \Longrightarrow\ (-2)a>(-2)b.$$ Therefore, the function $f(x)=-2x$ is decreasing.

Third, we can add any number to both sides of an inequality: $$a<b\ \Longrightarrow\ a+4<b+4.$$ Therefore, the function $f(x)=x+4$ is increasing. $\square$

Putting these facts together, we acquire the following.

Theorem. A linear polynomial $$f(x)=mx+b$$

• is increasing if $m>0$, and
• is decreasing if $m<0$.

Example. This is how we can solve this problem one function at a time, from scratch. Let $$f(x) = 3x - 7.$$ If $x_{1} < x_{2}$ then $$\begin{array}{rrclcc} f(x_{1}) = &3 x_{1} - 7 & \overset{?}{<} &f(x_{2}) = 3 x_{2} - 7 \\ \Longrightarrow &3 x_{1} & \overset{?}{<}& 3 x_{2} \\ \Longrightarrow &x_{1} & < &x_{2}. \end{array}$$ The computation suggests that $y=f(x)$ is increasing. For a complete proof, retrace these steps backwards. $\square$

Example. Let's consider $$f(x)=x^2.$$

First, we can multiply two inequalities, when they are aligned and their signs are positive: $$\begin{array}{ll}0<a<b\\ 0<a<b\end{array}\ \Longrightarrow\ 0<a\cdot a <b\cdot b\ \Longrightarrow\ a^2<b^2.$$ Therefore, the function $f(x)=x^2$ is increasing for $x>0$.

Second, if we multiply two inequalities when their signs are negative, we have to reverse the sign: $$\begin{array}{ll}a<b<0\\ a<b<0\end{array}\ \Longrightarrow\ a\cdot a >b\cdot b>0 \ \Longrightarrow\ a^2>b^2.$$ Therefore, the function $f(x)=x^2$ is decreasing for $x<0$. $\square$

Example. Now, we let $$f(x)=x^3,$$ and follow a similar procedure starting with two unknown $a,b$ with $a<b$. We can multiply three identical inequalities -- positive or negative -- and preserve the sign: $$\begin{array}{ll}a<b\\ a<b\\ a<b\end{array}\ \Longrightarrow\ a\cdot a\cdot a <b\cdot b\cdot b\ \Longrightarrow\ a^3<b^3.$$ Therefore, the function $f(x)=x^3$ is increasing for all $x$. $\square$

Notation: We will use

• “$\nearrow$” for increasing, and
• “$\searrow$” for decreasing behavior.

In particular,

• if $f(x)=2x-3$, then $f \nearrow$ on $(-\infty, +\infty)$;
• if $g(x)=-5x+4$, then $g \searrow$ on $(-\infty, +\infty)$;
• if $h(x)=x^2$, then $h \searrow$ on $(-\infty, 0)$ and $\nearrow$ on $(0, +\infty)$;
• if $k(x)=x^3$, then $k \nearrow$ on $(-\infty, +\infty)$.

When a function is either increasing on an interval or decreasing on it, we call it monotonic on the interval.

Definition. Given a function $y=f(x)$. Then $x=d$ is called a global maximum point of $f$ on interval $[a,b]$ if $$f(d)\ge f(x) \text{ for all } a\le x \le b;$$ and $x=c$ is called a global minimum point of $f$ on interval $[a,b]$ if $$f(c)\le f(x) \text{ for all } a\le x \le b.$$ (They are also called absolute maximum and minimum points.) Collectively they are all called global extreme points.

## 11 Linear polynomials

A linear polynomial is commonly represented by its slope-intercept form: $$\begin{array}{lll} f(x) = & m&\cdot &x & +&b \\ & \uparrow &&&& \uparrow \\ & \textrm{slope} &&&& y\textrm{-intercept} \end{array}$$ This is 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}$$

Recall, that the slope of a line is found by choosing two points on the line in a specified order, say, $A$ then $B$. Then, by definition, we have: $$\text{slope } =\frac{\text{rise}}{\text{run}}.$$ The exact meaning of the numerator and denominator is the following.

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{signed distance from }a_2 \text{ to } b_2}{\text{signed distance from }a_1 \text{ to } b_1}.$$ The result is, of course, the same if we reverse the order: $B$ first, $A$ second. Indeed, both numerator and denominator simply change their signs: $$m=\frac{\text{signed distance from }b_2 \text{ to } a_2}{\text{signed distance from }b_1 \text{ to } a_1}.$$

We can arrange all linear polynomials according to their slopes:

Monotonicity of linear polynomials is easy to determine:

• $m > 0\ \Longrightarrow\ f$ is increasing, on the whole domain.
• $m < 0\ \Longrightarrow\ f$ is decreasing, on the whole domain.
• $m = 0\ \Longrightarrow\ f$ is constant, on the whole domain.

Also we have a point-slope form: $$\begin{array}{llllllr} y&-&y_0 &= & m&\cdot &(x -x_0)& \\ &&\uparrow&& \uparrow && \uparrow \\ &&\text{point}&& \text{slope} &&\text{point}& \end{array}$$ Here, $(x_0,y_0)$ is a point on the line. This equation represents a relation!

## 12 Other elementary functions

A quadratic polynomial is presented in the standard form: $$f(x) = ax^{2} + bx + c, \ a\ne 0.$$ We know that

• if $a > 0$, parabola opens up;
• if $a < 0$, parabola opens down.

Note: the case $a = 0$ is linear not quadratic.

The domain is all reals.

Proposition. The $x$-coordinate of the vertex of parabola (i.e., max or min) is $$v = - \frac{b}{2 a }.$$

Proposition. $$y = - \frac{b}{2 a }$$ is the equation of the axis of the parabola.

As building block 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}}, \cdots , \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 domains are all real numbers.

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 $(1,1)$.

We can see a pattern below:

In the first row, the graphs look like parabolas (with flatter bottom). These are ever powers. When the power is odd, the graphs look like $x^{3}$. Thus, the parity of degree, i.e., odd vs. even, significantly affects the shape of the graph.

In addition to the positive power functions, we introduce the negative 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},...$$ Their domains are the same: $(-\infty,0)\cup(0,+\infty)$.

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)$.

## 13 Sequences

Watching a ping-pong ball bouncing off the floor and recording how high it goes every time will be producing an ever-expanding string of numbers:

Here is a sequence of numbers representing the distance covered by a falling ball recorded every $.05$ second:

We use the following notation: $$a_1=1,\ a_2=1/2,\ a_3=1/3,\ a_4=1/4,\ ...,$$ where $a$ is the name of the sequence and adding a subscript indicates which element of the sequence we are considering. It is sometimes possible to provide a formula for the $n$-th element of the sequence: $$a_n=1/n.$$

Example. What is the formula for this sequence: $$1,\ 1/2,\ 1/4,\ 1/8,\ ...?$$ First, we notice that the numerators are just $1$s and the denominators are the powers of $2$. We write it in a more convenient form: $$a_1=1,\ a_2=\frac{1}{2},\ a_3=\frac{1}{2^2},\ a_4=\frac{1}{2^3},\ ....$$ The pattern in clear and the correspondence is $$a_n=\frac{1}{2^{n-1}}.$$ $\square$

Example. What is the formula for this sequence: $$1,\ -1,\ 1,\ -1,\ ...?$$ First, we notice that the absolute values of these numbers are just $1$s and while the sign alternates. We write it in a more convenient form: $$a_1=1,\ a_2=-1,\ a_3=1,\ a_4=-1,\ ....$$ The pattern in clear and the correspondence is can be written for the two cases (just as for a piece-wise defined function): $$a_n=\begin{cases} -1&\text{ if } n \text{ is even},\\ 1&\text{ if } n \text{ is odd}. \end{cases}$$ The trick we can use for sequences but not for functions is to write: $$a_n=(-1)^{n+1}.$$ $\square$

Exercise. Point out a pattern in each of the following sequences and suggest a formula for its $n$th element whenever possible:

• (a) $1,\ 3,\ 5,\ 7,\ 9,\ 11,\ 13,\ 15,\ ...$;
• (b) $.9,\ .99,\ .999,\ .9999,\ ...$;
• (c) $1/2,\ -1/4,\ 1/8,\ -1/16,\ ...$;
• (d) $1,\ 1/2,\ 1/3,\ 1/4,\ ...$;
• (e) $1,\ 1/2,\ 1/4\ ,1/8,\ ...$;
• (f) $2,\ 3,\ 5,\ 7,\ 11,\ 13,\ 17,\ ...$;
• (g) $1,\ -4,\ 9,\ -16,\ 25,\ ...$;
• (h) $3,\ 1,\ 4,\ 1,\ 5,\ 1,\ 9,\ ...$.

Sequences are just functions! Just compare:

• a typical function: the independent variable is $x$, a real number; the dependent variable is $y=f(x)$ another real number;
• a typical sequence: the independent variable is $n$, a natural number; the dependent variable is $y=a_n$ a real number.

Side by side: $$\begin{array}{ccccrcccr} &&&&&\text{ name of the function} \\ &\downarrow &&&&& \downarrow\\ &f\big(&x&\big)&&\text{ vs. }&a&_n\\ &&\uparrow&&&&&\uparrow\\ &&&&&\text{ name of the variable}\\ \\ &&&&&\text{ value of the variable}\\ &&\downarrow&&&&&\downarrow\\ &f\big(&3&\big)&=5&\text{ vs. }&a&_3&=5\\ &&&&\uparrow&&&&\uparrow\\ &&&&&\text{ value of the function} \\ \end{array}$$

Moreover, they both can be (partially or fully) represented by tables of numbers: $$\begin{array}{c|c} x&y=x^2\\ \hline 0&0\\ 1&1\\ 2&4\\ 3&9\\ \vdots&\vdots \end{array} \quad\quad\quad \begin{array}{c|c} n&y=n^2\\ \hline 0&0\\ 1&1\\ 2&4\\ 3&9\\ \vdots&\vdots \end{array}$$ In contrast to the table of the sequence (right), the table of the function misses more, not just at the end, rows: for $x=.5,\ x=\sqrt{2},$ etc. One can also see the difference if we plot the graphs of both together:

Between any two values of the sequence, the function might have a whole interval of extra values...

Thus, every function $y=f(x)$ creates a sequence $a_n=f(n)$, but not vice versa.

Definition. A function defined on an interval in the set of integers, $\{p,p+1,...,q\}$, is called an finite sequence. A function defined on a ray in the set of integers, $\{p,p+1,...\}$, is called an infinite sequence.

Most of the time, we will use the word “sequence” for both according to the context.

A more compact notation for a sequence is via its formula: $$a_n=\{a_n=1/n:\ n=1,2,3,...\},$$ with the abbreviated notation on the left.

Example. The go-to example is that of the sequence of the reciprocals: $$a_n=\frac{1}{n}.$$

$\square$

We have visualized sequences as graphs of functions defined on such a set of integers but there is a more compact way to present sequences dynamically, i.e., as if $n=1,2,3,...$ are the moments of time something happens: the value changes.

Example. A person starts to deposit $\$20$every month to in his bank account that already contains$\$1000$. Then, after the first month the account contains: $$\1000+\20=\ 1020,$$ after the second: $$\1020+\20=\ 1040,$$ and so on. Then, if $a_n$ is the amount in the bank account after $n$ months, we have a formula: $$a_{n+1}=a_n+ 20.$$ For the spreadsheet, the formula is: $$\texttt{=R[-1]C+20}.$$ Below, the current amount is shown in blue and the next -- computed from the current -- is shown in red:

It is easy to derive the $n$th term formula though: $$a_{n+1}=1000+ 20\cdot n.$$

The latter is just a combination of repeated applications of the former. $\square$

Thus, in addition to tables and formulas, sequences can be defined recursively, i.e., the next term is found from the current term (or several previous terms) by a formula.

Definition. A sequence given by $$a_{n+1}=a_n+ b$$ is called an arithmetic progression with $b$ its increment.

Example. A more typical is the following situation. A person deposits $\$ 1000$in his bank account. Suppose the account pays$1\%$APR compounded annually. Then, after the first year, the accumulated interest is $$\1000\cdot.01=\ 10,$$ and the total amount becomes$\$1010$. After the second year we have the interest: $$\1010\cdot .01=\ 10.10,$$ and so on. In other words, the total amount is multiplied by $.01$ at the end of each year and then added to the total. An even simpler way to put this is to say that the total amount is multiplied by $1.01$ at the end of each year. Now if $a_n$ is the amount in the bank account after $n$ years, then we have a recursive formula: $$a_{n+1}=a_n\cdot 1.01.$$ For the spreadsheet, the formula is: $$\texttt{=R[-1]C*1.01}.$$

It is easy to derive the $n$th term formula though: $$a_{n+1}=1000\cdot 1.01^n.$$ Only after repeating the step $100$ times one can see that this isn't just a straight line:

$\square$

Definition. A sequence given by $$a_{n+1}=a_n\cdot r,$$ with $r\ne 0$, is called a geometric progression with $r$ its ratio.

Example. This time the multiple varies... Define a sequence recursively: $$a_1=1,\ a_n=a_{n-1}\cdot n.$$ Then, $$a_n=1\cdot 2 \cdot ... \cdot (n-1)\cdot n .$$ The result is called the factorial of $n$ and is denoted by $$n!=1\cdot 2 \cdot ... \cdot (n-1)\cdot n.$$ It exhibits a very fast frowth:

$\square$

Example. Define a sequence recursively: $$a_{n+1}=ra_n(1-a_n),$$ where $r>0$ is a parameter. For the spreadsheet, the formula is: $$\texttt{=R2C2*R[-1]C*(1-R[-1]C)},$$ where $\texttt{R2C2}$ contains the value of $r$. For example, this is what we have for $r=3.9$ (here $a_1=.5$):

The sequence is called the logistic sequence. Its dynamics dramatically depends on $r$:

$\square$

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

A simple question we may ask about our function $F$ from the set $X$ of boys and the set of balls $Y$ 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.

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 codomain of $F$ we have a new, and different, function $G:X\to V$.

Now numerical functions...

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.

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\}$.

Theorem. The range of a quadratic polynomial $y=ax^2+bx+c$ is a closed ray:

• $V=[m,+\infty)$ when $a>0$, and
• $V=(-\infty,M]$ when $a<0$,

where $m$ and $M$ are the minimum and the maximum values of the function respectively.

To find the range of a numerical functions the graph of which is supplied, we simply draw a horizontal line through every point on the graph and note where it crosses the $y$-axis.

As you can see, the maximum/minimum of a function is the the maximum/minimum of its range.

The maximum/minimum point doesn't have to be unique:

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:

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 pre-image 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\}.$$

We carry out this computation for every ball and discover that the preimage of baseball is the empty set.