# Functions

Given two sets \( X \) and \( Y \), a **function** from \( X \) to \( Y \) maps each value in \( X \) to exactly one value in \( Y \).

#### Contents

## Basic Concepts

A **function** can be thought of as a "machine" that provides exactly one output for each valid input. Many important relationships can be thought of in terms of functions:

- In the market for peanuts, the quantity demanded and quantity supplied might each be described as simple function of the price of a pound of peanuts. These functions are respectively called the demand and supply curves.
- At each point in time, a baseball exists at exactly one point in space. Therefore, the position of the baseball can be described as a function of the time elapsed after leaving the pitcher's hand. This function is called the trajectory of the baseball.
- Suppose that every combination of keys pressed in a video game triggers a combo. The key bindings can be said to be a function that maps the keys pressed to the combo triggered.

For every function, there exists a set of inputs called the **domain** and a set of outputs called the **codomain**. Mathematically, a function is defined as a **map** that associates each element in the domain (an *argument* of the function) with exactly one element in the codomain.

A

function\( f \) from adomain\( X \) to acodomain\( Y \), notated \[ f: X \rightarrow Y, \] is a map that maps every element in the domain to exactly one element in the codomain.

Euler was the first to use the modern notation \( f(x) \) (read "\( f \) of \( x \)") to specify the value returned by a function \( f \) given an argument \( x \). Suppose that \( f \) maps \( x \in X \) to \( y \in Y \). Then one conventionally writes

\[ y = f(x). \]

Many functions, particularly functions on the real numbers, can easily be specified with this notation. For instance,

\[ f(x) = x^2, \]

taken over the domain of the real numbers, specifies the function that maps a real number to its square. Generally, one assumes that the domain and codomain of a function are the real (or complex) numbers unless otherwise specified.

One can also specify a piecewise function with braces:

