- Unknown things are often written using x, y, or z.
- Known things are often written using a, b, or c.
- Functions are often written using f, g, or h.
A function is an abstraction. Just as using a variable lets you talk about an unknown value in an equation:
x2 + 2 = 6
x2+ y = 7
using a function lets you generalize about mathematical operations:
The actual mathematical operation doesn’t matter because all functions have certain properties and behaviours in common. Besides, it is a lot easier to write f(x) than some long equation.
In mathematical terms:
A function f is a mapping from the set A to the set B, where set A is called the domain and set B is called the codomain.
It is written as f : A → B.
This simply means that a function
- takes things found in A (the domain)
- does something to them
- and returns things found in B (the codomain)
There is no restriction on what sets A and B are. They could be
- a set of integers,
- a set of real numbers
- a set of functions returning positive integers
- a set of convex polygons
- a set of two dimensional data representing images
They don’t even have to be the same sets – the codomain can be different from the domain.
The only restriction is that there can only be one mapping from A to B. In other words, every single item in the set A, when processed by the function, can only map to a single item from the set B. Although, multiple items in A can map to the same item in B.
For example, given
f(x) = √x
- If the domain is the set of positive real numbers (i.e. all numbers greater than 0) and if the codomain is the set of all positive real numbers, then f(x) is a function.
- If the domain is the set of positive real numbers and if the codomain is the set of all real numbers (both positive and negative), then f(x) is not a function (hint, √4 can be 2 or –2).
If we are given
f(x) = x – x
then no matter what the domain is, the codomain is always the set containing 0. Therefore, every element in the domain (set A) maps to exactly one element in the codomain (set B). They just all happen to map to the same element.
Given this restriction, our mathematical definition now looks like this:
A function f is a mapping from the set A to the set B, such that each element of A maps to exactly one element in B. Set A is called the domain and set B is called the codomain.
It is written as f : A → B.
Functions can be referred to by just a letter – f being the most common.
You can have a whole bunch of functions and refer to them as f1, f2, f3, … fn.
Functions can be written with parameters – f(x) being common. It should be read as “the value of x being evaluated / processed by the function f”.
Functions can have a whole bunch of parameters:
f(x, y, z, w)
f(x1, x2, … xn)
The function can be defined for you:
f(x) = x2 + 3x + 2
It can also be defined in terms of other functions:
g(x, y) = ∫∫f(x,y)
(Here, g(x, y) is being defined as the double integration of function f(x, y))