$$ \newcommand{\RR}{\mathbb{R}} \newcommand{\QQ}{\mathbb{Q}} \newcommand{\CC}{\mathbb{C}} \newcommand{\NN}{\mathbb{N}} \newcommand{\ZZ}{\mathbb{Z}} \newcommand{\FF}{\mathbb{F}} \renewcommand{\epsilon}{\varepsilon} % ALTERNATE VERSIONS % \newcommand{\uppersum}[1]{{\textstyle\sum^+_{#1}}} % \newcommand{\lowersum}[1]{{\textstyle\sum^-_{#1}}} % \newcommand{\upperint}[1]{{\textstyle\smallint^+_{#1}}} % \newcommand{\lowerint}[1]{{\textstyle\smallint^-_{#1}}} % \newcommand{\rsum}[1]{{\textstyle\sum_{#1}}} \newcommand{\uppersum}[1]{U_{#1}} \newcommand{\lowersum}[1]{L_{#1}} \newcommand{\upperint}[1]{U_{#1}} \newcommand{\lowerint}[1]{L_{#1}} \newcommand{\rsum}[1]{{\textstyle\sum_{#1}}} % extra auxiliary and additional topic/proof \newcommand{\extopic}{\bigstar} \newcommand{\auxtopic}{\blacklozenge} \newcommand{\additional}{\oplus} \newcommand{\partitions}[1]{\mathcal{P}_{#1}} \newcommand{\sampleset}[1]{\mathcal{S}_{#1}} \newcommand{\erf}{\operatorname{erf}} $$

5  Functions

Highlights of this Chapter: we briefly explore the evolution of the modern conception of a function, and give foundational definitions for reference.

5.1 Freedom from Formulas

The term function was first introduced to mathematics by Leibniz during his development of the Calculus in the 1670s (he also introduced the idea of parameters and constants familiar in calculus courses to this day). In the first centuries of its mathematical life, the term function usually denoted what we would think of today as a formula or algebraic expression. For example, Euler’s definition of function from his 1748 book Introductio in analysin infinitorum embodies the sentiment:

A function of a variable quantity is an analytic expression composed in any way whatsoever of the variable quantity and numbers or constant quantities.

As a first step to adding functions to our theory of real analysis, we would somehow like to make this definition rigorous. But upon closer inspection, this concept, of “something expressible by a (single) analytic expression” is actually logically incoherent! For example, say that we decide, after looking at the definition of \(|x|\), that it cannot be a function as it is not expressed as a single formula:

\[|x|=\begin{cases} -x & x\leq 0 \\ x & x>0 \end{cases} \]

But we also agree that \(x^2\) and \(\sqrt{x}\) are both (obviously!) functions as they are given by nice algebraic expressions. What are we then to make of the fact that for all real numbers \(x\),

\[\sqrt{x^2}=|x|\]

It seems we have found a perfectly good “single algebraic expression” for the absolute value after all! This even happens for functions with infinitely many pieces (which surely would have been horrible back then) \[f(x)=\begin{cases} \vdots &\vdots\\ 3+\sin(x) & x\in(0,\pi]\\ 1+\sin(x) & x\in(\pi,2\pi]\\ 3+\sin(x) & x\in(2\pi,3\pi]\\ \vdots &\vdots \end{cases} \]

This can be written as a composition involving just one piecewise function \[f(x)=|1+\sin x|+2\]

Which can, by the earlier trick, be reduced to a function with no “pieces” at all:

\[f(x)=2+\sqrt{1+2\sin(x)+\sin^2(x)}\]

So the idea of “different pieces” or different rules, seemingly so clear to us, is not a good mathematical notion at all! We are forced by logic to include such things, whether we aimed to or not. This became clear rather quickly, as even Euler had altered a bit his notion of functions by 1755:

When certain quantities depend on others in such a way that they undergo a change when the latter change, then the first are called functions of the second. This name has an extremely broad character; it encompasses all the ways in which one quantity can be determined in terms of others.

The modern approach is to be much more open minded about functions, and define a function as any rule whatsoever which uniquely specifies an output given an input. This seems to have first been clearly articulated by Lobachevsky (of hyperbolic geometry fame) in 1834, and independently by Dirichlet in 1837

The general concept of a function requires that a function of x be defined as a number given for each x and varying gradually with x. The value of the function can be given either by an analytic expression, or by a condition that provides a means of examining all numbers and choosing one of them; or finally the dependence may exist but remain unknown. (Lobachevsky)

If now a unique finite \(y\) corresponding to each \(x\), and moreover in such a way that when \(x\) ranges continuously over the interval from \(a\)$ to \(b\), \(y=f(x)\) also varies continuously, then \(y\) is called a continuous function of x for this interval. It is not at all necessary here that \(y\) be given in terms of \(x\) by one and the same law throughout the entire interval, and it is not necessary that it be regarded as a dependence expressed using mathematical operations. (Dirichlet)

Through this definitions added generality comes simplicity: we are not trying to police what sort of rules can be used to define a function, and so the notion can be efficiently captured in the language of sets and logic.

Definition 5.1 A function from a set \(X\) to a set \(Y\) is an assignment to each element of \(X\) a unique element of \(Y\). If we call the function \(f\), we write the unique element of \(Y\) assigned to \(x\in X\) as \(y=f(x)\), and the entire function as \[f\colon X\to Y\]

The definition of a function comes with three parts, so its good to have precise names for all of these.

Definition 5.2 If \(f\) is a function, its input set \(X\) is called the domain, and the set of possible outputs \(Y\) is called the codomain. The set of actual outputs, that is \(R=\{f(x)\mid x\in X\}\) is called the range.

If the codomain of a function \(f\) is the real numbers, we call \(f\) a real-valued function. We will be most interested in real valued function throughout this course.

5.2 Composition and Inverses

Likely familiar from previous math classes, but it is good to get rigorous definitions down on paper when we are starting anew.

Definition 5.3 (Composition) If \(f\colon X\to Y\) and \(g\colon Y\to Z\) then we may use \(f\) to send an element of \(X\) into \(Y\), and follow it by \(g\) to get an element of \(Z\). The result is a function from \(X\) to \(Z\), known as the composition \[g\circ f\colon X\to Z\hspace{1cm} g\circ f(x):=g(f(x))\]

Every set has a particularly simple function defined on it known as the identity function: \(\mathrm{id}_X\colon X\to X\) is the function that takes each element \(x\in X\) and does nothing: \(\mathrm{id}_X(x)=x\). These play a role in concisely defining inverse functions below:

Definition 5.4 (Inverse Functions) If \(f\colon X\to Y\) is a function, and \(g\colon Y\to X\) is another function such that \[g\circ f = \mathrm{id}_X\hspace{1cm}f\circ g = \mathrm{id}_Y\] Then \(f\) and \(g\) are called inverse functions of one another, and we write \(g=f^{-1}\) if we wish to think of \(g\) as inverting \(f\), or \(f=g^{-1}\) rather we started with \(g\), and think of \(f\) as undoing it.

Example 5.1 The function \(f(x)=2x\) and \(g(x)=x/2\) are inverses of one another as functions \(\RR\to\RR\).

The squaring function \(s\colon \RR\to\RR\) defined by \(s(x)=x^2\) has the square root as an inverse, only if the domain and codomain are restricted to the nonnegative reals. Otherwise, we see that \(s(-2)=4\) and \(\sqrt{4}=2\) so \(\sqrt{}\circ s\) is not the identity: it takes \(-2\) to \(2\)!

5.3 Useful Terminology

Definition 5.5 (Restricting the Domain) Given a function \(f\) with domain \(D\), the restriction to a subset \(S\subset D\) is denoted \(f|_S\).

Definition 5.6 Given a function with a domain \(D\), an extension of \(f\) to a set \(X\supset D\) is a function \(\tilde{f}\colon X\to \RR\) such that \(\tilde{f}|_D=f\).

Definition 5.7 (Increasing / Decreasing) A function \(f\) is (monotone) increasing if for all \(x\leq y\) we have \(f(x)\leq f(y)\). It’s monotone decreasing if instead \(x\leq y\) implies \(f(x)\geq f(y)\). A function is strictly increasing if \(x<y\) impleis \(f(x)<f(y)\), and analogously for strictly decreasing.

Exercise 5.1 If \(f\) is a strictly increasing function, then it is one-to-one: every output \(y\) is achieved by a unique input \(x\).

This exercise implies that strict monotone functions are invertible, as the inverse of any one-to-one function is defined by sending a given \(y\) to the unique \(x\) that maps to it.

Definition 5.8 (Convexity) Let \(f\) be a function defined on some interval (possibly all of \(\RR\)). Then \(f\) is convex if for any interval \([x,y]\subset\mathrm{dom}f\), the value of \(f\) at the midpoint exceeds the average value of \(f\) at the endpoints: \[\forall x,y\hspace{0.5cm}f\left(\frac{x+y}{2}\right)\geq \frac{f(x)+f(y)}{2}\]

A function \(f\) is said to be monotone or convex (etc) on a set \(S\) if the restriction of \(f\) to \(S\) is monotone / convex.

Definition 5.9 (Local Extrema)  

  • Increasing Decreasing
  • Convex
  • Local Extrema

5.4 A Zoo of Examples

Example 5.2 (Polynomial Functions) A polynomial function is an assignment \(p\colon \RR\to\RR\) which takes each \(x\) to a linear combination of powers of \(x\): \[p(x)=a_nx^n+a_{n-1}x^{n-1}+\cdots a_1x+a_0\] The highest power of \(x\) appearing in \(p\) is called the degree of the polynomial.

The idea of a function defined by a formula can be extended even farther by allowing the field operation of division; though this time we must be careful about the inputs.

Example 5.3 (Rational Functions) A rational function is a an assignment \[f(x)=\frac{p(x)}{q(x)}\] where \(p\) and \(q\) are polynomials. Rational functions are real-valued, but their domain is not all of \(\RR\): at any zero of \(q\) the formula above is undefined, a rational function is only defined on the set of points where \(q\) is nonzero.

We already saw that piecewise formulas count in our modern definition, but perhaps didn’t fully think through the implications: they can be very, very piecewise

Example 5.4 (The Characteristic Function of \(\QQ\)) The function \(f\colon\RR\to\RR\) defined as follows \[f(x)=\begin{cases}1 & x\in\QQ \\ 0& x\not\in\QQ\end{cases} \]

Here’s another monstrous piecewise function we will encounter again soon:

Example 5.5 (Thomae’s Function) This is the function \(\tau\colon\RR\to\RR\) defined by

\[ \tau(x)=\begin{cases} \frac{1}{q} & x\in\QQ\textrm{ and }\frac{p}{q}\textrm{ is lowest terms.}\\ 0 &x\not\in\QQ \end{cases} \]

We’ve stressed that functions don’t need to be given by explicit formulas, so we should give an example of that: here’s a function that is defined at each point as a different limit (using the completeness axiom)

Example 5.6 A function may be defined for each \(x\in\RR\) as the limit of a sequence, such as \[E(x)=\lim_{n\to\infty} \sum_{k=0}^n \frac{x^k}{k!}\]

A function can also be defined by a less explicit limit procedure, like the limits defining powers: where we’ve previously seen that any sequence \(r_n\to x\) of rationals converging to \(x\) produces the same limiting value of \(a^{r_n}\).

Example 5.7 (Exponential as Powers) For any \(x\in\RR\) and \(a\geq 0\) the function \(f(x)=a^x\) is defined by \[a^x = \lim_n a^{r_n}\] for \(r_n\) a sequence of rational numbers converging to \(x\).

A function can also be defined by an existence proof telling us that a certain relationship determines a function, without giving us any hint on how to compute its value:

Example 5.8 (\(\sqrt{\cdot}\) defined by an existence theorem) We proved that for every \(x\geq 0\) that there exists some number \(y>0\) with \(y^2=x\), back in our original study of completeness (Theorem 4.9).

We can easily see that such a number is unique: if \(y_1\neq y_2\) then by the order axioms one is greater: without loss of generality \(0<y_1<y_2\). Thus \(y_1^2<y_2^2\), so we can’t have both \(y_1^2=x\) and \(y_2^2=x\), and \(x\to y=\sqrt{x}\) is a function.

Alright - that’s plenty of examples to get ourselves in the right mindset. Let’s give a non-example, to remind us that while there need not be formulas, the modern notion of function is not ‘anything goes’!

Example 5.9 The assignment taking an integer to one of its prime factors does not define a function. This would take the integer \(6\) to both \(2\) and \(3\), and part of the definition of a function is that the output is unique for a given input.

5.5 Problems

Max/Min: describe piecewise, give HW to show it can be written as a formula involving absolute value.

Exercise 5.2 Prove that if \(f\) is convex then for any \(x,y\) in the domain, the the secant line connecting \(f(x)\) to \(f(y)\) lies above the graph of \(f\).

Hint: the equation of secant line is \(L(t)=tf(x)+(1-t)f(y)\): so need to show \(L(t)\geq f(t)\).

Proposition 5.1 If \(f\) is a convex function and \(a\in\RR\) Then for \(x<a\) the function \[\ell(x)=\frac{f(x)-f(a)}{x-a}\] is monotone increasing.

Proof.

The same is true for \(x>a\): on this domain the difference quotient also defines a monotone increasing function (so, its monotone decreasing when going “backwards” towards \(a\)).

Exercise 5.3 (Invertibility implies Monotonicity) Let \(f\) be an invertible function. Prove that \(f\) is (strictly) monotone increasing, or (strictly) monotone decreasing.