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

# Functions

### From Mathematics Is A Science

## Contents

## 1 Sets, relations, and functions

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! Its members are called *elements*.

We will call this set $X$. For **notation**, we use a simple list (in any order) in braces:
$$\begin{array}{lll}
X&=\{\text{ Tom }, \text{ Ken }, \text{ Sid }, \text{ Ned }, \text{ Ben }\}\\
&=\{\text{ Ned }, \text{ Ken }, \text{ Tom }, \text{ Ben }, \text{ Sid }\}\\
&=\ ...
\end{array}$$

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:
$$\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 are called *subsets* of $X$. We will use the following **notation**:
$$T\subset X,\ K\subset X,\ A\subset X,\ Q\subset X,\ ...$$

Suppose there is another set, $Y$, a set of balls:

Once again, this set 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...

Each boy may be interested in a particular sport or he may not. Let's connect each boy with the corresponding ball:

This is called a *relation*. Let's call it $R$. Note that a relation is a two-sided correspondence: neither of the two sets comes first or second. An element of neither set has to have a corresponding element in the other.

Let's make a table for $R$: 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*. The marks remain the same!

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

Let's now take the point of view of the boys. This time, we assume that every boy likes a sport but just one!

This is a special kind of relation called a *function*. The two sets aren't treated equally anymore! In fact, this is the common **notation** for a function *from* set $X$ *to* set $Y$:
$$F:X\to Y.$$

The arrows clearly identify the *inputs* of this function as the starting points of the arrows and the *outputs* as the endings of the arrows. Then, the table of this kind of relation must have exactly one mark in each row:

As a result we can write the function as a list of inputs and their outputs (right) using this **notation**:
$$F(x)=y.$$
In other words, we have:
$$F(\text{ input })=\text{ output }.$$
We can simply *list* the values as follows:
$$\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 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:
$$F(\text{ boy })=\text{ basketball }.$$
It's an *equation*! Indeed, we need to find the inputs that, under $F$, produce this output.

These are the possible questions of this kind:

- 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 provided 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 is always a set (a subset of the domain) 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.

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

**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 *domain*, exactly one element $y$, **denoted** by:
$$y=F(x),$$
in another set $Y$. The latter set is called the *co-domain*.

This definition fails for a relation when there are too few or too many arrows for a given $x$. Below, we illustrate how the two requirements may be violated, in the domain:

These are *not* functions. Meanwhile, we also see what shouldn't be regarded as violations, in the co-domain.

**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 simple algebra.

## 2 How numerical sets emerge...

As we have seen, they may 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+2x+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$.

How do we *visualize* these numbers and these sets?

In order to visualize particular numbers, we first consider the set of *all* numbers. We arrange them in a *line*. This 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 (in the middle) 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.

Note that 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. What if the set if infinite? For example, the number line won't fit on a piece of paper and we have use our imagination...

**Example.** Let's visualize these intervals: $[0,1],\ [0,\infty),\ (-\infty,0),$ etc.

$\square$

## 3 How numerical relations and functions 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.

*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 $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 relation of one variable on the other -- is called 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 have 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 are involved. Calculus will help...

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

## 5 Implicit relations and curves

We have already seen a few examples of relations that represent the following:

- horizontal lines: $y=c$;
- vertical lines: $x=a$.

There are more relations represented by * straight lines*.

A relation processes a pair of numbers $(x,y)$ as the input and produces an output, which is: 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}{ccccccccccccccc} \text{input} & & \text{relation} & & \text{output} \\ (x,y) & \mapsto & \begin{array}{|c|}\hline\quad x+y=2? \quad \\ \hline\end{array} & \ra{Yes} & \text{ plot } (x,y)\\ &&\downarrow ^{No}\\ &&\text{ don't plot } \end{array}$$ We can do it by hand:

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

**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,
$$Ax+By=C,$$
with either $A$ or $B$ not equal to zero is a 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* 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}.$$

Let's consider a more complex idea. Imagine an object moving along a curve and its $x$-coordinate is recorded by one person and its $y$-coordinate by another:

As the two compare their notes, a relation emerges.

**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}{ccccccccccccccc}
\text{input} & & \text{relation} & & \text{output} \\
(x,y) & \mapsto & \begin{array}{|c|}\hline\quad x^2+y^2=1? \quad \\ \hline\end{array} & \ra{Yes} & \text{ plot } (x,y)\\
&&\downarrow ^{No}\\
&&\text{ don't plot }
\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. Indeed, $x^2+y^2$ is the square of the distance from $(x,y)$ to the origin. It's not a function. $\square$

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

**Theorem.** The circle of radius $r>0$ centered at point $(h,k)$, which is the set of points $r$ units away from $(h,k)$, is given by the relation:
$$(x-h)^2+(y-k)^2=r^2.$$

**Proof.** It follows from the *Distance Formula*. $\blacksquare$

These curves are given by equations $xy=1$, etc. They are called *hyperbolas*:

These curves are given by equations $y=x^2$, etc. They are called *parabolas*:

Even with a computer, this is like looking for a needle in a haystack. Functions allow us to produce “allowed” pairs $(x,y)$ automatically, without needing to test each of them. Simply plug in a value, $x$, and the function will produce its mate, $y$.

## 6 Functions: explicit relations

Functions can be illustrated as flowcharts:

$$ \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. An algebraic representation of the process is: $$y=x+3,\quad z=y\cdot 2,\quad u=z^2.$$

In general, we represent a function diagrammatically as a *black 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 this example, we use a letter to indicate an *abstract* function while in the examples below functions may be *specific* with specific names:
$$\sqrt{(\quad)},\ \exp (\quad ),\ \sin (\quad ),\ \text{ etc.}$$

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

- an algebraic formula or formulas;
- a table of values;
- a graph;
- an algorithm.

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

Moreover, “piece-wise defined functions” are defined by several formulas at the same time. The most important one is the following.

**Definition.** The *absolute value function*
$$f(x) = |x|$$
is computed as follows:

- if $x < 0$ then $y = - x$; and
- if $x \geq 0$ then $y = x$.

We can re-write this algebraically as $$ f(x) = \begin{cases} -x & \text{ if } x < 0, \\ x & \text{ if } x \geq 0. \end{cases} $$

A frequently used property of the absolute value function is the following.

**Theorem (Triangle Inequality).** For any two numbers $a,b$, we have:
$$|a+b|\le |a|+|b|.$$

**Proof.** $\blacksquare$

The name of the theorem comes from a similar property of the lengths of the sides of a triangle $a,b,c$: $$|c|<|a|+|b|.$$

When the triangle degenerates into a segment, we have the triangle inequality for numbers.

Another important piece-wise defined function is the following.

**Definition.** The *integer value function*
$$f(x) = [x]$$
is defined as the largest integer less than or equal to $x$.

For example, $$[5]=5,\ [3.1]=[3.99]=3,\ [-4.1]=-5.$$

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}$$
This is a numerical representation as the table contains only numbers. Any table would do as long as there are no repetitions in the $x$-column!