\[f(x) = \left\{ \begin{array}{ll} x & &\text{if } x < 0\\ x^2 & &\text{if } x \ge 0. \end{array} \right. \]

For negative \( x \), \( f (x) \) is given by \( x \), whereas \( f(x) = x^2 \) for nonnegative \( x \).

Of course, a function need not map to every element in the codomain: the trivial function simply maps every element in the domain to the same element in the codomain. A more interesting and restrictive set is the subset of the codomain all of whose elements are mapped to by the function. This set is called the **image** or **range** of the function.

The

imageorrangeof a function \( f: X \rightarrow Y \) is the set of all \( y \in Y \) such that \( y = f(x) \) for some \( x \in X \).

For \( f: \mathbb{R} \rightarrow \mathbb{R} \), determine the image of the function \( f(x) = x^2. \)

For all \( x \in \mathbb{R} \), \( x^2 \geq 0 \). Furthermore, for all nonnegative \( y \), there exists some \( x \in \mathbb{R} \) \((\)namely \( \sqrt{y}) \) such that \( y = x^2 \). Therefore, the image is \( [0, \infty) \), sometimes also notated as \( \mathbb{R}^+. \) \(_\square\)

## Special Properties of Functions

Consider a two special properties of functions.

A function \( f: X \rightarrow Y \) is said to be

surjectiveorontoif \( Y \) is the range of \( f \), i.e. codomain = range.\( f \) is

injectiveorone-to-oneif \( f(x_1) \neq f(x_2) \) for all \( x_1, x_2 \in X \) such that \( x_1 \neq x_2 \).

In other words, a function is *surjective* if every element in its codomain is mapped to:

It is *injective* if no element in its domain maps to the same element in the codomain:

A function that is both *injective* and *surjective* is said to be **bijective**. With such a function, there is a *one-to-one correspondence* between every element in the codomain and every element in the domain:

\( f: X \rightarrow Y \) is

bijectiveif it isinjectiveandsurjective. \( f \) is said to be abijectionbetween \( X \) and \( Y. \)

Given \( f: \mathbb{R} \rightarrow \mathbb{R} \), \( f(x) = x \) is bijective while \( f(x) = x^2 \) is neither injective nor surjective.

## Symmetry of Functions

Functions can possess some degree of symmetry. A function is said to be **even** if it is symmetric with respect to reflection about the \( y \)-axis. Any even function \( f \) must satisfy \( f(x) = f(-x). \)

A function is **odd** if it is symmetric with respect to \( 180^\circ \) rotation. Any odd function \( f \) must satisfy \( f(x) = -f(-x). \)

The function specified by \( f(x) = x^2 \) is even while \( f(x) = x^3 \) is odd.

A function can also display **periodic** symmetry. A function that repeats infinitely for a given fixed distance along the \( x \)-axis is said to be a **periodic function**, with the fixed distance called the **period**.

A function \( f \) is periodic if

\[ f(x) = f(x + T) \]

for all \( x \) for some nonzero \( T \). The smallest positive \( T \) for which \( f \) is periodic is the

primitive periodof the function.

The word "period" alone is often used to refer to the primitive period.

Because the sine function repeats every \( 2\pi \) radians \(\big(\)that is, \( \sin{x} = \sin(x + 2\pi)\big) \), it has a period of \( 2\pi \).

## Inverse Functions

Suppose that \( f: X \rightarrow Y \) is bijective. Since a one-to-one correspondence exists between each element of the domain and codomain, it is possible to "invert" the map—that is, send each element of the codomain to its corresponding element in the domain—and end up with a function. Such a function is an **inverse** of \( f .\)

More specifically, if \( f \) were not surjective, then the codomain of \( f \) could not be the domain of the inverse. Likewise, if \( f \) were not injective, the inverse would map each element in the codomain of \( f \) to more than one element in the domain of \( f \), and the inverse would not be a function. Therefore, \( f \) must be bijective for the inverse map to be a function.

Suppose that \( f: X \rightarrow Y \) is bijective with

\[ y = f(x) \]

for all \( x \in X \) and \( y \in Y \). Then the

inverse functionof \( f \) is given by \( g: Y \rightarrow X \) such that\[ x = g(y). \]

The inverse of \( f \) is often notated with a superscript as \( f^{-1} \). Any function that is its own inverse \(\big(\)i.e. \( f = f^{-1}\big) \) is called an **involution**.

Since they are not injective, the trigonometric functions do not, strictly speaking, have inverse

functions; each element in the image of a trigonometric function corresponds to infinitely many elements in the domain due to the periodicity of the function, so the inverse mapping is not a function. However, in many cases, one can obtain an inverse function for a periodic function byrestricting the domainof the periodic function.In the case of the sine function, the convention is to define the

inverse sine functionas the inverse of the sine function restricted over the domain \( \left[-\frac{\pi}{2}, \frac{\pi}{2}\right] \), in which case the inverse ends up with an image of \( \left[-\frac{\pi}{2}, \frac{\pi}{2}\right] \) and a domain of \( [-1, 1] \).

## Function Arithmetic and Composition

Oftentimes, one will wish to consider the sum, difference, or product of two functions with the same argument. Such "arithmetic" with functions results in a new function if both functions have the same domain or if care is taken to restrict the domain of the sum, difference, or product to the intersection of the domain of the two functions. In such cases, one can write

\[ \begin{align} (f+g)(x) &= f(x) + g(x) \\ (f-g)(x) &= f(x) - g(x) \\ (f \cdot g)(x) &= f(x) \cdot g(x), \end{align} \]

where \( f + g \), \( f - g \), and \( f \cdot g \) can each be considered as functions.

Given

\[\begin{align} f(x)&=4{ x }^{ 3 }-5\\ g(x)&=6{ x }^{ 2 }+9\\ h(x)&=(f\cdot g)(x), \end{align}\]

what is the value \(h(3)?\)

We know that

\[\\ h(3)=(f\cdot g)(3)=f(3)\cdot g(3).\]

Since \(f(3)=4(3)^{3}-5=103\) and \(g(3)=6(3)^{2}+9=63,\)

\[\begin{align} h(3)&=f(3)\cdot g(3)\\ &=103\times 63\\ &=6489.\ _\square \end{align}\]

**composition**of \( f \) with \( g \) and notated with the open circle as \( f \circ g \). Note that the composition is well defined if and only if the image of \( g \) is a subset of the domain of \( f \).

Consider the functions \( f: \mathbb{R} \rightarrow \mathbb{R} \) and \( g: \mathbb{R} \rightarrow \mathbb{R} \) given by \( f(x) = x^2 + 2x \) and \( g(x) = x+1\). What is \( f \circ g (x) \)?

We have

\[ f \circ g (x) = f ( x+1) = (x+1)^2 + 2(x+1) = x^2 + 2x + 1 + 2x + 2 = x^2 + 4x + 3.\ _\square \]

Usually, if the image of \( g \) is *not* a subset of the domain of \( f \) to begin with, one restricts the domain of \( g \) such that the image of \( g \) becomes a subset of the domain of \( f \).

Consider the functions \( f: [0,1] \rightarrow [1,2] \) given by \( f(x) = x+1 \), and \( g: \mathbb{R} \rightarrow \mathbb{R} \) given by \( g(x) = x - 1 \). Define \( f \circ g \) on a suitable domain.

The image of \(g(x) \) is all real numbers, which is not a subset of the domain of \( f(x) \). Hence, we have to restrict the domain of \(g(x) \). We require that \( 0 \leq g(x) \leq 1 \), or that \( 0 \leq x-1 \leq 1 \), which implies \( 1 \leq x \leq 2 \).

On this restricted domain, we have \( f \circ g(x) = f ( x-1) = x-1 + 1 = x \).

Hence, \( f \circ g : [1,2] \rightarrow [1,2], f \circ g (x) = x \). \(_\square\)

A function can certainly be composed with itself. **Iterated composition** is usually notated by \( f^n \), where \( n \) is the number of times \( f \) is evaluated:

\[ f^n = \underbrace{ f \circ f \circ \ldots \circ f }_{n \text{ times}}.\]

## Functional Equations

Many of the trickiest problems involving functions come in the form of **functional equations**, equations that specify the form of a function only implicitly. The goal is generally to obtain the closed form of an undetermined function.

Some functional equations are relatively easy to solve. For instance, an equation may be of the form

\[ f\big(g(x)\big) = h(x), \]

where \( g \) and \( h \) are given explicitly. In such a case, the solution for \( f \) can be determined by evaluating both sides at \( g^{-1}(x) \). Then

\[ f\Big(g\big(g^{-1}(x)\big)\Big) = h\big(g^{-1}(x)\big), \]

so \( f(x) = h\big(g^{-1}(x)\big). \)

If \(f(x+3)=x^2+8x+16\), then what is \(f(x)\)?

Set \(y=x+3,\) then \(x=y-3\). Substitute this into \(f(x+3)=x^2+8x+16\) to get \(f(y)=y^2+2y+1.\) Hence \( f(x) = x^2 + 2x + 1 = (x+1)^2. \) \(_\square\)

More sophisticated functional equations may specify something of the form

\[ f(x + y) = f(x) + f(y), \]

the so-called *Cauchy (functional) equation*. Likewise, one may have

\[ f(xy) = f(x) + f(y) \]

or even

\[ f(x^2 + y) = f\left(\frac{x}{x + y^2}\right) f(y^2). \]

Such equations are much more difficult to solve. There are several general approaches, but note that not all functional equations have closed-form solutions.