Given two sets and , a function from to maps each value in to exactly one value in .
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 a 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 from a domain to a codomain , notated
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 (read " of ") to specify the value returned by a function given an argument . Suppose that maps to . Then one conventionally writes
Many functions, particularly functions on the real numbers, can easily be specified with this notation. For instance,
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:
For negative , is given by , whereas for nonnegative .
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 image or range of a function is the set of all such that for some .
For , determine the image of the function
For all , . Furthermore, for all nonnegative , there exists some namely such that . Therefore, the image is , sometimes also notated as
Consider a two special properties of functions.
A function is said to be surjective or onto if is the range of , i.e. codomain = range.
is injective or one-to-one if for all such that .
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:
is bijective if it is injective and surjective. is said to be a bijection between and
Given , is bijective while is neither injective nor surjective.
A function is odd if it is symmetric with respect to rotation. Any odd function must satisfy
The function specified by is even while is odd.
A function can also display periodic symmetry. A function that repeats infinitely for a given fixed distance along the -axis is said to be a periodic function, with the fixed distance called the period.
A function is periodic if
for all for some nonzero . The smallest positive for which is periodic is the primitive period of the function.
The word "period" alone is often used to refer to the primitive period.
Because the sine function repeats every radians that is, , it has a period of .
Suppose that 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
More specifically, if were not surjective, then the codomain of could not be the domain of the inverse. Likewise, if were not injective, the inverse would map some elements in the codomain of to more than one element in the domain of , and the inverse would not be a function. Therefore, must be bijective for the inverse map to be a function.
Suppose that is bijective with
for all and . Then the inverse function of is given by such that
The inverse of is often notated with a superscript as . Any function that is its own inverse i.e. 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 by restricting the domain of the periodic function.
In the case of the sine function, the convention is to define the inverse sine function as the inverse of the sine function restricted over the domain , in which case the inverse ends up with an image of and a domain of .
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
where , , and can each be considered as functions.
what is the value
We know that
Sometimes it also makes sense to consider what happens when two functions are applied in succession. Given two functions and , the function that maps to is called the composition of with and notated with the open circle as . Note that the composition is well defined if and only if the image of is a subset of the domain of .
Consider the functions and given by and . What is
Usually, if the image of is not a subset of the domain of to begin with, one restricts the domain of such that the image of becomes a subset of the domain of .
Consider the functions given by , and given by . Define on a suitable domain.
The image of is all real numbers, which is not a subset of the domain of . Hence, we have to restrict the domain of . We require that , or that , which implies .
On this restricted domain, we have .
A function can certainly be composed with itself. Iterated composition is usually notated by , where is the number of times is evaluated:
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
where and are given explicitly. In such a case, the solution for can be determined by evaluating both sides at . Then
If , then what is
Set then . Substitute this into to get Hence
More sophisticated functional equations may specify something of the form
the so-called Cauchy (functional) equation. Likewise, one may have
Such equations are much more difficult to solve. There are several general approaches, but note that not all functional equations have closed-form solutions.