To create larger tables, 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 table 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 table is not.

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 table data to plot points, which leads us to the graphical representation.

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

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

Meanwhile, spreadsheet software comes with graphic capabilities. It 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:

*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 do:
$$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*.

**Example.** Let
$$y = f(x) = |x|.$$
Given an input of $x$, describe a procedure for computing this function.

Alternative to the definition given above, we have for a given $x$:

- Step 1: determine the sign, $s=\operatorname{sign}(x)$, of $x$: if $x \geq 0$, then $s = 1$; else $s = -1$;
- Step 2: multiply $x$ by $s$.

We can express this numerically: $$\begin{array}{r|ll} x&y=|x|\\ \hline -3&3\\ -2&2&\text{ decreasing?}\\ -1&1&\text{ decreasing?}\\ 0&0\\ 1&1&\text{ increasing?}\\ 2&2&\text{ increasing?}\\ 3&3\\ \end{array}$$

We do notice some patterns but we would need more points to be sure of the trends. In that case, we can plot all those points and then possibly connect them into a single curve:

$\square$

**Example.** Let
$$y = f(x) = [x].$$
Given an input of $x$, describe a procedure for computing this function.

Alternative to the definition given above, we have for a given $x$:

- Step 1: determine whether $x$ is integer or not
- Step 2: if $x$ is an integer, then set $y=x$; else decrease from $x$ until meet an integer, set $y$ equal that integer.

We can test this numerically: $$\begin{array}{r|ll} x&y=|x|\\ \hline -3&-3\\ -2&-2&\text{ increasing?}\\ -1&-1&\text{ increasing?}\\ 0&0&\text{ increasing?}\\ 1&1&\text{ increasing?}\\ 2&2&\text{ increasing?}\\ 3&3&\text{ increasing?} \end{array}$$

We do notice some patterns but we would need more points to be sure of the trends: $$\begin{array}{r|ll} x&y=|x|\\ \hline -1.5&-2\\ -1&-1&\text{ }\\ -.5&-1&\text{ constant?}\\ 0&0&\text{ }\\ .5&0&\text{ constant?}\\ 1&1&\text{ }\\ 1.5&1&\text{ constant?} \end{array}$$

In that case, we can plot all those points and then possibly connect them into a single(?) curve:

$\square$

**Definition.** A (numerical) *function* is a rule or procedure $f$ that assigns to any number $x$ in a set $D$, called the *domain*, one number $y$ in another set of real numbers $E$. The latter is sometimes called the *co-domain* of $f$.

In other words,

- each $x$ in $D$ has a counterpart in $E$, and
- 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} .$$

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: $$D_1 = ( - \infty, 0 ) \cup ( 0, +\infty). $$

What about $$D_{2} = (0, \infty )?$$ It is also a valid choice.

The domain may be also $$D_3 = [1,2].$$ $\square$

What is the advantage of one domain over another?

**Definition.** The largest possible domain for a given formula is called the *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 the 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$ Graphical:

$\bullet$ Algorithmic:

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

Then we might face these outcomes: $$\begin{array}{lll} x = 10 &\Longrightarrow &y = 20, \\ &&y = 21, \\ &&y = 22. \end{array} $$

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

**Example.** $\square$

## 7 The graph of a function

Graph are especially important.

Where in the graph is the *black 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}$$

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

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

The *integer value function*
$$f(x) = [x]$$
is defined as the largest integer less than or equal to $x$.

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:

**Example.** Let
$$y = f(x) = [x].$$
Given an input of $x$, describe a procedure for computing this function.

$$\begin{array}{r|ll} x&y=|x|\\ \hline -1.5&-2\\ -1&-1&\text{ }\\ -.5&-1&\text{ constant?}\\ 0&0&\text{ }\\ .5&0&\text{ constant?}\\ 1&1&\text{ }\\ 1.5&1&\text{ constant?} \end{array}$$

$\square$

## 8 Elementary functions

A *linear functions* 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}$$

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 functions according to their slopes:

Monotonicity of linear functions 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.

A *quadratic functions* 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.

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

## 9 Monotonicity

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

Things get harder for quadratic, cubic,... functions as they lead to quadratic, cubic, ... inequalities.

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

## 10 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$$
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$