Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Chapter 4: Functions I: Fundamentals and Types

Functions are a central language for describing relationships between quantities. This first chapter on functions introduces their definition and notation, the main ways functions can be represented, and several basic classes of functions.

Definition & Notation

A function is a relation between two sets, where each element of the first set (called the domain) is assigned to exactly one element of the second set (called the codomain). As illustrated below, a function can be thought of as an input/output device : for any given input, the output is uniquely determined.

Function as an input-output process
Figure 4.1. A conceptual illustration of a function as a mapping from input to output: each input is processed by a function to produce a unique output .

We now provide a more formal definition of a function and introduce several related concepts.

Definition: A Function

Function mapping from domain to codomain
Figure 4.2. Illustration of a function as a mapping from elements in an input set (domain) to elements in an output set (codomain).

A function is a rule that assigns to each input exactly one output . This relationship is often written as:

In particular:

  • The set is called the domain of the function. It contains all possible valid inputs.
  • The set is called the codomain. It is the set into which all outputs are mapped.
  • The range (also called the image) of the function is the set of actual outputs the function produces based on its domain. It is a subset of the codomain:

Note: Independent and Dependent Variables

When we use to denote the input and to denote the output associated with , is also referred to as the independent variable and as the dependent variable, because its value "depends on ".

A function always has a domain, which is the set of all inputs for which the function is defined. If no specific domain is stated for a function given by an equation, the default is typically the set of all real numbers that yield valid (usually real) outputs.

Functions are powerful tools for describing relationships between quantities. Many real-world scenarios can be modeled using functions, where one variable depends on another. In this context, it is also important to understand a function’s domain, codomain, and range, because these concepts clarify what kinds of inputs are valid, what types of outputs are expected, and what outputs actually occur.

Note: Mathematical Models

A model is a simplified representation of a system. It can be conceptual, verbal, diagrammatic, physical, or formal (mathematical).

In this chapter, we focus on mathematical models built from functions. Such models describe how one quantity depends on another, while leaving out details that are not relevant to the question being studied.

Example: Temperature Over Time

The temperature at a given time of day can be expressed as a function of time. Suppose the temperature (in °C) follows the rule

Graph of the temperature function with domain, codomain, and range indicated.
Figure 4.3. The temperature model is restricted to the domain hours; the codomain is , while the actual range is .
  • Domain: , because the model describes the time over a single day (in hours).
  • Codomain: , since temperature values are real numbers.
  • Range: , since the sine term varies between and . This means varies between and , and adding shifts the range to .

Example: Distance Traveled at Constant Speed

If a car travels at a constant speed of 60 km/h, the distance traveled after hours is given by

Graph of the distance function with domain, codomain, and range indicated.
Figure 4.4. The distance model is shown on its domain ; the codomain is , while the actual range is .
  • Domain: , because the time cannot be negative.
  • Codomain: , since distances are expressed as real numbers.
  • Range: , because multiplying a non-negative by 60 produces a non-negative result. The distance is at the start, and increases without bound as time increases.

Example: Customer Feedback from a Star Rating

A platform summarizes a customer's star rating as a feedback category. Let be the submitted rating and define

by

A plot of the discrete star ratings one through five against negative, neutral, and positive feedback categories, with domain, codomain, and range indicated.
Figure 4.5. The function is plotted only at its five valid inputs: ratings one and two map to Negative, three maps to Neutral, and four and five map to Positive.
  • Domain: , the possible submitted star ratings.
  • Codomain: , the declared feedback categories.
  • Range: , because every declared category is attained by at least one rating.

Unlike the preceding examples, both the domain and codomain are discrete, and the outputs are categorical rather than numerical.

Note: Codomain Versus Range

The codomain is the set of values a function is declared to produce, while the range is the set of values the function actually produces.

In the temperature and distance examples, the codomain was chosen to be even though the ranges are smaller. In the star-rating example, every declared feedback category is attained, so the range equals the codomain.

This convention lets us work with many functions in the same general setting. The range gives more detailed information about what outputs actually occur.

Representation Methods

Functions can be represented in several different ways, each offering different insights into the relationship they describe. Depending on the context, one representation may be more useful or informative than another.

To illustrate these representations, we will use a simplified example based on (synthetically generated) agriculture data. Let denote the crop yield (in t/ha) as a function of fertilizer amount (in kg/ha). That is, we define:

This example models a common real-world scenario where crop yield depends on the amount of fertilizer used.

Tables

A table is one of the most straightforward ways to represent a function. This form is especially useful when working with data collected through observation or measurement. Essentially, a table just lists specific input values and their corresponding output values.

Table 4.1. Selected input-output values for the crop-yield function.

