6.3 Other ways of defining functions
Polynomial expressions give us a very wide class of functions and these functions have the convenient property that they can be expressed as a single formula. But not all functions are polynomial functions and not all functions can be expressed as a single formula. For example, the graph below has a sudden change of direction at and therefore its corresponding function cannot be expressed as a polynomial22 2 This is related to the fact that polynomials are “smooth”. This is a term you will encounter in your future Analysis courses..
So how do we express the function that corresponds to graphs like this?
6.3.1 Defining a function by cases
A mathematical function defined by cases specifies different formulas or rules for different parts of its domain. These are also known as piecewise functions. Instead of using a single expression, the function is broken into pieces depending on conditions such as inequalities, intervals, or specific values of the input.
Example 6.23.
Consider the function where
This means:
-
•
when , the function outputs ;
-
•
when , the function outputs .
We can sketch this in a graph below:
In general, the structure of a piecewise function is as follows:
The conditions must cover the whole domain of the function and they should not overlap (this is to ensure that each input has a unique output).
Definition 6.24.
The modulus or absolute value function is defined by where
Note that the notation for the modulus function is the same as the notation we used for the cardinality of a set. The way to tell them apart is to identify the type of object that lies between the two vertical lines. If this object represents a real number, then this notation represents the modulus function.
Exercise 6.25.
Consider the function where .
-
1.
Use the definition of the modulus function to re-write as a piecewise function.
-
2.
Sketch the graph of the function .
Solution (please try for yourself before looking)
-
1.
When , . Thus, for this range of , . However, when , which means for this range of . Hence, we can write as
-
2.
A sketch of the graph is as follows:
Exercise 6.26.
The Dirichlet function is defined by the formula
Let be a positive rational number. Prove that is -periodic.
Solution (please try for yourself before looking)
If is a positive rational number, for every and for every (as we saw in Block 1). Hence, for every and for every .
6.3.2 Defining a function in words
Example 6.27.
The integer part function takes a real number as its input and returns the integer part of . (For a definition of the integer part of a real number, see Section 2.1.)
Example 6.28.
The function can be defined by the following process.
Consider the unit circle .
Let be any real number and let denote the straight line that radiates from the origin to form the angle radians anti-clockwise with the positive -axis. The -coordinate of the intersection point between and the unit circle is defined to be the value of .
The function can be defined in a similar way but where the value of the function is given by the -coordinate of the intersection point on the unit circle.
Exercise 6.29.
Assume that each , is written as a product of primes
where each is a non-negative integer, which depends on . Let be defined as .
How do you know that is a function?
Solution (please try for yourself before looking)
This is a function since the Fundamental Theorem of Arithmetic tells us every integer can be written as a product of primes and any prime that doesn’t appear in the prime decomposition of just has a power of 0, which our codomain allows. Also, can be written as a product of prime powers where every power is 0. So for every , there exists some where and this is unique as is defined to be largest such that .
6.3.3 Not all formulas define functions
When defining functions, we cannot simply write down any old algebraic expression and use this as the rule.
Exercise 6.30.
Suppose we try to define a function by the formula
Why is this not a function?
[Inspired by Why aren’t all functions well-defined?]
Solution (please try for yourself before looking)
According to the formula, and . But and so if were a function then we would require .
Example 6.31.
Let where
This is not a function because the codomain is but .