Lecture 06 Part 3
Functions
Functions
We will now look at a special type of relation - functions. According to many mathematicians including Derbyshire[1], functions are the second or third most important objects in mathematics after numbers and sets. We will try to answer the question: What makes a function? And then, we will look at a few examples and their applications in the modern world.
It is best to imagine a function to be like a machine because they work in exactly the same principle. We feed something into the machine, we call this the input, then the machine processes it in order to produce what we call the output.
INPUT
(c) G. Giacaglia | Towards Data Science
OUTPUT
If we denote the function by f, the input by x, and the output by y, then we write
There are conventional mathematical terms for inputs and outputs in a function. The input, x, is called the pre-image while the output, y, is called the image. We read the notation as "f of x is y" or "f maps x to y". In fact, in other branches of mathematics, functions are interpreted as mappings.
For this example, we have
A function maps the set of pre-images (called the domain) into a set where the images are found (called the codomain). In some cases, not all elements in the codomain have a pre-image. The set of all images (which is just a subset of the codomain) is called the range.
If we look at it, a function is just like a relation. It pairs two elements from two different sets. However, not all relations are functions. In fact, there are two specific properties that a function must satisfy:
every element in the domain must have an image (that is, every element in the domain is a pre-image);
every pre-image has exactly one image.
Trained students in mathematics would just simplify both conditions into one: every element in the domain has exactly one image.
function
not a function
not a function
In this lecture, we will restrict our coverage only to algebraic functions. The following is an example of a linear function which is one of the most basic types of algebraic functions.
So when x = 1,
So the input is 1, the output is 3, and the process (or relationship between the input and the output) is 2x + 1.
Exercise. Let f(x) = x² - 2x + 1. Evaluate the function for the following values of x.
Just like numbers, we can also operate functions. We can add, subtract, multiply, and divide them. There is also another operation on functions called composition which we will introduce later.
If f(x) and g(x) are two functions, then
For example,
So if we are to find (f + g)(3), we have
If f(x) and g(x) are two functions, then
For example,
So if we are to find (f - g)(-1), we have
If f(x) and g(x) are two functions, then
For example,
So if we are to find (f g)(-1), we have
If f(x) and g(x) are two functions, then
For example,
So if we are to find (f /g)(2), we have
The last operation on functions we will be learning is composition denoted by ○. When we have (f ○ g) we read it as "the composite function f of g". It is defined by
Hence, we can also read the composite function as "f of g of x". Here, g(x) is called the inner function while f(x) is called the outer function. By this definition, in order to evaluate (f ○ g)(x) we simply have to plugin g(x) into the "x" in f(x). For example, if
Question. Is f ○ g = g ○ f?
Exercise. Let f(x) = 3x + 2 and g(x) = x² + 2x + 1. Find the following functions and evaluate at x = 2.
[1] MathisFun. What is a function? from https://www.mathsisfun.com/sets/function.html