Fertilizer ()Crop Yield ()
03.4942
13.5038
23.5133
33.5228
43.5322
1974.1589
1984.1559
1994.1530
2004.1500
2014.1469
3962.3319
3972.3163
3982.3008
3992.2851
4002.2694

In this table, each row shows a specific input value and the corresponding output value . Tables are useful for answering discrete queries, such as: "What is the crop yield if given 200 kg/ha fertilizer?".

They can also help identify general trends in the data, which leads us to the following definitions.

Definition: Increasing on an Interval

An increasing function on an interval showing that when x one is less than x two, f of x one is less than or equal to f of x two.
Figure 4.6. For an increasing function on an interval , moving from to a larger value does not make the function value go down.

We say that a function is increasing on an interval if for all it holds that

The function is said to be strictly increasing (note the inequality) when

Definition: Decreasing on an Interval

A decreasing function on an interval showing that when x one is less than x two, f of x one is greater than or equal to f of x two.
Figure 4.7. For a decreasing function on an interval , moving from to a larger value does not make the function value go up.

We say that a function is decreasing on an interval if for all it holds that

The function is said to be strictly decreasing (note the inequality) when

By applying these definitions and inspecting the table, we can observe that the crop yield increases as the fertilizer amount increases - up to a certain point - and then decreases. However, beyond this general behavior, it is difficult to tell much more. The table alone does not reveal whether the relationship is simply linear, or follows a more complex curve. In particular, it does not clearly convey the rate at which the crop yield increases or whether this rate changes over the domain. For such insights, a graphical or algebraic representation is usually more informative.

Graphs

A visual picture of a function can be provided in the form of a graph. The graph of a function is the set of points plotted in a coordinate plane, where for all in the domain of . Plotting data points from a table helps reveal the overall shape and behavior of the function, which may not be immediately apparent from a list of values alone.

Crop yield as a function of fertilizer
Figure 4.8. Graph showing the crop yield as a function of fertilizer amount , illustrating how yield increases and declines as fertilizer amount increases.

From this graph, we can observe that the function increases with fertilizer (), to a point, but not linearly. The curve appears to flatten and then decrease more sharply, suggesting that the relationship between fertilizer () and yield () is non-linear, possibly polynomial.

Algebraic Formulas

Often, we want more than just individual data points, we want a general rule that allows us to compute the output for any valid input. An algebraic formula provides a compact, symbolic way to describe the relationship between inputs and outputs.

The table and graph above were synthetically generated from the quadratic polynomial:

The example is conceptual rather than a report of a particular experiment. In practice, a formula of this kind can be obtained from observed data by fitting a mathematical function to measurements. The resulting polynomial then approximates the relationship between fertilizer amount and crop yield, smoothing out random variation while preserving its overall pattern.

Having an algebraic representation allows us to carry out several useful analyses:

  • Interpolation: Estimate values between known data points.
  • Extrapolation: Predict behavior beyond the observed range, for instance, for very small or large fertilizer amounts ().
  • Equation solving: Find input values corresponding to specific outputs, for example solving to determine the fertilizer amounts for which the model predicts a yield of 4.0 t/ha.

More broadly, models based on algebraic formulas let us describe and explore real-world phenomena: how quantities change together, where growth slows or reverses, and how one variable influences another. Such models form the foundation of mathematical analysis, offering insight into underlying behavior.

To describe these relationships effectively, we must choose a suitable type of function and fit it to the data. The displayed coefficients illustrate what a least-squares fit may produce; least squares is a method that finds a curve that closely matches observed data. Recognizing different classes of functions, such as linear, quadratic, cubic, or exponential, helps us select appropriate models and interpret the types of behavior they represent.

Basic Classes of Functions

Functions can be grouped into different classes based on their algebraic form. Each class has its own properties, domain and range, and characteristic graph shape. In this section, we focus on common basic function classes and describe their general forms (graphical) behavior.

Before exploring specific types, it is useful to note two important features that appear frequently in graphs of functions:

Table 4.2. Common graphical features of functions.

FeatureDefinitionWhy It Matters
InterceptsPoints where the graph meets the coordinate axes. -intercepts occur when , and the -intercept occurs when .Represent starting values, equilibrium states, or solutions to problems.
Turning PointsPoints where the graph changes direction from increasing to decreasing, or vice versa.Indicate local maxima or minima; used to identify peaks, troughs, or optimal conditions.
AsymptotesLines that describe the limiting behavior of a graph as the input approaches a value or grows without bound. A graph may cross a horizontal or oblique asymptote.Describe long-term trends or behavior near a boundary.

Polynomial Functions

Polynomial functions are smooth, continuous curves with no sharp corners or breaks. Their general behavior depends on the degree and the leading coefficient.

Definition: Polynomial Function

Examples of polynomial functions
Figure 4.9. Examples of polynomial functions of different degrees, showing how the degree affects the shape and number of turning points of the graph.

Nonzero polynomials belong to a broad class of functions that can be written in the general form:

where:

  • is a non-negative integer (the degree of the polynomial)
  • are real constants

The zero polynomial is also a polynomial, but its degree is left undefined in this course.

Key characteristics:

  • Graph: smooth, continuous curve.
  • Intercepts: A nonzero degree- polynomial has at most real -intercepts; every polynomial has one point on the -axis at .
  • Domain: .
  • Range: Depends on the degree and coefficients.

Note: Classification by Number of Terms

One way to classify a polynomial is by counting its nonzero terms.

Table 4.3. Classification of polynomials by the number of terms.

Number of TermsNameExample
Monomial
Binomial
Trinomial
No special standard name

Monomials, binomials, and trinomials are all polynomials; the names only record their number of nonzero terms.

Independently of its number of terms, a polynomial can also be classified by its degree, as described in the following.

Note: Classification by Degree

For a nonzero polynomial, the degree is the greatest exponent of the variable whose coefficient is nonzero.

Table 4.4. Classification of polynomials by degree.

DegreeNameExample
Constant
Linear
Quadratic
Cubic
Quartic
Quintic
th-degree polynomial

Linear Functions

A linear function is a polynomial of degree and its graph is a straight line.

Definition: Linear Function

Examples of linear functions
Figure 4.10. Graphs of two linear functions. The first shows an increasing line (), while the second shows a decreasing function ().

A linear function can be written in the general (slope-intercept) form:

where and are constants. If , it is a polynomial of degree ; if , it simplifies to , which is a constant function (a polynomial of degree 0).

Key characteristics:

  • Graph: A straight line with slope .
    • If the function is increasing
    • If the function is decreasing
  • Intercepts:
    • -intercept at point
    • If , one -intercept at point
  • Domain: .
  • Range: if ; if , the range is the single-value set .

Example: Classifying Linear Functions

To classify the functions, compare each formula with the general form and note its key graphical characteristics.

Classify each function:

Answer:

  • is linear (degree ). Its slope is , so it is increasing, and its -intercept is .
  • is constant (degree ). Its slope is , so its graph is the horizontal line .
  • is quadratic (degree ), not linear. Its graph opens upward, is vertically stretched by a factor of relative to , and is shifted upward by .

One of the defining characteristics of a line is its slope. The slope describes how a line rises or falls as we move along the -axis, i.e., in other words, it represents the rate of change in for each unit change in .

The slope measures both the steepness and the direction of a line:

  • If the slope is positive, the line points upward when moving from left to right
  • If the slope is negative, the line points downward when moving from left to right
  • If the slope is zero, the line is horizontal

To determine the slope numerically, we compare how much changes relative to . This comparison gives us the ratio of the change in to the change in , leading to the more formal definition below.

Definition: Slope of a Linear Function

Consider a line passing through distinct points and with . Let and denote the changes in and , respectively. The slope of the line is:

Now, let us explore how this definition relates to the formula of a linear function. Consider the function:

We already know that the graph of a linear function is a straight line. To find its slope, we can apply the definition above using any two points, i.e., and , on the line. In particular, let us evaluate the function at two convenient points:

  • When , we have . This gives us the point:
  • When , we have . This gives us the point:

Therefore, substituting the points into the formula for the slope, the slope of this line is:

This shows that the coefficient in the function represents the slope of the line. Every function of this form describes a line with slope and -intercept ; it is a degree- linear function when and a constant function when .

This relationship will be revisited in Chapter 10, where the concept of slope forms the basis for defining differentiation.

Quadratic Functions

A quadratic function is a polynomial of degree ; its graph is a parabola.

Definition: Quadratic Function

Examples of quadratic functions
Figure 4.11. Graphs of three quadratic functions. The first two parabolas open upward (), while the last opens downward .

A quadratic function can be written in the general form:

where .

Key characteristics:

  • Graph: A parabola.
    • If the parabola opens upward
    • If the parabola opens downward
  • Intercepts: Up to two -intercepts, and exactly one -intercept
  • Turning Point (Vertex): The point where the graph changes direction.
    • If , the vertex is the lowest point, so
    • If , the vertex is the highest point, so
  • Domain: .
  • Range:
    • If it is
    • If it is

Example: Classifying Quadratic Functions

To recognize a quadratic function, look for degree after the expression has been simplified or expanded.

Classify each function and describe the orientation and -intercept of each quadratic:

Answer:

  • is quadratic (degree ). Since its leading coefficient is positive, it opens upward, and its -intercept is .
  • is quadratic (degree ). Since its leading coefficient is positive, it opens upward, and its -intercept is .
  • is cubic (degree ), not quadratic.

Finding -intercepts requires solving an equation and is covered in Chapter 7.

Exponential Functions

Exponential functions have a constant base raised to a variable exponent.

Definition: Exponential Function

Examples of exponential functions
Figure 4.12. Examples of exponential functions. The first two illustrate exponential growth (), while the last shows exponential decay ().

An exponential function can be written in the general form:

where , , and .

The magnitude is the vertical scale factor relative to ; if , the graph is also reflected across the -axis.

Key characteristics:

  • Graph:
    • If and , the graph is increasing (growth)
    • If and , the graph is decreasing (decay)
    • If , these directions are reversed because the graph is reflected across the -axis
  • Asymptote: Horizontal at .
  • Domain: .
  • Range: if , and if .

Example: Classifying Exponential Functions

To distinguish exponential functions from powers of , look for a constant base raised to a variable exponent.

Classify each function and identify whether each exponential represents growth or decay:

Answer:

  • is exponential with and . Since and , it is increasing and represents exponential growth.
  • is a power function and a quadratic polynomial, not an exponential function, because the variable is in the base rather than the exponent.
  • is exponential with and . Since and , it is decreasing and represents exponential decay. The coefficient scales the graph vertically by a factor of relative to .

Logarithmic Function

Logarithmic and exponential functions have an important relationship: each operation undoes the other. Applying a logarithm after exponentiation returns the original exponent,

while exponentiating after taking a logarithm returns the original positive number,

Together, these two relationships can be written compactly as

where , , , and .

The relationship works in both directions. Knowing either equation gives us the other. The idea of undoing one operation with another is central to equation solving and will be studied further in Chapter 7.

Definition: Logarithmic Function

Examples of logarithmic functions
Figure 4.13. Three increasing logarithmic functions shown with different scales or bases.

A logarithmic function can be written in the general form:

where , , and .

The magnitude is the vertical scale factor relative to ; if , the graph is also reflected across the -axis.

Key characteristics:

  • Graph:
    • Passes through for every
    • If , it is increasing for and decreasing for ; a negative reverses these directions
    • Is unbounded above and below across its domain
  • Asymptote: Vertical at .
  • Domain: .
  • Range: .

Example: Classifying Logarithmic Functions

To distinguish logarithmic functions from exponential ones, look for a logarithm applied to the input variable.

Classify each function and describe the direction of each logarithmic function:

Answer:

  • is logarithmic with and . Since and , it is increasing.
  • is the natural logarithmic function with and . Since and , it is increasing.
  • is exponential, not logarithmic. Since its base satisfies , it is increasing and represents exponential growth.

Piecewise Functions

Not all functions can be described by a single formula. In some cases, different rules apply to different parts of the domain. Such functions are called piecewise functions, or piecewise-defined functions.

Definition: Piecewise Function

Let . A piecewise function uses a separate expression on each subset :

The subsets are pairwise disjoint, meaning that no two overlap, and together they cover . Therefore, every input belongs to exactly one subset and is evaluated using exactly one rule.

At a boundary where the rule changes, the graph may join without a break, or it may have a gap or jump.

Domain. Combine all rule-specific input subsets:

The indexed union notation in the second line compactly combines all subsets .

Range. Combine all outputs produced by the rules:

Example: Piecewise Function with Two Rules

The graph below shows how two different formulas can describe one function on different parts of its domain.

Piecewise function with two rules
Figure 4.14. Graph of a piecewise function whose rule changes at .

Consider the function defined by

To evaluate a piecewise function, first determine which part of the domain the input belongs to, and then apply the corresponding rule. For instance:

  • For , since , use function :
  • For , since , use function :

Example: Absolute Value Function

The absolute value function is a familiar example where the rule changes at zero.

Absolute value function
Figure 4.15. Graph of the absolute value function , showing a change in rule at .

The absolute value function, denoted by , can be expressed as a piecewise function:

Here, positive inputs are unchanged, while negative inputs are reflected across the -axis, ensuring that is always non-negative.

Example: ReLU Function

Another common piecewise example comes from machine learning, where negative inputs are clipped to zero.

ReLU function
Figure 4.16. Graph of the ReLU (Rectified Linear Unit) function, which outputs zero for negative inputs and increases linearly for positive inputs.

The Rectified Linear Unit (ReLU) is a commonly used activation function in neural networks. It can be expressed as a piecewise function:

The ReLU function outputs the input value itself when it is positive, and zero otherwise. This simple non-linear behavior introduces nonlinearity into neural networks, which is an essential property that allows them to learn complex patterns and relationships in data.