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

Mathematics Brush-up for Data Science

Author: Nicklas S. Andersen

Last updated: 6 September 2026

Wordcloud of topics and terms in the mathematics brush-up book.

Preface

These notes are intended for the pre-semester mathematics brush-up course for students entering the master's degree program in Data Science at the University of Southern Denmark (SDU), Department of Mathematics and Computer Science (IMADA).

Since students may enter the program with different mathematical backgrounds, the material spans a fairly broad range. It revisits upper-secondary mathematics, including topics normally associated with Maths C, Maths B, and Maths A levels in Danish gymnasiums, while also offering a glimpse of the mathematical language used in university-level data science courses: its vocabulary, notation, and basic methods.

In this way, the notes aim to bridge the potential gap between gymnasium-level mathematics and the mathematics students will meet in university-level data science courses, while refreshing prior knowledge and making the mathematical language less unfamiliar.

Lastly, an aim has also been to create a compact reference document that students can return to later in the Data Science program.

Chapter 1: Sets and Number Sets

Mathematics is fundamentally about studying patterns, structures, quantities, and logical reasoning. In this context, set theory is a part of the foundational language of mathematics, providing an important framework for clearly describing and discussing collections of objects. Understanding sets and their notation is crucial as they form the basis for more complex mathematical structures and reasoning.

Set Basics

Definition of a Set

Definition: A Set

Set A containing the elements x, y, and z, with w shown outside the set.
Figure 1.1. A diagram illustrating a set as a collection of distinct elements (, , ) within a labeled region, along with a single element () not in the set.

A set is a well-defined collection of distinct objects, called elements.

  • Notation: Sets are typically written using curly braces and denoted by capital letters from the Latin alphabet, such as .
  • Well-defined: The objects inside a set, i.e., its elements, must be well-defined, meaning it is always clear whether something belongs to the set or not.
  • Distinct Elements: A set is determined by its distinct elements. Repeating an element in roster form does not create a new element.
  • Order Independence: The order of elements in a set does not matter. For example, and represent the same set.

The elements , , and are placeholders and can represent anything — numbers, symbols, objects, or even abstract concepts — as long as they are clearly identifiable.

The following examples illustrate the definition of a set.

Example: Vowels as a Set

Consider the set of vowels in the English alphabet:

This set clearly lists all the vowels, and it is easy to determine whether a given letter is a vowel or not.

Example: Well-Defined and Ambiguous Sets

For a set to be meaningful, it must be well-defined. This means it must be clear whether any given object is an element of the set or not. For example, the set of vowels in the word "radio" is well-defined and can be written as:

Similarly, the "set of all days last year with temperatures below C" is well-defined because it is based on objective, measurable data. However, the "set of all cold days last year" is not well-defined because the term "cold" is subjective and can vary from person to person.

Example: Duplicate Elements in a Set

The set of vowels in the English alphabet is:

The same set may also be written with a repeated entry:

This notation is valid, but the repetition is redundant. Both rosters describe exactly the same set because each distinct vowel occurs in both. It is therefore clearer to list each element only once.

Example: Reordering Elements in a Set

Consider two sets containing the vowels in the English alphabet:

These two sets are identical because they contain the same elements, regardless of the order in which the elements are listed. Thus:

This example illustrates the concept of order independence in sets, where the arrangement of elements does not define the uniqueness of a set.

Definition: The Empty Set

The empty set is the unique set that contains no elements. It is denoted by or simply .

Even though it has no elements, it plays a key role in set theory, similar to how plays a key role in arithmetic.

Common Number Sets

The standard number sets used throughout this book are summarized below.

Table 1.1. Common number sets and their standard notation.

SymbolNameDescriptionExamples
Natural numbersThe counting numbers.
Natural numbers with zeroThe counting numbers together with .
IntegersThe natural numbers, their negatives, and zero.
Rational numbersNumbers of the form , where and .
Real numbersNumbers represented by points on the number line.
Irrational numbersReal numbers that are not rational.
Complex numbersNumbers of the form , where and .

The symbol is used in this book for the irrational numbers. This notation is convenient but not universal. Chapter 2 relates to the rational and real numbers using the set difference operation.

Definitions: Positive, Negative, and Non-negative Numbers

Let be a real number.

Positive number. The number is positive if .

Negative number. The number is negative if .

Non-negative number. The number is non-negative if .

Thus, is neither positive nor negative, but it is non-negative.

Note: Restricting Number Sets with Subscripts

An inequality written as a subscript restricts a number set to the elements satisfying that condition. For example,

is the set of positive integers, while denotes the set of positive real numbers—that is, all real numbers greater than .

The same pattern gives notation such as for the non-negative real numbers and for the negative integers.

The subscript in is a related conventional notation indicating that is included with the natural numbers. Explicit inequality subscripts are useful because they state the restriction directly.

Definitions: Finite and Infinite Sets

Finite set. A set is finite if it has exactly elements for some non-negative integer . For , its distinct elements can be listed completely and without repetition as

For , the set is the empty set. Thus, the empty set is finite because it has elements.

Infinite set. A set is infinite if it is not finite. This means that no finite list contains all of its elements.

Representing Sets

Sets can be described using several notations. The most useful choice depends on whether the elements can be listed conveniently or are better described by a condition or an interval. The most common forms are introduced below.

Verbal Description

A verbal description uses ordinary language to define a set by explaining its elements or properties. This approach is particularly useful for introducing abstract or unfamiliar sets in an intuitive way or for providing context before formalizing the set with mathematical notation.

Examples: Describing Sets Verbally

Here are a few sets described only in words, before translating them into symbols:

  • "The set of vowels in the English alphabet."
  • "The set of non-negative integers."
  • "The set of non-negative integers strictly smaller than 6."

Roster Form

Roster form explicitly lists all elements of a set enclosed in curly braces . This notation is particularly useful for finite sets or infinite sets with clear, recognizable patterns.

Examples: Describing Sets in Roster Form

The same ideas can be written in roster form by listing their elements explicitly:

  • The set of vowels in the English alphabet:

  • The set of non-negative integers:

  • The set of non-negative integers strictly smaller than 6:

Note: The ellipsis () indicates that the pattern continues indefinitely.

Set-Builder Notation

Set-builder notation provides a precise and compact way to define a set by specifying the properties that its elements must satisfy. The notation takes one of two equivalent forms:

Both forms are read as "the set of all such that the given condition holds".

Here, the symbol represents a generic element of the set, i.e., it does not refer to any particular element but serves as a placeholder for all possible elements that satisfy the condition. The vertical bar () or colon () functions as a divider between the variable and the rule that determines which elements belong to the set.

For example, the condition might express a numerical restriction such as (meaning is strictly greater than zero), a combined relationship like (meaning lies strictly between zero and ten), or a membership rule such as (meaning is an element of the set ). In each case, the notation highlights the defining property rather than listing individual elements.

Because of this, set-builder notation is preferred when working with infinite sets, intervals of real numbers, or sets defined by more complex conditions.

Examples: Describing Sets Using Set-Builder Notation

The same examples can also be written by stating the rule an element must satisfy:

  • The set of vowels in the English alphabet:

  • The set of non-negative integers:

  • The set of non-negative integers strictly smaller than 6:

Interval Notation

The real numbers can be visualized geometrically as an infinite line, where each point corresponds to a real number. Intervals are contiguous segments of this line, representing subsets of .

Real number line extending in both directions with zero marked at the origin.
Figure 1.2. An illustration of the real number line extending from to , with the origin at the center. Positive numbers lie to the right of the origin, while negative numbers lie to the left. Every point on the line corresponds to a unique number.

Interval notation describes intervals concisely. Brackets indicate included endpoints, while parentheses indicate excluded endpoints.

Below is a summary of how interval notation corresponds to sets of real numbers together with their corresponding set-builder notation.

Table 1.2. Common interval notation and equivalent set-builder descriptions.

SetInterval NotationSet-Builder NotationIllustration
All real numbers
Open intervalab
Closed intervalab
Infinite to the righta
Infinite to the righta
Infinite to the leftb
Infinite to the leftb
Half-open (left open)ab
Half-open (right open)ab

Understanding how elements relate to sets is fundamental, both when defining a single set and when comparing several sets. The next section introduces the corresponding notation.

Examples: Describing Sets Using Intervals

Here are common intervals written both in interval notation and set-builder notation:

  • Real numbers strictly between and :

  • Real numbers between and , including both endpoints:

  • Real numbers greater than :

  • Real numbers less than or equal to :

Set Membership

Set membership describes the fundamental relationship between elements and a set. This relationship is crucial for defining and understanding the contents of sets.

Definition: Set Membership

Set A containing x, with w shown outside the set.
Figure 1.3. A diagram showing a set containing an element but not an element , illustrating the membership relation.

Let be an element and a set. The notation means that is an element, or member, of . If an element is not in , the notation is .

Examples: Set Membership

The following examples illustrate how the symbols (is an element of) and (is not an element of) describe whether a value belongs to a particular set.

  • The element belongs to the set because it appears among its members:

  • The element does not belong to the set because it is not included among its elements:

  • The number is a real number, so it belongs to the set of all real numbers:

  • In this case, the elements of the outer set are themselves sets, so is one of its members:

  • The number alone is not a member, because the set only contains sets as elements:

  • The fraction (equal to ) is in the interval because :

  • The number is not in this interval because it is not positive:

This binary relationship, where each element either belongs to a set or does not, precisely defines a set’s contents and forms the basis for defining equality and more advanced set relations.

Definition: Equality of Sets

Two sets and are equal, denoted , if they contain exactly the same elements. This means every element of is in , and every element of is in .

Equivalently, checking equality means verifying membership in both directions.

Cardinality

Definition: Cardinality

The cardinality of a set , written , indicates the number of elements in . In other words, the cardinality is the size of .

Definitions: Countably and Uncountably Infinite Sets

Countably infinite set. An infinite set is countably infinite if its elements can be listed without repetition in an endless sequence:

so that every element of the set appears exactly once in the list. For example, is countably infinite.

Uncountably infinite set. A set is uncountably infinite if it is infinite, but its elements cannot be completely listed in any sequence. For example, is uncountably infinite.

Examples: Cardinality

The following examples show how cardinality records the size of finite, countably infinite, uncountably infinite, and empty sets.

  • If , then . This means that is a finite set and has five distinct elements.
  • If , then . This means that is a finite set and has six distinct elements.
  • If , then (aleph-null, the cardinality of any countably infinite set). This means that is countably infinite, i.e., its elements can be listed one by one in an endless sequence (first 1, then 2, then 3, and so on).
  • If , then (the cardinality of the continuum). This means that is uncountably infinite: its elements cannot be listed one by one in a sequence.
  • If , then . The empty set contains no elements, so its cardinality is zero.

Subsets & Proper Subsets

Subsets and proper subsets describe the relationship between sets in terms of their elements.

Definition: Subset

Two configurations illustrating that A is a subset of B: A contained within B and A equal to B.
Figure 1.4. Both configurations satisfy : may lie strictly inside , or the two sets may be equal.

Let and be sets. The set is a subset of if and only if every element of is an element of . This relationship is written .

Examples: Subset

The following examples compare sets by checking whether every element of one set appears in the other.

  1. Let and . Since both sets contain the same elements: Therefore, and are equal sets, and each is a subset of the other.

  2. Let and . The empty set contains no elements, so it is a subset of every set:

  3. Let and . Every element of is in , so: Since , is also a proper subset, although it can first be identified as a subset.

Definition: Proper Subset

Set A drawn with space on every side inside set B, with one element in A and another in B but outside A.
Figure 1.5. Diagram illustrating the proper subset relationship , where is contained within but .

If is a subset of , but is not equal to , then is called a proper subset of . This relationship is written

In this book, is reserved for proper subsets, while allows equality. The distinction is about containment, not necessarily cardinality.

If a subset contains all the elements of the original set, it is still considered a subset, but not a proper one.

Examples: Proper Subsets

The following examples emphasize the extra requirement for a proper subset: the larger set must contain at least one additional element.

  1. Let and . Every element of is in , but has one additional element. Therefore: That is, is a proper subset of .

  2. Similarly, let and . All elements of are contained in , but has additional elements ( and ). Hence: That is, again, is a proper subset of .

  3. The natural numbers form a proper subset of the integers: Both sets are countably infinite, so a proper subset need not have smaller cardinality when the sets are infinite.

These examples show that every element of a proper subset belongs to the larger set, but the larger set has at least one element that is not in the proper subset. A proper subset is strictly smaller by inclusion, although it need not have a smaller cardinality when the sets are infinite.

Number Set Hierarchy

With subset notation established, the common number sets can be arranged according to how they fit inside one another. These number sets form a natural hierarchy: smaller number systems are contained within larger ones.

For example, every natural number is also an integer, every integer is also a rational number, and every rational number is also a real number. The diagram below illustrates this nesting.

Nested hierarchy of the natural numbers, natural numbers with zero, integers, rational numbers, real numbers, and complex numbers, with the real numbers partitioned into rational and irrational numbers.
Figure 1.6. Diagram illustrating the hierarchy of the fundamental number sets, with the rational and irrational numbers forming a partition of .

The hierarchy can be expressed symbolically as:

The irrational numbers also lie inside the real numbers, but they are not part of the rational numbers. In symbols:

This hierarchy clarifies how different number systems extend one another and expand the kinds of quantities that can be represented.

Chapter 2: Set Operations

Chapter 1 introduced sets, membership, subsets, cardinality, and common number sets. This chapter builds directly on that notation by showing how sets can be combined, compared, and reduced.

Universe and Complement

The universe and set complement describe what is not contained in a given set. A universe first establishes the context in which a complement is defined.

Definition: Universe

Set A and two elements shown inside the surrounding universe U.
Figure 2.1. A diagram showing the universe as a large rectangular region containing all relevant elements, with a set represented as a subset inside it.

The universe, often denoted as , refers to a set that contains all the objects or elements relevant to a particular discussion or problem. It serves as the context within which all other sets are defined and interpreted.

Examples: Universes

The universe depends on the context of the problem. The following examples show how changing the universe changes what the named subsets mean.

  1. Let the universe be the set of all lowercase English letters: The following subsets can then be defined:

    • , the set of vowels.
    • , the set of consonants.

    Here, provides a clear context: and together cover all letters in the alphabet.

  2. Let the universe be the set of all real numbers: The following subsets can then be defined:

    • . The set of all real numbers strictly between and .
    • . The set of all real numbers between 2 and 5, including the endpoints.
    • . The set of all real numbers greater than 3.

    In this case, defines the entire number line, and each of these sets represents a subset of it.

Definition: Set Difference

Overlapping sets A and B with the part of A outside B highlighted.
Figure 2.2. The highlighted region is : the part of outside .

The set difference of two sets and , denoted by , is the set of all elements that are in but not in .

The notation says that an element must belong to and not belong to . In other words, set difference removes from all elements that also belong to .

The alternative notation is also used for set difference. This book uses to distinguish the operation from numerical subtraction.

Examples: Set Difference

In each example below, keeps only the elements that belong to and not to .

  1. Taking and gives Thus, the irrational numbers are precisely the real numbers that are not rational.

  2. Let and . Then: These are the vowels that are not in the set .

  3. Let and . The elements in that are not in are:

  4. Let and . The fruits in that are not in are:

  5. Let and . Since and contain the same elements, the difference is: That is, the difference is the empty set because there is nothing in that is not in .

  6. Let and . Then: The difference consists of the endpoints of the closed interval that are not part of the open interval .

These examples show that the set difference identifies what belongs only to the first set and not to the second.

A complement is a special case of set difference in which a set is subtracted from the universe.

Definition: Complement

Universe U with the diagonally hatched region outside set A highlighted as the complement of A.
Figure 2.3. Diagram illustrating the complement of a set within the universe , highlighting all elements in that are not in .

The complement of a set , denoted by or , consists of all elements in the universe that are not in . In other words:

The notations and are both common. This book usually uses in set calculations; also appears when emphasizing the parallel with logical negation. The overline notation is another common alternative.

The expression states that is not an element of . The complement therefore describes what is not included in a set within the context of a given universe.

Examples: Complements

Each complement is taken relative to a chosen universe, so must first be stated or described.

  1. Let and . The complement of is: Here, contains the elements of that are not in .

  2. Let be the set of vowels in the English alphabet. If the universe is the set of all lowercase letters, then the complement is: Here, the complement is expressed verbally to save space, although all consonants could also be listed explicitly.

  3. Let be a standard deck of playing cards, and let be the set of all spades. The complement is: In this context, represents every card that is not a spade.

  4. Let and . The complement of is: This means contains all real numbers less than or equal to 10.

These examples illustrate how the complement operation identifies everything outside a given set, relative to a specified universe .

Union and Intersection

Union and intersection describe how two sets can be combined or compared. These operations are especially useful when a problem involves the words "or" and "and."

Definition: Union

Overlapping sets A and B with all of both sets highlighted.
Figure 2.4. The highlighted region is : everything in , in , or in both.

Let and be sets.

The union of and , written , is the set of all elements that are in , in , or in both:

Here, "or" is inclusive: an element belongs to if it belongs to at least one of the two sets.

Definition: Intersection

Overlapping sets A and B with only their shared part highlighted.
Figure 2.5. The highlighted region is : the part shared by and .

Let and be sets.

The intersection of and , written , is the set of all elements that are in both and :

Example: Union of Finite Sets

Let

The union contains every element that appears in at least one of the sets:

Example: Intersection of Finite Sets

Let

The intersection contains only the elements that appear in both sets:

The examples above illustrate that union and intersection create new sets from old ones. Since these operations are used repeatedly in mathematics, it is useful to know a few basic rules for rewriting expressions involving them.

Properties: Union and Intersection

Let , , and be sets. The following identities hold:

Table 2.1. Basic properties of union and intersection.

PropertyUnionIntersection
Commutative law
Associative law
Distributive law
Identity law
Idempotent law
Absorption law

These laws say that some changes in grouping or order do not change the set being described. They follow the meanings above: union collects elements from either set or both, while intersection keeps only the shared elements.

Properties: Complements and De Morgan's Laws

When and are subsets of a universe , the following identities hold:

De Morgan's laws describe how a complement changes unions and intersections:

The following examples illustrate both laws using finite sets.

Example: De Morgan's First Law

Let

First, form the union and then take its complement:

Alternatively, take the two complements first:

Their intersection is

Both methods produce the same set, illustrating that .

Universe U containing overlapping sets A and B, with elements 7 and 8 in the shaded region outside both sets.
Figure 2.6. The shaded region contains and , the elements that are outside and also outside . It can therefore be described as either or .

Example: De Morgan's Second Law

Let

First, form the intersection and then take its complement:

Alternatively, take the two complements first:

Their union is

Both methods produce the same set, illustrating that .

Universe U containing overlapping sets A and B, with every region except their overlap shaded.
Figure 2.7. The shaded region contains every element that is not shared by and . It can therefore be described as either or .

Note: Disjoint Sets

Two sets are called disjoint if they have no elements in common. In symbols, and are disjoint if

For example, and are disjoint.

For finite sets, union and intersection also support counting without double-counting. This becomes especially useful in Chapter 15, where sample spaces and events are represented as sets.

Note: Counting a Union

For finite sets and ,

The subtraction is needed because the elements in are counted once in and once again in .

For example, if , , and , then

If and are disjoint, then , so the formula becomes .

Set Operations on Intervals

When sets are subsets of the real line, union and intersection can often be described using intervals. This connects set notation with interval notation.

Example: Overlapping Intervals

Let

The intersection contains the real numbers that lie in both intervals:

The union contains the real numbers that lie in at least one of the intervals:

The endpoint is not included in the intersection because , while is included because and .

Aligned number lines for A equals the closed interval from 0 to 3, B equals the open interval from 2 to 5, their intersection, and their union.
Figure 2.8. The overlap gives , while the full region covered by either interval gives .

Example: Disjoint Intervals

Let

These intervals do not overlap, so

Their union is

This union cannot be written as one interval because there is a gap between and .

Aligned number lines for two disjoint intervals C and D, their empty intersection, and their two-part union.
Figure 2.9. The gap between and makes their intersection empty and leaves their union in two separate parts.

Other Set Operations

A few other foundational set operations are commonly used in mathematics and data science. These operations are not developed in detail here, but the table below provides a brief overview.

Table 2.2. Additional set operations and their meanings.

SymbolOperationDescription
Cartesian product of and The set of all ordered pairs where and
The power setThe set of all subsets of , including the empty set () and itself

Chapter 3: Basic Algebra

This chapter revisits some fundamental algebraic rules involving signs, fractions, exponents, and the use of parentheses. Having a good grasp of these rules is essential, since many common mistakes in computation and symbolic manipulation arise from misunderstanding or misapplying these basic principles.

Note: Working Over the Real Numbers

Unless otherwise specified, all constants and variables are assumed to be real numbers, i.e., elements of .

In other words, standard operations such as addition, subtraction, multiplication, and division (except division by zero) produce results that remain within .

Order of Operations, Signs, and Like Terms

When an expression contains several operations, the order in which they are performed matters.

Rule: Order of Operations

Evaluate an expression in the following order:

  1. Parentheses and other grouping symbols, including the numerator and denominator of a fraction.
  2. Exponents and roots.
  3. Multiplication and division, working from left to right.
  4. Addition and subtraction, working from left to right.

Example: Applying the Order of Operations

Consider the expression

Rules: Signs in Multiplication and Division

When multiplying or dividing two numbers:

  • equal signs give a positive result:

  • different signs give a negative result:

Subtraction can be read as adding the opposite.

Example: Subtracting a Negative Number

Adding the opposite gives

Definition: Like Terms

Like terms have the same variable part, including the same exponents. They can be collected by adding or subtracting their coefficients.

Example: Collecting Like Terms

The terms with variable part can be collected, as can the constant terms:

By contrast, and are not like terms and cannot be combined into one term.

Definition: Absolute Value

The absolute value is the distance from the real number to . Therefore,

In particular, and for every real number . The symbol denotes the non-negative, or principal, square root of .

Warning: A Minus Sign and a Square

Exponentiation is performed before a leading minus sign. Thus,

whereas parentheses make the negative value part of the base:

For example, , while .

Basic Algebraic Properties

Before more advanced algebraic concepts are introduced, it is useful to recall a few basic properties that govern addition and multiplication. These properties, i.e., the commutative, associative, and distributive laws, apply to all real numbers and allow expressions to be manipulated regardless of how they are written or grouped.

Rules: Core Algebraic Laws

These laws describe how addition and multiplication behave when terms are reordered, regrouped, or distributed across parentheses.

Commutative law. The order of two elements does not affect the result:

Associative law. The way elements are grouped does not affect the result:

Distributive law. Multiplication distributes over addition and subtraction. For addition:

This property distributes a factor across the terms inside parentheses.

Example: Distributive Law with Addition

Consider the expression:

Using the distributive law, is multiplied by each term inside the parentheses:

The result is the same as first adding the terms inside the parentheses and then multiplying:

This confirms that the distributive and associative properties are consistent, i.e., the order in which the factors are grouped or distributed does not change the result.

Example: Distributing a Negative Sign

Consider the expression:

Here, the negative sign in front of the parentheses can be interpreted as multiplying by :

Applying the distributive law multiplies by each term inside the parentheses:

This shows that placing a negative sign in front of parentheses changes the sign of each term inside.

Fractions

Fractions represent parts of a whole and are especially useful when dealing with proportions, ratios, and percentages. A fraction consists of two parts:

  • A numerator (top number): represents the number of parts being considered.
  • A denominator (bottom number): represents how many equal parts make up the whole.

In symbolic form, a fraction is written as a ratio of two integers:

The set of all such numbers is called the rational numbers and denoted by , and it forms a proper subset of the real numbers:

Warning: A Common Mistake When Adding Fractions

Adding fractions is not done by simply adding the numerators and denominators:

For example:
but which is incorrect for addition. A common denominator is required, as explained below.

Rule: Addition of Fractions

To add or subtract fractions, the denominators must be the same. Once a common denominator is found, the numerators can be added or subtracted while the denominator remains unchanged.

If the denominators are already the same:

If they are different, multiply each numerator by the other fraction’s denominator to obtain a common denominator:

Examples: Adding and Subtracting Fractions

The following examples show the same rule in three common situations: matching denominators, different denominators, and subtraction.

  1. Evaluate the following expression (fractions with the same denominator):

  2. Evaluate the following expression (fractions with different denominators):

A bar model showing one half and one third rewritten as sixths before being added.
Figure 3.1. Using a common denominator expresses fractions on the same scale before adding their parts.
  1. Evaluate the following expression (subtracting two fractions):

Rule: Multiplication of Fractions

Multiplication of fractions is straightforward: multiply the numerators together and the denominators together.

Examples: Multiplying Fractions

The multiplication rule applies whether both factors are fractions or one factor is an integer:

  1. Evaluate the following expression (multiply two fractions directly): Multiplying straight across gives , which simplifies to .

  2. Evaluate the following expression (simplify before multiplying): Since appears in both numerator and denominator, it can be simplified before or after multiplication.

  3. Evaluate the following expression (multiply an integer by a fraction): Integers can be treated as fractions with denominator , making the same rule apply.

Rule: Division of Fractions

To divide one fraction by another, multiply the first fraction by the reciprocal (or multiplicative inverse) of the second fraction.

Examples: Dividing Fractions

Each example below rewrites division as multiplication by a reciprocal before simplifying.

  1. Evaluate the following expression (divide one fraction by another): The reciprocal of is ; multiplying gives .

  2. Evaluate the following expression (divide by a smaller fraction): Here the dividend is positive and the divisor satisfies . Dividing by therefore increases the value; it is equivalent to multiplying by .

  3. Evaluate the following expression (divide a fraction by an integer): Note here that the integer can be written as , and its reciprocal is .

Note: Closure of Rational Numbers

The rational numbers are closed under addition, subtraction, multiplication, and division (except division by zero). This means performing these operations on fractions always produces another rational number.

Exponents

Exponents indicate how many times a base number is multiplied by itself. For example:

In these expressions, the base ( and , respectively) identifies the number being multiplied, while the exponent ( and , respectively) gives the number of factors.

Exponents provide a compact way to represent repeated multiplication and follow the consistent algebraic rules introduced below.

The product, quotient, and power rules below are first stated for integer exponents . Whenever a negative exponent occurs, the base must be nonzero. Fractional exponents are treated separately afterward.

Rule: Power of Zero

For any nonzero base , raising it to the power of zero equals :

The condition matters because is not assigned a value in this course. For positive exponents, , while the pattern holds for nonzero bases. Since these patterns point in different directions, is left undefined.

Rule: Product of Powers

When multiplying powers that share the same nonzero base , their integer exponents and are added:

This rule follows from the idea that each exponent represents repeated multiplication of the same base, and combining them extends that repetition into just a single product.

Examples: Product of Powers

The following calculation applies the Product of Powers rule:

Here, each exponent counts how many times the base 2 appears as a factor. Combining both terms gives factors of 2 in total.

Rule: Power of a Power

When raising an exponential term to another integer power , the exponents are multiplied:

This rule reflects that each copy of contributes factors of , and there are such copies in total, giving factors altogether.

Examples: Power of a Power

The following calculation applies the Power of a Power rule:

Here, the inner exponent () gives three factors of in each group, and the outer exponent () gives two such groups. Altogether, there are factors of .

Rule: Negative Exponent

When a nonzero base is raised to a negative integer exponent , where , the result is the reciprocal of the corresponding positive power:

This rule essentially expresses that a negative exponent "flips" the base, moving it from the numerator to the denominator.

Examples: Negative Exponent

The following calculations apply the Negative Exponent rule.

  • First, consider an expression with a positive base:

  • Next, consider an expression with a negative base:

Rule: Quotient of Powers

When dividing powers that share the same nonzero base , the integer exponents and are subtracted.

This rule follows directly from the Product of Powers and Negative Exponent rules, i.e., division is simply multiplication by the reciprocal:

This rule applies when , since division by zero is undefined.

Examples: Quotient of Powers

The following calculation applies the Quotient of Powers rule directly:

Expanding the numerator and denominator also illustrates how factors cancel:

Here, the two factors of 3 in the denominator remove two factors from the numerator, leaving factors in total.

Rule: Fractional Exponents (Roots as Powers)

Roots can be expressed as fractional exponents. Let be a positive integer. The -th root of can be written as

where the principal real root is used. If is even, the condition is required; if is odd, may be any real number. More generally, for a fraction written in lowest terms,

The same root conditions apply, and if , the base must also be nonzero.

Examples: Fractional Exponents (Roots as Powers)

The following examples apply the rule by expressing roots as fractional exponents:

  • The square root of a non-negative number:

  • The cube root of a number:

  • The fourth root of a power, for :

Here, the denominator of the exponent corresponds to the root, while the numerator corresponds to the power.

Rule: Product of Roots

The root of a product is equal to the product of the roots under the real-domain conditions stated below:

For an even , require . For an odd , and may be any real numbers.

For square roots (), this simplifies to:

Even roots of negative numbers are not real. Odd roots of negative numbers are real; for example, .

Examples: Product of Roots

The following calculation applies the Product of Roots rule to simplify a root expression:

Here, expressing as separates the square root into two simpler factors and makes the simplification straightforward.

Warning: Limits of Exponent Rules

The integer exponent rules apply under the conditions stated above. For arbitrary real exponents, taking ensures that is real and that the usual exponent rules remain valid. Negative bases require separate attention, as shown for rational exponents with odd denominators.

However, it is generally not possible to simplify expressions such as when the bases are different and unrelated by a common factor.

Likewise, exponent rules do not apply to addition or subtraction, so expressions like cannot be simplified using these rules.

Algebraic Identities

Algebraic expressions often contain recurring patterns that make calculations simpler. The commutative, associative, and distributive laws, together with the rules of exponents, provide the foundation for manipulating and simplifying such expressions.

In particular, repeatedly applying the distributive law and interpreting expressions such as as repeated multiplication produces several useful algebraic identities. These identities, summarized in the table below, describe common patterns that occur when expanding or factoring expressions and offer compact formulas for later algebraic work.

Table 3.1. Common algebraic identities derived from the distributive law.

NameExpressionFactored FormExpanded Form
Square of a Sum
Square of a Difference
Difference of Squares

The following figures give area interpretations of the identities in the table. Each figure compares two ways of describing the same area: one from the side lengths of a whole shape, and one from the smaller regions into which the shape is divided. The equation box in each figure records the corresponding algebraic identity. The area pictures assume positive lengths; for the identities involving , assume . The algebraic identities themselves remain valid more generally.

For the square of a sum, split both side lengths of an square into the parts and . This partitions the square into one region, two rectangles, and one region.

An area model showing a square with side length a plus b split into side lengths a and b and regions a squared, ab, ab, and b squared.
Figure 3.3. Area model for the square of a sum, showing the total side length split into the side lengths and .

For the square of a difference, start with an square and keep the blue square. The two hatched strips represent subtracted areas; their overlap is the corner, which must be added back once.

An area model showing an a by a square split into side lengths a minus b and b, with the target square, two subtracted ab strips, and the overlapping b squared corner.
Figure 3.4. Area model for the square of a difference, showing the side length split into and .

For the difference of squares, start with an square and remove a square. The remaining area can be split into two rectangles, then rearranged into a single rectangle with side lengths and .

An area model showing a b by b square removed from an a by a square, followed by the remaining pieces rearranged into a rectangle with side lengths a minus b and a plus b.
Figure 3.5. Area model for the difference of squares, read from top to bottom.

These identities are useful both for expanding expressions and for recognizing factored forms. The same patterns will be used again in Chapter 6 when factoring polynomials.

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.

Chapter 5: Functions II: Operations and Composition

Chapter 4 introduced individual functions, their representations, and several common function classes. This chapter develops ways to build new functions from existing ones: first through arithmetic operations, then through composition, and finally by decomposing complex expressions into simpler inner and outer functions.

Combining Functions

Up to this point, we have explored the basic characteristics of individual functions. We now turn to what happens when functions are combined using standard mathematical operations to create new ones. Just as numbers can be added, subtracted, multiplied, or divided, functions can also be combined in similar ways to form new functions with related behaviors.

Definitions: Arithmetic Operations on Functions

Suppose and are real-valued functions. The following operations define new functions:

Table 5.1. Standard arithmetic operations for combining two functions.

OperationNotationDefinition
Sum
Difference
Product
Quotient

The sum, difference, and product have domain . The quotient has domain

These operations let us construct more complex relationships from simpler ones while preserving the input restrictions of the original functions.

Example: Loss Function

In machine learning, the loss function used to train a model often combines several components that measure different aspects of performance.

Suppose we define:

  • : The prediction error
  • : A regularization term that penalizes overly complex models

Note that may represent several model parameters, but the idea of combining functions, i.e., adding terms that capture different effects, follows the same principle as in the single-variable case.

The resulting loss function balances accuracy (how well predictions match the observed data) with simplicity (how small the model parameters are):

where controls how strongly the regularization term influences the model.

Example: Heat Index

In many real-world models, new relationships are created by combining existing quantities using arithmetic operations.

Suppose we define:

  • : the temperature (in °C)
  • : the humidity (in %)

A new function can be defined to estimate a heat index (a perceived temperature) as follows:

Here, is obtained by adding a weighted contribution from humidity to the temperature. Such combinations describe how different quantities together determine a result. In this case, both temperature and humidity contribute to the perceived heat.

Example: Subtraction and Division of Functions

In this example, we explore how subtraction and division affect the relationship between two functions. For this purpose, let

We will now find and simplify both and to see how these operations transform the expressions.

First, subtract from :

Then, divide by :

Four plots showing f, g, g minus f, and g divided by f with the excluded point at x equals one.
Figure 5.1. Subtraction gives a quadratic function, while division simplifies to a linear function with excluded.

We can see that subtraction and division lead to very different results, i.e., is a quadratic expression, while agrees with the linear expression only on its domain . It is not the same function as on all of because its graph has a hole at .

Even though both start from the same and , the way we combine them changes the type of function we obtain.

Example: Multiplication and Difference of Functions

In this example, we explore how multiplication and subtraction affect the relationship between two functions. For this purpose, let

We will now find and simplify both and to see how these operations transform the expressions.

First, multiply and :

Then, subtract from :

Four plots showing f, g, f times g, and f minus g.
Figure 5.2. Multiplication produces a cubic function, while subtracting from produces a quadratic function.

Again, the two resulting functions are very different, i.e., is cubic, while is quadratic.

Function Composition

In the previous examples, we combined functions using arithmetic operations such as addition and multiplication. We now explore a different kind of combination, called function composition, where the output of one function becomes the input of another.

Function composition allows us to describe multi-step relationships between quantities that depend on one another.

In many real-world situations, one variable influences a second, which in turn affects a third. By composing functions, we can express such a chain of dependencies as a single mathematical expression. Formally, composition means applying one function after another.

Definition: Function Composition

Function composition diagram
Figure 5.3. Function composition: the output of becomes the input of .

Let and be functions, so every output of is a valid input for . The composition of and , denoted , is the function

defined by

Example: Electricity Use as a Composition

Suppose we want to calculate how much electricity is used to cool a house on a particular day of the year. The electricity usage depends on the average indoor-outdoor temperature difference, which in turn depends on the average daily temperature outside.

Thus, we have two relationships:

  • : describes the electricity (in kWh) required to maintain a desired indoor temperature for a given outdoor temperature (°C)
  • : describes the average outdoor temperature (°C) on day of the year

For any given day , the electricity use depends on the temperature, which itself depends on the day. We can therefore evaluate at the temperature given by :

This expression represents the electricity used on day . For example, to find the electricity usage on the 10th day of the year, we first compute and then use that value as the input to . Thus, gives the electricity required to cool the house on the 10th day of the year.

Warning: Misconceptions About Composition

  • Composition is not multiplication:

    The composition of two functions is denoted by and defined as

    In contrast, the product of two functions is denoted by and defined as

    The first applies one function inside another, while the second multiplies their outputs.

  • Composition need not be commutative:

    In general, the two compositions may differ, or one of them may not be defined. Thus, we cannot assume that

    Often,

    In other words, the order matters because the output of one function becomes the input of the other. Some particular functions do commute, but this must be checked rather than assumed.

Example: Composition Is Not Commutative

A quick calculation shows why the order of composition matters.

Using the following functions, find both and to determine whether composition is commutative.

First, substitute into :

Next, substitute into :

Because , we see that function composition is not commutative.

Decomposing Functions

The idea of composition naturally leads to its reverse process, i.e., decomposition. While composition builds complex relationships by applying one function after another, decomposition involves expressing a single, complicated function in terms of simpler ones:

This approach makes functions easier to understand and, more importantly, easier to work with. It will play an important role later, particularly in Chapter 10, where recognizing how a function is composed of simpler parts becomes essential for applying the chain rule of differentiation.

Note that a single function may have more than one possible decomposition. In practice, we choose the one that makes the problem easier.

Method: Decomposing a Function

To decompose a function as :

  1. Identify the expression that is evaluated first; this becomes the inner function .
  2. Identify the operation applied to that expression; this becomes the outer function .
  3. Check the decomposition by recomposing: verify that .

Example: Decomposing a Square Root Function

When decomposing a function, the goal is to identify an inner expression and an outer operation.

Express as the composition of two simpler functions.

We are looking for functions and such that

To identify these functions, notice that appears inside the square root. This suggests the inner function produces , and the outer function takes the square root of its input. Thus, we can define

We can verify our decomposition by recomposing the functions:

Therefore, with

The domain of is . On this domain, , so its outputs are valid inputs for the square-root function .

Example: Decomposing a Nested Expression

For a more nested expression, we use the same idea but may group a larger inner expression first.

Express as the composition of two simpler functions.

We are looking for functions and such that

Here, the expression appears inside the denominator. We can treat that as the output of the inner function , and then let the outer function operate on that result. Thus, we can define

We can verify our decomposition by recomposing the functions:

Therefore, with

The denominator is zero when , which occurs at . Therefore, the domain of is .

Chapter 6: Polynomial Factorization

In Chapter 4, polynomials were introduced as a fundamental class of functions that can be written in the general form:

A polynomial consists of terms involving a variable (here, ) raised to non-negative integer powers and multiplied by constant coefficients. Formally, are its coefficients. For a nonzero polynomial, , the number is its degree, and is its leading coefficient. The zero polynomial, whose coefficients are all zero, is assigned no degree in this book.

In this chapter, we will learn how to manipulate and simplify polynomials in order to better understand their behavior, find their roots, and analyze their graphs. A key step in this process is factorization, which allows us to rewrite a polynomial as a product of simpler factors.

Basic Factorization

Before exploring general methods, recall that certain algebraic identities, introduced in Chapter 3, can be applied directly to polynomials. These identities often enable quick factorizations of specific expressions without the need for more elaborate techniques.

Definition: Factorization

Factorization is the process of rewriting an expression as a product of simpler factors.

For example, rewriting

as

is a factorization because the two factors multiply back to the original polynomial.

Example: A Difference of Squares

Suppose we want to factor the following polynomial:

This expression simply matches the difference of squares identity, so we apply it directly as follows:

While simple cases like this can be solved using known identities, most polynomial expressions, particularly trinomials, require a more systematic approach. Before applying any other method, first check whether all terms share a greatest common factor and factor it out. Let us now turn to the process of factoring trinomials.

Factoring Trinomials

One of the most common and useful techniques in algebra is factoring a trinomial, i.e., an expression with three terms, typically of the form:

The goal of factoring is to rewrite the trinomial as a product of two binomials:

Here , , , and are real coefficients chosen so that the product on the right expands back to the original expression on the left-hand side.

Method: Factoring Trinomials

This method assumes the coefficients , , and of the trinomial are integers.

To factor a trinomial of the form:

Step 1: Identify the coefficients:

  • is the coefficient of
  • is the coefficient of
  • is the constant term

Step 2: Find two integers such that:

Step 3: Rewrite the middle term as , giving a four-term polynomial:

Step 4: Proceed to factor by grouping, described in the next method.

Once the middle term has been split, the trinomial becomes a four-term polynomial. The next step is to apply the factorization by grouping method, a general strategy for breaking down such polynomials into products of simpler factors.

Method: Factorization by Grouping

Factorization by grouping applies when the terms can be divided into groups that share a common polynomial factor. In the trinomial method above, we apply it to the four-term polynomial

Step 1: Group the terms into two pairs:

Step 2: Factor out the greatest common factor (GCF) from each group:

When grouping is successful, the result has the form

where the same factor appears in both groups.

Step 3: Factor out the common polynomial factor:

If the two groups do not produce a common factor, try changing the order or grouping of the terms. If this still does not work, another factoring technique may be needed.

Example: Factoring a Trinomial

To see the trinomial method in a simple case, we will factor the trinomial

First identify the coefficients , , and . We need two integers and such that

The integers and satisfy both conditions, so we rewrite the middle term:

Now factor by grouping:

The final product shows the factorized form of the original trinomial.

Example: Factoring with a Nonunit Leading Coefficient

Factor

Here . The integers and have product and sum , so we split the middle term and group:

Multiplying the factors back together gives , which checks the factorization.

Warning: Limitations of the Grouping Method

While factoring by grouping is a useful technique, it does not always work.

If no common factor, such as a binomial, appears after grouping, another factoring technique may be needed. Failure of the grouping method does not by itself show that no factorization exists.

Example: Grouping a Four-Term Polynomial

Here is a four-term polynomial where grouping immediately reveals a common binomial factor. We want to factor the polynomial

Step 1: Group the terms into two pairs to prepare for factoring.

Step 2: Factor out the greatest common factor from each group.

Step 3: Factor out the common binomial.

Example: Grouping and Difference of Squares

In this example, grouping produces a factor that can be simplified once more using the difference of squares identity:

Step 1: Group the terms into two pairs to prepare for factoring.

Step 2: Factor out the greatest common factor from each group.

Step 3: Factor out the common binomial.

The remaining quadratic can be factored further using the difference of squares identity:

If we substitute this back into the expression, then we get:

Chapter 7: Equation Solving

Equations express the equality of two expressions and are essential tools for modeling and solving real-world problems. While a function describes the relationship between variables, solving an equation means finding the variable values that make the equality true. This chapter focuses on linear and quadratic equations, showing how algebraic solutions can also be interpreted geometrically as intersections and roots. Finally, it shows how the sign of a polynomial changes around its roots and uses this idea to solve inequalities.

Chapter 4 introduced two important types of points on the graph of a function: - and -intercepts.

To find the -intercepts, the output is fixed at zero. We solve

for the unknown input . Each solution gives an -intercept .

To find the -intercept, the input is fixed at . Provided that belongs to the domain, we evaluate

The -intercept is therefore the point . This is normally a function-evaluation problem: the input is known, and we calculate the corresponding output.

Thus, fixing an input leads to function evaluation, whereas fixing an output leads to equation solving.

The -intercept problem is a special case of a more general question. Instead of fixing the output at zero, suppose we specify an arbitrary output . We then find the corresponding inputs by solving

for . Graphically, the solutions are the -coordinates of the points where the graph of intersects the horizontal line . When , these points are the -intercepts.

Solving an equation means finding every value of the chosen variable that makes the equality true. Algebraically, we often rearrange the equation, when possible, to isolate that variable on one side and leave quantities that do not involve it on the other.

Method: Solving Equations

To solve an equation reliably:

  1. Record the domain and any restrictions, such as denominators that cannot equal zero or logarithm arguments that must be positive.
  2. Simplify both sides and use reversible algebraic transformations whenever possible.
  3. Isolate the chosen variable when possible.
  4. If a step is not reversible, treat the resulting values as candidates rather than confirmed solutions.
  5. Check all candidates in the original equation.
  6. State the final solution set.

An algebraic step is equivalent when it preserves exactly the same solution set. Equivalent steps are reversible: they can be undone. Adding or subtracting the same expression on both sides is reversible, as is multiplying or dividing both sides by the same known nonzero number. In this book, connects equivalent equations.

If a step cannot always be reversed, we use instead. This means that every solution of the equation before the arrow satisfies the equation after it, but the new equation may have additional solutions. Values obtained after such a step are therefore candidates that must be checked in the original equation.

Example: Equivalent Transformations

Consider the equation

Subtracting from both sides and then dividing both sides by gives

Both steps can be reversed, so all three equations have the same solution.

Warning: Extraneous Solutions

Squaring both sides is a common step that cannot always be reversed. If , then

However, for real numbers and ,

The squared equation therefore includes the original case , but it also allows the additional case . Squaring can consequently add solutions that were not present in the original equation. Such values are called extraneous solutions.

For this reason, connect a squaring step with , treat the resulting values as candidates, and check them in the original equation.

Example: An Extraneous Solution

Solve

The square root is defined when , so the domain is . Squaring both sides gives a necessary condition:

The candidates are therefore and . Both belong to the domain, but they must still be checked in the original equation:

Thus, the solution set is . The candidate satisfies the squared equation but not the original equation, so it is extraneous.

Solutions to Equations as Roots

The preceding section focused on solving equations through valid algebraic transformations and, when possible, isolating the chosen variable. Another useful formulation places all terms on one side and zero on the other. For an equation between two functions,

Define the difference function

The original equation is then equivalent to . This places the equation in a form that can be interpreted through roots.

Definition: Root of a Function

A root of a function , also called a zero, is an input value such that .

If is real, the corresponding -intercept is the point on the graph. Thus, a root is a number, while an -intercept is a point.

Consequently, solving is equivalent to finding the real roots of their difference , or graphically the -coordinates of the points where the graph of meets the -axis.

Solving Linear Equations

In this section, we illustrate the equation-solving process for the case where the resulting function is linear. In such cases, solving is equivalent to finding the root of the linear function .

Example: Roots of a Linear Function

The figure below shows the same equation in two ways: as an intersection problem and as a root-finding problem.

Two side-by-side plots showing the intersection of a linear function and a constant function, and the corresponding root of their difference.
Figure 7.1. Left: Graphs of the given functions and . Right: Solving as a root-finding problem for the resulting linear function .

Consider the functions:

Here, is linear and is a constant function.

Finding the intersection of the graphs means determining such that:

We can convert this into a root-finding problem by moving all terms to one side, expressing the equation in the standard form :

Here, the left-hand side can be regarded as a new function . Finding its root is equivalent to solving the original equation:

The solution is the input-coordinate of the point where the graphs of and intersect. In terms of the root-finding approach, it is the root of , and is the corresponding point where the graph of meets the -axis.

Solving Quadratic Equations

In this section, we illustrate the equation-solving process for the case where the resulting difference is quadratic. In such cases, solving is equivalent to finding the root of the quadratic function .

Example: Roots of a Quadratic Function

Here the same root-finding idea applies to two quadratic functions, producing two intersection points.

Two side-by-side plots showing the intersections of two quadratic functions, and the corresponding roots of their difference.
Figure 7.2. Left: Graphs of the given functions and . Right: Solving as a root-finding problem for the resulting quadratic function .

Consider the functions:

Here, and are both quadratic.

Finding the intersection of the graphs means determining such that:

We convert this to a root-finding problem by moving everything to one side:

At this stage, we have reduced the problem to solving a quadratic equation:

There are two standard ways to find its roots:

  1. By factoring the quadratic expression into a product of two linear factors.
  2. By applying the quadratic formula, which works even when factoring is not straightforward.

In the examples that follow, we will illustrate both approaches, using the same function .

Solving Via Factorization

Factoring a quadratic expression means expressing it as a product of two linear factors. If this is possible, the zero product property can be applied:

This allows us to solve a quadratic equation by setting each factor equal to zero.

Method: Solving by Factorization

To solve a polynomial equation by factorization:

  1. Rewrite the equation so one side is .
  2. Factor the polynomial as a product of simpler factors.
  3. Use the zero product property by setting each factor equal to .
  4. Solve the resulting simpler equations.
  5. Check that the solutions satisfy the original equation.
  6. State the final solution set.

Example: Solving by Factorization

We are given the quadratic polynomial

and want to factor it using the grouping method introduced in Chapter 6.

The expression contains three terms, but the grouping method requires four. Thus, the first step is to rewrite the trinomial as a four-term polynomial. This can be done using Method: Factoring Trinomials.

Step 1: Identify coefficients:

  • is the coefficient of the highest-order term
  • is the coefficient of the second-highest-order term
  • is the constant term

Step 2: Find two integers , such that

Choosing and satisfies these conditions since and .

Step 3: Rewrite the middle term using and :

Now we can apply the grouping method as described in Method: Factorization by Grouping.

Step 1: Group the terms into pairs:

Step 2: Factor out the greatest common factor (GCF) from each group:

Step 3: A Common binomial factor appears:

Finally, we can now apply the zero product property to solve for :

Solving Via The Quadratic Formula

Another way to find the roots of is to apply the quadratic formula.

Formula: The Quadratic Formula

Consider the quadratic equation:

where . The solutions of this equation are given by the quadratic formula:

The discriminant determines the number of real solutions:

  • If : two distinct real solutions.
  • If : one real (repeated) solution.
  • If : no real solutions.

The square root denotes the non-negative principal square root. The symbol then tells us to use both its positive and negative signs in the numerator.

Example: The Quadratic Formula

To solve the quadratic equation

we set , , and in the formula:

Hence, we get:

These match the solutions obtained by factoring.

Factorized Form and Roots of a Polynomial

Just as quadratic equations can be expressed in factorized form as

higher-order polynomials can sometimes be written as products of real linear factors. This happens when all their roots are real; otherwise, irreducible quadratic factors remain when working over the real numbers.

Definition: Real Factorized Form of a Polynomial

If a real polynomial of degree has real roots , counted with repetition, then it can be expressed as

where is the leading coefficient and each satisfies . A repeated value in the list represents a root with multiplicity greater than one.

Not every real polynomial has this form using real linear factors. For example, has no real roots and cannot be factored into real linear factors. More generally, a real polynomial factors into real linear factors and irreducible quadratic factors. Over the complex numbers, every degree- polynomial factors into linear factors when multiplicities are counted.

This form reveals several geometric features of the polynomial:

  • The number of linear factors equals the degree when all roots are real and multiplicities are counted
  • Each distinct real root corresponds to the -intercept
  • The coefficient determines the vertical stretch and orientation of the curve. For example, changing its sign reflects the graph across the -axis.

The following examples illustrate how these properties appear graphically.

Examples: Factorized Form of a Polynomial

Three polynomial plots in factorized form with roots marked by x-intercepts.
Figure 7.3. Polynomials in factorized form. Each root corresponds to an -intercept where .

Consider the first polynomial in the plot:

This function has three linear factors, so the polynomial is of degree three. The roots, listed in the order they appear in the algebraic expression, are , , and . At each of these values, one factor becomes zero, defining an -intercept where the graph meets the -axis.

Now look at the second polynomial in the plot:

The only difference is the sign of the leading coefficient. Changing it from to reflects the entire graph across the -axis, while the roots remain in the same order and at the same positions.

Finally, consider the third polynomial in the plot:

Here we have four linear factors, so the polynomial is of degree four. The roots, again listed in the order of the factors, are , , , and . As before, each root defines an -intercept where the graph meets the -axis.

Function Signs Around Roots

Finding the roots of a function does more than just tell us where it intercepts the -axis: It also reveals where the function takes on positive or negative values.

By analyzing the sign of between its roots, we can determine on which intervals the function lies above or below the -axis, and thus describe its overall behavior.

The concepts of a function being increasing on an interval and decreasing on an interval further describe how the function behaves within those intervals, i.e., whether it rises or falls as changes.

These ideas are closely related: once the roots are known and the sign of is determined, examining whether the function is increasing or decreasing helps us describe its overall shape and how it varies. Together, they provide a more complete picture of a function’s behavior, even without graphing it.

Definitions: Positive and Negative Intervals

These terms describe where the graph of a real-valued function lies relative to the -axis.

Positive interval. The function is positive on an interval if for all in that interval.

Negative interval. The function is negative on an interval if for all in that interval.

Graphically, this corresponds to whether the graph of the function lies above (positive) or below (negative) the -axis.

For a continuous function on an interval, the sign can change only at a root. In particular, polynomials are continuous, so their roots divide the real line into intervals on which the sign remains constant. When a domain has a gap, different domain components can have different signs without a root between them. For example, is continuous on each interval and , but it is undefined at and has opposite signs on the two components.

A polynomial need not change sign at every root. It crosses the -axis at a root of odd multiplicity, while it touches the axis and turns around at a root of even multiplicity.

Example: Determining the Function Sign

For our quadratic function , we found earlier, that the roots are:

These roots divide the real line into three intervals:

By testing a single point in each interval (for instance, ), we find:

Table 7.1. Sign of on intervals determined by its roots.

IntervalTest ValueSign of Behavior
is positive
is negative
is positive
A graph and sign chart for a quadratic function showing positive intervals outside the roots and a negative interval between the roots.
Figure 7.4. The roots divide the real line into intervals where the function keeps a constant sign.

Solving Inequalities

Equations ask where two expressions are equal. Inequalities ask where one expression is less than, greater than, less than or equal to, or greater than or equal to another expression. The answer is often not a single number, but a set of numbers.

For example, solving

means finding all input values for which the graph of lies above the -axis. This connects inequalities directly to the sign analysis introduced above.

Definition: Solution Set of an Inequality

The solution set of an inequality is the set of all values that make the inequality true.

For one-variable inequalities, solution sets are often written using interval notation or set-builder notation.

Example: Solution Set of an Inequality

The inequality

has solution set

Number line showing the solution set x greater than 2.
Figure 7.5. The open circle at shows that is not included, and the arrow to the right shows all values greater than .

Method: Solving Linear Inequalities

To solve a linear inequality:

  1. Simplify both sides.
  2. Collect the variable terms on one side and the constant terms on the other.
  3. If the coefficient of the variable is nonzero, divide by it. If it is negative, reverse the inequality sign.
  4. If the variable terms cancel, determine whether the remaining statement is always true or always false.
  5. Write the final solution set using interval or set-builder notation.

Warning: Reversing the Inequality Sign

When multiplying or dividing both sides of an inequality by a negative number, the direction of the inequality must be reversed.

Example: Solving a Linear Inequality

Solve

We isolate :

The solution set is

Number line showing the solution set x less than or equal to 4.
Figure 7.6. The closed circle at shows that is included, and the arrow to the left shows all values less than .

Example: Dividing by a Negative Coefficient

Solve

Dividing both sides by reverses the inequality sign:

The solution set is

Number line showing the solution set x greater than negative 3.
Figure 7.7. Dividing by a negative coefficient changes into .

Some inequalities combine two conditions. Logical symbols make the distinction between conditions and their solution sets precise. If and are inequality predicates, then requires both conditions, while requires at least one. The corresponding solution sets are combined using intersection and union, respectively.

Definition: Compound Inequality

A compound inequality is an inequality statement that combines two or more inequalities.

  • A statement using and, written with , requires both inequalities to be true, so the solution set is an intersection.
  • A statement using or, written with , requires at least one inequality to be true, so the solution set is a union.

For example, is shorthand for the conjunction

Method: Solving Compound Inequalities

To solve a compound inequality:

  1. Separate the compound statement into its individual inequalities.
  2. Solve each inequality.
  3. Combine the individual solution sets using intersection for and or union for or.
  4. Write the final solution set using interval notation.

Example: Compound Inequality With And

Solve

We isolate throughout the compound inequality:

The solution set is

The bracket at means that is included, while the parenthesis at means that is not included.

Number line showing the compound inequality one less than or equal to x less than four.
Figure 7.8. The solution is the interval where both conditions hold: and .

Example: Compound Inequality With Or

Solve

The connective means that a value only needs to satisfy one of the two inequalities. Therefore, the solution set is the union

Number line showing the solution set x less than negative one or x greater than or equal to two.
Figure 7.9. The two parts of the solution set do not overlap, so the answer is written as a union of two intervals.

Polynomial inequalities can be solved by first finding the roots and then checking the sign of the expression on the intervals determined by those roots.

Method: Solving Polynomial Inequalities

To solve a polynomial inequality such as or :

  1. Move all terms to one side so the inequality compares a function with .
  2. Find the roots of the function.
  3. Use the roots to divide the real line into intervals.
  4. Test one value in each interval to determine the sign of the function.
  5. Select the intervals on which the sign satisfies the inequality.
  6. Include roots for or , and exclude them for or .
  7. Write the final solution set using interval notation.

Example: Solving a Quadratic Inequality

Solve

The roots are and . These split the real line into three intervals:

Testing one value from each interval gives:

Table 7.2. Sign test for .

IntervalTest valueSign of
Positive
Negative
Positive

We need the expression to be greater than or equal to , so we choose the positive intervals and include the roots:

Number line showing the solution set for the quadratic inequality.
Figure 7.10. The roots and are included because the inequality is .

The union symbol appears naturally here because the solution consists of two separate intervals. This is one reason why the set operations from Chapter 2 are useful when solving inequalities.

Equation solving for exponential and logarithmic functions continues in Chapter 8, after inverse functions and logarithm rules have been introduced.

Chapter 8: Functions III: Mappings and Inverses

Chapter 4 introduced functions, their representations, and several basic function classes, while Chapter 5 showed how functions can be combined and composed. We now study how functions map their domains to their codomains, when those mappings can be reversed, and how inverse relationships can be used to solve non-linear equations. We conclude by determining whether a relation defines a function.

Injective, Surjective, and Bijective Functions

Functions can also be classified based on how they relate elements of their domain to elements of their codomain. While algebraic form determines a function’s shape or formula, mapping properties determine whether the function is injective, surjective, or both.

Definition: Injective Function

A function is injective (or one-to-one) if it never assigns the same output value to two different inputs. In other words, each output in comes from at most one input in .

More formally, we can write:

Or in plain words: If two inputs of a function give the same output, then those inputs must be equal.

Example: Checking Injectivity

The figure contrasts a function where each output comes from at most one input with one where two inputs share an output.

Injective and non-injective functions
Figure 8.1. Left: An injective function. Right: A non-injective function.

Let be defined by:

This function is injective because different -values always produce different -values. However, is not injective on since .

Definition: Surjective Function

A function is surjective (or onto) if every element of the codomain appears as an output of the function. Equivalently,

More formally, we can write:

Or in plain words: For every possible output value in the codomain, there exists at least one input value in the domain that produces it.

Example: Surjective Function

Surjectivity is about whether the function reaches every output in the codomain; the figure compares a function that covers the codomain with one that leaves gaps.

Surjective and non-surjective functions
Figure 8.2. Left: A surjective function that covers all possible -values in the codomain. Right: A non-surjective function which leaves gaps.

Let be defined by:

For any , there exists , so is surjective. However, from is not surjective because negative -values are never reached.

Definition: Bijective Function

A function is bijective if it is both injective and surjective. This means that distinct inputs have distinct outputs, and every element of is produced by an input from .

Equivalently, a bijective function establishes a one-to-one correspondence between the sets and , so that nothing is repeated and nothing is left out.

Example: Bijective Function

A bijective function combines both requirements: no output is repeated, and none are missing.

Bijective function
Figure 8.3. A bijective function: distinct inputs produce distinct outputs, and every element of the codomain is reached.

Let be defined by:

The function is bijective because each input produces a unique output (injective) and every real number occurs exactly once as an output (surjective).

Inverse Functions

An inverse function reverses the input-output mapping of a function. It is useful when we know an output and want to recover the input that produced it.

Definition: Inverse of a Function

A mapping diagram showing a function from a domain to a codomain and its inverse mapping back.
Figure 8.4. A function and its inverse reverse the direction of the mapping between domain and codomain.

Let be a bijective function. Its inverse satisfies

for all and . Thus, applying followed by , or vice versa, returns the original value.

The inverse allows us to solve by applying :

Warning: Existence and Notation

  • A function has an inverse on its stated codomain only if it is bijective. If it is not injective, an output may correspond to several inputs; if it is not surjective, some elements of the codomain cannot be reversed.
  • The notation represents the inverse function, not the reciprocal:

Definition: Identity Property of Inverses

For the notation below, means that is applied first and then , while the identity function on a set is defined by . Function composition was introduced in Chapter 5.

The composition of a function and its inverse returns the identity function on the respective domains:

The inverse reverses the domain and codomain of . Graphically, its graph is the reflection of the graph of across the line .

Method: Finding an Inverse Function

To find an inverse function:

  1. Write the function as .
  2. Solve the equation for in terms of .
  3. Rewrite the result as , or rename the input variable.
  4. Check that composing the two functions in either order returns the original input.

Example: Finding and Checking an Inverse Function

Let be defined by

To find its inverse, solve for :

Therefore,

For example, gives

We can check the formula in both directions:

and

A graph showing f(x)=3x+5, its inverse, and the reflection line y equals x.
Figure 8.5. For , the graph of is the reflection of the graph of across the line .

Common Inverses

The table below shows frequently used inverse-function pairs with the domain and range of the original function. The restrictions shown are part of the function definition and ensure that the mapping is bijective.

Table 8.1. Common inverse-function pairs with domains and ranges.

Function Inverse Domain of Range of
,
,
, a positive odd integer
, a positive even integer (principal root)
, ,
, ,

Logarithm Rules

Let , , and . For a logarithm base with , the most important rules are:

Table 8.2. Common logarithm rules.

RuleFormulaDescription
Logarithm Product RuleThe logarithm of a product equals the sum of the logarithms.
Logarithm Quotient RuleThe logarithm of a quotient equals the difference of the logarithms.
Logarithm Power RuleA power in the argument becomes a multiplier in front of the logarithm.
Logarithm of 1Any valid base raised to the power equals .
Logarithm of the BaseAny valid base raised to the power equals itself.
Inverse PropertyExponential and logarithmic functions cancel each other.
Natural Log of The natural logarithm means logarithm to base .
Change of BaseHere and .

The natural logarithm is , where . These rules mirror the exponent rules introduced in Chapter 3.

Solving Non-Linear Equations

Many equations in mathematics involve non-linear functions such as exponentials and logarithms. The solving principles remain the same: we transform the equation into an equivalent one where the variable of interest is isolated, checking that the solution satisfies any domain restrictions.

With inverse-function pairs and logarithm rules now established, we can use them to undo the operation affecting the variable. In particular, when the variable appears in an exponent, we apply a logarithm to both sides, and when it appears inside a logarithm, we apply an exponential.

Example: Solving an Exponential Equation

Let us solve the equation , for .

Example: Solving a Logarithmic Equation

Solve the equation for . Assume that , as the logarithm otherwise is not defined. We obtain:

Both candidates satisfy the domain restriction because , so both are solutions of the original equation.

Testing Relations

Method: Checking Whether a Relation Is a Function

To check whether a relation describes as a function of :

  1. For a list of ordered pairs, check that each input has only one associated output .
  2. Graphically, use the vertical line test: each vertical line should intersect the graph at most once.
  3. Algebraically, try to solve for in terms of . If one input can produce more than one output, the relation is not a function of .

Graphically

A relation in which each -coordinate is matched with exactly one -coordinate describes as a function of . If the same -coordinate is associated with two different -coordinates, then the relation is not a function of .

Example: Checking Functional Relations

Which of the following relations describe as a function of ?

In , the input is matched with both and . Hence, does not describe as a function of . In , every input has exactly one corresponding output, so does describe as a function of .

Two coordinate plots comparing a relation that is not a function with a relation that is a function.
Figure 8.6. fails because one input has two outputs; passes because each input has one output.

The Vertical Line Test

Definition: Vertical Line Test

A vertical line test diagram comparing a polynomial function with a circle that is not a function.
Figure 8.7. The polynomial passes the test, while the circle fails because some vertical lines meet it twice.

A relation describes as a function of if and only if every vertical line intersects its graph at most once.

If a vertical line intersects the graph more than once, the relation assigns more than one output to the same input and therefore violates the definition of a function.

An equation can describe a valid relation, such as a circle, without defining as a function of . Such relations may require another representation, for example an implicit or parametric description.

Algebraically

We can also check whether an equation defines a function by solving for one variable in terms of the other. If solving produces more than one output value for the same input, then the relation does not describe a single function.

Example: Equation That Is Not a Function

Does the equation represent as a function of ?

First, solve for :

For inputs with , this gives two outputs, one positive and one negative. Therefore, the circle does not describe as a single function of . The upper and lower semicircles can instead be described separately by and , each with domain .

Chapter 9: Limits

Limits describe the behavior of functions near a point and provide the foundation for continuity and differentiation. This chapter introduces limits, uses them to define continuity and discontinuity, and then presents the main limit laws used in calculations.

Limits

The concept of a limit concerns the value that a function approaches as its input gets closer to a particular point. Importantly, what happens exactly at that point is not what matters, instead, we focus on what happens around the point.

Function values approaching a limit as x approaches c
Figure 9.1. Illustration of the limit idea: as approaches , the corresponding values move toward a height . This limiting height need not equal .

Understanding the concept of a limit is fundamental as it allows us to study the continuity of functions, a property describing whether a function behaves smoothly without abrupt jumps or breaks. Furthermore, limits provide the foundation for the derivatives introduced in Chapter 10, which describe rates of change.

Example: A Limit from a Graph

To illustrate this and build an intuitive understanding of the concept of limit, consider the function and its corresponding graph:

Graph of a piecewise function with jumps at one and pi.
Figure 9.2. Piecewise function used to illustrate limits at ordinary points and jump points.

Let us consider the limit of as . This means that we look at values of for in some small interval around . In this case, this corresponds to examining the function on the interval . If we look the graph of this function, we can see that as approaches from either the left or the right, the value of approaches .

Therefore, the limit of as can be expressed symbolically as:

This example illustrates the basic idea behind limits. We now state this idea in more general terms.

Definition: Limit

Let be a function defined on an open interval containing (with the possible exception of itself). Let be a real number. If all values of the function approach the real number as the values of approach the number , then we say that the limit of as approaches is .

In words, as gets closer to , gets closer and stays close to . Symbolically, we express this idea as

if and only if

Here means approaching from the right (positive direction) and means approaching from the left (negative direction).

Example: When a Limit Does Not Exist

Not every function has a limit at every point. A limit may fail to exist for several reasons. To illustrate this, we return to our earlier example and now consider and . At each of these points, the left-hand and right-hand limits differ:

Since these one-sided limits are not equal, does not exist. The same reasoning applies at .

Another way a finite limit can fail to exist is if the function grows without bound. For example,

As increases, grows without bound. We express this behavior using the extended notation

Here describes the input becoming arbitrarily large, while the symbol on the right describes the output growing without bound. The symbol is not a real number, so this does not represent a finite limit.

Limits at Infinity and Infinite Limits

The notation

means that approaches the finite value as becomes arbitrarily large. For example,

By contrast, writing means that the outputs grow without bound as approaches the finite number . One-sided behavior still matters. For example,

Because these one-sided behaviors do not agree, the two-sided limit does not exist.

Continuity

The discussion about when limits exist and do not exist leads to the concept of continuity. A continuous function has no jump, gap, or mismatch between the value approached by the function and the value the function actually takes.

Definition: Continuity

Let be a function, where is the domain of .

At an interior point of , the function is said to be continuous at if

That is, as approaches , the value of approaches the same number that actually takes at .

If is an endpoint of the domain, continuity is defined using the one-sided limit from within the domain. For example, at a left endpoint , continuity means

At an interior point, we can break this definition into its essential parts:

  1. The limit exists: The left-hand and right-hand limits of at are equal. In symbols,

    This ensures that approaches a single, well-defined value near .

  2. The function value is defined: The point exists, meaning that belongs to the domain . Without a defined value at , the concept of continuity cannot apply.

  3. The limit equals the function value: The value that approaches near is exactly the same as the value it takes at :

    This guarantees there is no jump or gap in the function’s behavior at that point.

If is continuous at every point , then we say that is continuous on .

Continuity can therefore be viewed as a local property at each point, which extends to a global property when it holds throughout the entire domain.

In practice, most functions we encounter (such as polynomial, exponential, logarithmic, and trigonometric functions) are continuous on the domains we care about.

Example: Checking Continuity at a Point

Consider the function

We want to determine whether is continuous at .

  1. The limit exists:

    Since both one-sided limits are equal, the limit exists and equals 2. The condition is satisfied.

  2. The function value is defined:

    The function has a defined value at . The condition is satisfied.

  3. The limit equals the function value:

    The limit and the function value are not equal. The condition is not satisfied.

Since the third condition fails, is not continuous at .

Discontinuity

Continuity gives us a precise way to describe when a function behaves smoothly at a point. A discontinuity occurs when at least one part of the continuity definition fails.

Definition: Discontinuity

A function is discontinuous at a point if it is not continuous at .

This can happen if:

  • the two-sided limit does not exist,
  • the function value is not defined, or
  • the limit exists but does not equal the function value.

Example: Jump Discontinuity

Consider the function from the earlier limit example, where has jumps at and .

At , the one-sided limits are different:

Because the left-hand and right-hand limits do not agree, the two-sided limit does not exist. Therefore, has a jump discontinuity at .

Discontinuity does not always mean that the limit fails to exist. Sometimes the limit exists, but the function value is different.

Example: Discontinuity with an Existing Limit

Here is an example where the graph approaches one value, but the function is defined to take another value at the point.

Graph with an open point at zero and a separate filled point showing a removable discontinuity.
Figure 9.3. Removable discontinuity at : the limit is while .

Looking at the graph, it is clear that despite , the actual function value is . Since the limit and function value are not equal, is discontinuous at .

Limit Laws

In Chapter 5, arithmetic operations were used to combine two functions. The table below shows the corresponding rules for limits, assuming both and exist.

Rules: Limit Laws

The following rules allow us to compute limits of combined functions from the limits of the individual functions.

Table 9.1. Limit laws for combining functions.

OperationLimit Law
Constant Multiple
Sum/Difference
Product
Quotient

Rule: Direct Substitution

If is continuous at , then

Thus, direct substitution can be used for polynomials and for rational, root, exponential, logarithmic, and trigonometric expressions at points where the expression is defined and continuous.

Example: Using Limit Laws

This calculation shows how the limit laws let us split a combined expression into simpler parts.

Determine

  1. Split into two limits (use the difference law):

  1. Evaluate each part directly (direct substitution):

Example: Factoring Before Taking a Limit

Sometimes direct substitution produces an indeterminate form; then algebraic simplification can reveal the limit.

Determine

  1. Check direct substitution (does not work!):

  1. Factor numerator and cancel the common factor. For , the fraction simplifies to . Although the original function is not defined at , the limit only concerns nearby values with :

  1. Evaluate the expression (direct substitution):

Chapter 10: Differentiation

Differentiation is the process of finding the derivative of a function, which tells us the slope of the function at a single point on its graph.

In Chapter 4, we defined slope in the context of a linear function. To extend this concept to more general functions, we first define secant lines (slopes over an interval) and then tangent lines (slopes at a single point). These ideas allow us to quantify how a function changes.

Secant & Tangent Lines

Curve with a secant line through two points on the graph.
Figure 10.1. A secant line approximates the slope of a curve over an interval.

The slope of a secant line to a function at a point gives an average rate of change of a function between and a nearby point.

To compute it, we pick a value of close to , say (where ), and draw a line through the points , and . The slope of this line is:

Definition: Slope of a Secant Line

Let be a function defined on an interval containing . If and , the slope of the secant line is:

This expression is also called the difference quotient.

Example: Slope of a Secant Line

This computation turns the geometric idea of a secant line into an average rate of change.

Find the slope of the secant line to the graph of between and .

The two points on the graph are

Thus, the secant slope is

This value is the average rate of change of on the interval from to .

Definition: Tangent Line

Let be a function defined in an open interval containing . The tangent line to at is the line passing through with slope:

provided this limit exists.

Example: Tangent Slope for a Square Root Function

To find a tangent slope, we let the second point move toward the first using the limit definition.

Find the slope of the tangent line to the graph of at .

The Derivative of a Function

Definition: The Derivative of a Function

Let be a function. The derivative of at is:

provided the limit exists. If the limit exists for all , we say that is differentiable on .

Note that instead of writing , we can also write or . All three expressions denote the derivative of with respect to .

The prime notation is concise and often used in basic calculus or when the variable is clear from context.

The Leibniz notation , on the other hand, emphasizes the operation of differentiation and explicitly indicates the variable, making it useful in contexts with, e.g., several variables or when applying rules like the chain rule.

Example: The Derivative of a Linear Function

Consider the linear function . For any , we compute the derivative of the function as follows:

This makes sense, as a linear function is a straight line with constant slope.

Example: The Derivative of a Quadratic Function

Consider the quadratic function , for any . We compute the derivative of the function, using the limit laws, as follows:

Common Derivatives

Rules: Common Derivatives

Below is a table of some of the most frequently used derivatives. Here , , , and the power rule is applied at points where is real-valued and differentiable. In particular, the rule holds for every real when , and nonzero integer powers can be used on their usual domains. The case is covered by the constant rule. The trigonometric rules assume that angles are measured in radians.

Table 10.1. Common derivative rules.

Function Derivative Notes
Constant rule
Power rule, on its differentiable domain
-
-
-

Common Differentiation Rules

Rules: Differentiating Combinations of Functions

Just like for limits, there are certain rules that we can apply when differentiating functions. In this context, let and be differentiable functions on an interval. For the quotient rule, we additionally require at the point under consideration. The following rules then hold:

Table 10.2. Rules for differentiating combinations of functions.

RuleFormulaName
Sum/DifferenceSum/Difference Rule
ProductProduct Rule
QuotientQuotient Rule
Constant MultipleConstant Multiple Rule

Example: Applying the Product Rule

Here is how the derivative table combines with the product rule in a concrete calculation.

Using the rules in the table, compute the derivative of the function .

Letting and , we get and . Following the order in the product rule gives

Expanding the final expression returns the previous line, which checks the factorization.

Example: Product and Quotient Rules

This example applies the product and quotient rules to the same pair of functions so that the two calculations can be compared directly.

Let

Their derivatives are

First, apply the product rule while keeping and separate:

Next, apply the quotient rule. Since , the quotient is defined only when :

Thus, the derivative of the quotient is at every point in its domain. The simplification does not define the original quotient or its derivative at .

The Chain Rule

We have seen the techniques for differentiating basic functions as well as sums, differences, products, quotients, and constant multiples of these functions. However, these techniques do not allow us to differentiate compositions of functions. In this section, we study the rule for finding the derivative of the composition of two or more functions.

Rule: The Chain Rule

Function composition diagram showing the mappings from the domain through an intermediate set to the codomain.
Figure 10.2. Function composition: the output of becomes the input of .

Let and be functions such that:

  • is differentiable at
  • is differentiable at

For the composite function:

the derivative is then defined as:

Method: Applying the Chain Rule

To differentiate , follow the steps:

  1. Identify the outer function and the inner function
  2. Differentiate with respect to its argument to get
  3. Evaluate by substituting into
  4. Differentiate with respect to its argument to get
  5. Compute as

Example: Differentiating a Square of Sine

For this composition, identify the outer square and the inner sine function before applying the chain rule.

Differentiate .

To do so, we let:

  • The outer function be , so
  • The inner function be , so

Applying the Chain Rule, we then get:

Example: Differentiating an Exponential Composite Function

Here the exponent contains a polynomial, so the exponential function is the outer function.

Differentiate .

To do so, we let:

  • The outer function be , so .
  • The inner function be , so .

Applying the Chain Rule, we then get:

Finding Extrema

In this section, we focus on an important application of derivatives: finding maxima and minima of functions.

Definitions: Local Minima and Maxima

These terms describe extreme values near a point.

Let be defined on a domain containing .

Local minimum. The value is a local minimum if there is an open interval around such that for all points in that interval that also belong to the domain.

Local maximum. The value is a local maximum if there is an open interval around such that for all points in that interval that also belong to the domain.

By contrast, is an absolute minimum or absolute maximum on an interval if the corresponding inequality holds for every . Local and absolute maxima and minima are collectively called extrema.

Theorem: The Extreme Value Theorem

Let be a continuous function defined on a closed, bounded interval . Then has both an absolute maximum and an absolute minimum value on .

The Turning Point of a Quadratic Function

Recall from Chapter 4 that a turning point of a graph is a point at which the graph changes direction from increasing to decreasing or vice versa. For a quadratic function, this point is also called the vertex. If with , the turning point is:

We will later see how to derive this point by setting the first derivative of the function to zero and solving for (i.e., ).

For , with discriminant , the turning point is:

Since , the parabola opens upwards, and the turning point is the minimum point. This can also be confirmed by inspecting the graph.

Derivatives & Local Extrema

The derivative measures the slope of the tangent line at . If is differentiable at an interior input and has a local maximum or minimum there, then

This result is sometimes called Fermat's theorem. An interior number in the domain is called a critical number if or does not exist. If exists, the corresponding graph point is called a critical point. Critical numbers are candidates for extrema, but they need not actually produce extrema. Endpoints must also be considered when finding absolute extrema on a closed interval.

Two generic smooth curves showing a local maximum and local minimum, each with a horizontal tangent at x zero.
Figure 10.3. At smooth local extrema, the tangent line is horizontal, so the derivative is zero.

To classify critical numbers, we can use the so-called first derivative sign test or second derivative test.

Test: The First Derivative Sign Test

Let be an interior number in the domain. Assume that is continuous at and differentiable on intervals immediately to the left and right of .

  • If changes from positive to negative at , then has a local maximum there.
  • If changes from negative to positive at , then has a local minimum there.
  • If is positive on both sides of , or negative on both sides, then has no local extremum there.

If is zero throughout part of a neighboring interval, this simple sign test may be inconclusive. The behavior on the flat interval should then be checked directly from the definition of a local extremum.

Test: The Second Derivative Test

Suppose that . If exists, then

  • If we have a local minimum
  • If we have a local maximum
  • If , the test gives no information

If does not exist, the test does not apply.

Method: Finding Local Extrema

To find local extrema using derivatives:

  1. Compute the first derivative .
  2. Find the critical numbers in the domain, where or where is undefined.
  3. Use the first derivative sign test or, when applicable, the second derivative test to classify each critical number.
  4. Substitute each classified critical number into to find the corresponding function value.

If is continuous on a closed interval , it has absolute extrema on that interval. Find all critical numbers in , evaluate at those numbers and at the endpoints, and then compare the values. The largest is the absolute maximum and the smallest is the absolute minimum. If is not continuous on , this candidate comparison is not sufficient without further analysis.

Warning: Critical Numbers Are Candidates

The equation identifies candidates, not guaranteed extrema. A derivative may equal zero without changing from increasing to decreasing or vice versa. Likewise, an extremum can occur at an endpoint or at an input where the derivative does not exist.

Example: Finding Local Maxima and Minima

The derivative tests turn this optimization question into finding and classifying critical numbers.

Find the local maxima and minima of the function .

We differentiate and obtain

In order to find the critical numbers where , we solve the quadratic equation . The discriminant is and the roots are thus

Differentiating once again, we obtain

and by calculation, and . Thus, has a local maximum at and a local minimum at . The corresponding critical points are and .

A plot of the cubic function with its local maximum and local minimum marked.
Figure 10.4. The critical numbers found from correspond to a local maximum point and a local minimum point on the graph.

Chapter 11: Multivariable Functions

So far, we have focused on functions of a single variable, where each input is a single number and each output is a single number . Many situations, however, involve relationships between more than one independent variable.

When working with two independent variables, say and , it is natural to consider ordered pairs , where each coordinate is a real number. The set of all such pairs is denoted by and is often thought of as the Cartesian plane. Similarly, ordered triples form , which we interpret as three-dimensional space. More generally, denotes the set of all ordered -tuples , where each coordinate is a real number.

Definition: Multivariable Function

A real-valued multivariable function of variables assigns to each input

exactly one real number .

Such a function is also called a function of several variables.

This is written as:

  • The set is called the domain of and contains all valid inputs (points in ) for which is defined.
  • The range (or image) of is the set of all actual outputs:

Examples: Multivariable Functions

Multivariable functions appear whenever an output depends on more than one input.

  • The temperature at a given location may depend on both latitude and longitude.
  • The profit of a company may depend on both the number of units sold and the unit price.
  • Crop yield may depend on both fertilizer amount and rainfall.

In each case, the input is not a single number but a collection of values, such as an ordered pair .

Visualizing Multivariable Functions

When , the graph of a function can be drawn in a two-dimensional coordinate system. When , we can represent the graph in three dimensions, with the third axis showing the value of . For , it is no longer possible to directly visualize the graph in physical space, but other techniques, such as level curves and function traces, can be used to represent the function’s behavior.

To illustrate these ideas conceptually, we extend the crop yield model from Chapter 4 to include an additional factor. The purpose of the example is to interpret the different visual representations; no particular fitted formula or underlying data set is needed.

Example: Extended Crop Yield Model

In reality, crop yield depends on more than just fertilizer amount. Another important factor is rainfall, denoted by (in millimeters over a growing season of about days, i.e., months). We now model crop yield as a function of two variables:

Here, assigns a real-valued yield to each ordered pair in a suitable domain , for example, inputs with kg/ha of fertilizer and mm of rainfall. The surface below is an illustrative model intended to make the visual ideas concrete; it should not be interpreted as an empirically fitted crop model.

Illustrative surface showing crop yield as a function of fertilizer and rainfall.
Figure 11.1. Graph of the crop yield as a function of fertilizer and rainfall .

Because depends on two variables, its graph lives in three dimensions: the horizontal plane represents (fertilizer) and (rainfall), while the vertical axis represents (yield). Although 3D graphs are possible, they can be difficult to interpret—especially for decision-making—so we often use level curves and function traces instead.

Level Curves or Contours

Level curves show where the function has the same value, making it easier to identify trade-offs and regions of interest.

Definition: Level Curve of a Function

For a function of two variables , a level curve (or contour) is the set of all points in the domain where the function takes a fixed constant value :

In the -plane, a level curve connects all points where produces the same output.

Example: Level Curves for Crop Yield

In the crop yield model, a level curve for represents all combinations of fertilizer and rainfall that yield the same harvest.

For a fixed yield , the level curve is:

For example, the level curve for shows all fertilizer-rainfall combinations producing a yield of tonnes per hectare.

Contour plot showing combinations of fertilizer and rainfall with equal crop yield.
Figure 11.2. Level curves (contours) of crop yield.

From a contour plot, we can answer questions such as:

  • "If I want t/ha, how can I trade fertilizer for rainfall?"
  • "Where is the optimal combination of fertilizer and rainfall for maximum yield?"

Level curves are especially useful for visualizing decision boundaries and trade-offs when multiple factors influence an outcome.

Function Traces

Function traces help us examine cross-sections of the surface by fixing one variable and varying the other.

Definition: Trace of a Function

For , a trace is obtained by fixing one variable and letting the other vary:

Trace in the -direction. Fix and consider

This curve lies in the vertical plane parallel to the -plane.

Trace in the -direction. Fix and consider

This curve lies in the vertical plane parallel to the -plane.

Example: Function Traces for Crop Yield

For the crop yield model, traces show how yield changes when one input is fixed and the other is allowed to vary.

First, fix fertilizer at kg/ha and vary rainfall. The trace shows how yield changes with rainfall for that fertilizer level.

Trace showing crop yield as rainfall varies while fertilizer is fixed.
Figure 11.3. Trace: Yield vs Rainfall with Fertilizer fixed at kg/ha.

Second, fix rainfall at mm and vary fertilizer. The trace shows how yield changes with fertilizer for that rainfall level.

Trace showing crop yield as fertilizer varies while rainfall is fixed.
Figure 11.4. Trace: Yield vs Fertilizer with Rainfall fixed at mm.

From these traces, we can identify thresholds, such as the fertilizer amount beyond which adding more no longer increases yield.

Interpreting Level Curves and Traces

When a formula is available, finding level curves and traces reduces to substituting a fixed value or solving an equation. The algebraic and graphical techniques are the same as those used for curves in two dimensions, but here they are applied to cross-sections and slices of surfaces. For a conceptual model such as the crop-yield example, the same representations can instead be interpreted directly from a graph or data visualization.

Examples: Domains and Ranges of Multivariable Functions

The following examples show how domain restrictions come from the algebraic form of the function.

Find the domain and range of each function.

  1. Linear function. First, consider

    There are no algebraic restrictions on or , so every ordered pair is allowed. Therefore, the domain is .

    The expression can produce any real output, so the range is .

  2. Square-root function. Next, consider

    For the output to be real, the expression under the square root must be non-negative:

    Therefore, the domain is

    For the range, the square root produces non-negative outputs. Its smallest value is , and its largest value is , so the range is .

Chapter 12: Sequences, Sums, and Products

This chapter introduces notation for working with ordered lists of numbers and with repeated addition or multiplication. These ideas appear throughout mathematics whenever we want to describe a pattern compactly instead of writing out every term.

Sequences

A sequence is an ordered list of numbers. For example,

is a sequence. A sequence differs from the sets introduced in Chapter 1 because order matters. When we use variables to represent terms in a sequence, we attach an index to each term:

The numbers in the subscripts are called indices (the plural of index).

Definition: Sequence

A sequence is an ordered list of numbers. We often denote the entire sequence by

When the index range is clear, we may write this more simply as . In either case, is the term with index . Braces are also sometimes used in the notation , but parentheses more clearly emphasize that a sequence is ordered, unlike an ordinary set.

Definitions: Sequences and Tuples

Finite sequence. A finite sequence is an ordered list with a fixed number of terms:

The number is the length of the finite sequence.

Infinite sequence. An infinite sequence, such as , continues indefinitely.

-tuple. An -tuple is another name for a finite sequence of length . In this chapter, an object that continues indefinitely is simply called a sequence rather than a tuple.

Finite Sequences as Coordinates

Chapter 11 introduced points with two, three, or more real coordinates. In the language of sequences, a point in is a finite sequence of real numbers:

where

For example, has two coordinates and represents a point in the plane, while has three coordinates and represents a point in three-dimensional space.

The coordinate points (2, 3) in the plane and (2, 3, 1) in three-dimensional space, shown without vector arrows
Figure 12.1. Finite real sequences interpreted as points in two- and three-dimensional coordinate spaces.

Here, each tuple identifies a point. In linear algebra, the same tuple can give the coordinates of a vector; context determines the interpretation.

Warning: A Tuple Is Not a Set

The finite sequence

is a -tuple. As a tuple, both order and repetition matter. Therefore,

because the entries occur in a different order.

As a set, repeated elements are only listed once, so

Tuples and sets are therefore different mathematical objects and should not be used interchangeably.

Summation Notation

Definition: Summation Notation

Given a sequence and integers and satisfying , the sum from to is written

The variable is called the index of summation. The number is the lower limit of summation, while the number is the upper limit of summation.

Example: Expanding Sums

Expanding a sum makes the lower limit, upper limit, and pattern of terms explicit.

To illustrate this, we can expand the following sum by writing out the first few terms.

We can similarly do it with the following sum:

Example: Writing Sums in Sigma Notation

Suppose we are given the following sum:

This sum can be written as

Now, consider the alternating sum:

This sum can be written as

The sign alternates because when is even and when is odd. Here, is even when is odd and odd when is even, so the terms have signs .

Example: Evaluating Sums

When the limits are finite, one direct way to evaluate a sum is to write out all its terms.

First, evaluate the following sum:

Writing out the terms from through gives

Next, consider a sum whose terms are powers of :

Writing out the terms and converting them to decimals gives

The index variable is a dummy variable: it can be changed without changing the value of the sum. For instance,

This is similar to how the name of a variable inside a programming loop can often be changed without changing what the loop computes.

Some algebraic rules make it possible to simplify sums without expanding every term.

Properties: Summation Notation

Let be a constant. For finite sums, the following properties are often useful.

Adding term by term. For sums with the same lower and upper limits,

Constant multiple. Constant factors can be pulled outside a sum:

Sum of a constant. A constant added repeatedly is multiplied by the number of terms:

Splitting a sum. If , then a sum can be split into two parts:

Warning: A Common Mistake with Sums

In general, a sum of products is not the product of sums:

Example: Using Properties of Sums

Consider the following sum:

First, use the term-by-term addition property to separate the two parts of each term:

Next, pull the constant factor outside the first sum. The second sum contains four copies of :

Finally, expand the remaining sum and evaluate:

We can check the result by expanding the original sum directly:

Both routes give the same value. This direct expansion illustrates why the properties work in this example without serving as a general proof.

Summation notation also appears in mathematical definitions. For example, it allows the polynomials introduced in Chapter 4 to be written in the form

Here:

  • is a non-negative integer.
  • are real constants.
  • For a nonzero polynomial, , and is its degree.

The zero polynomial has all coefficients equal to zero. Its degree is left undefined in this book.

Product Notation

If we want to multiply elements of a sequence instead of adding them, we use product notation.

Definition: Product Notation

Given a sequence and integers and satisfying , the product from to is written

The variable is called the index of multiplication. The number is the lower limit of the product, while is the upper limit of the product.

Example: Expanding Products

Expanding a product makes the lower limit, upper limit, and pattern of factors explicit.

To illustrate this, consider the following product:

Writing out each factor gives

Now, consider a product with a general upper limit :

Substituting successive values of gives

Example: Writing Products in Pi Notation

Suppose we are given the product of the first even positive integers:

This product can be written as

Now, consider the product of the first odd positive integers:

This product can be written as

Example: Evaluating Products

When the limits are finite, a product can be evaluated by writing out and multiplying all its factors.

First, consider a constant factor repeated times:

because the factor is multiplied by itself times.

Now, evaluate the following finite product:

Writing out its factors gives

Factorial notation is a common shorthand for a product of consecutive positive integers.

Definition: Factorial

For a positive integer , the factorial of , written , is defined by

It is also standard to define

Example: Factorials and Product Notation

First, consider the product of the first five positive integers. By the definition of factorial,

Now, consider the product of the first even positive integers. Each of the factors contains a factor of , so these factors can be collected as :

Product notation has algebraic properties similar to summation notation, but the operation is multiplication rather than addition.

Properties: Product Notation

Let be a constant. For finite products, the following properties are often useful.

Multiplying term by term. For products with the same lower and upper limits,

Constant factor. A constant factor appears once for each value of the index:

Product of a constant. In particular,

Splitting a product. If , then a product can be split into two parts:

Example: Using Properties of Products

Consider the following product:

The constant-factor property gives

We can check the result by expanding the original product directly:

Again, the direct expansion illustrates the property in this example; the general rule is the one stated above.

Warning: A Common Mistake with Products

In general, a product of sums is not the sum of products:

Comparing Sums and Products

Summation and product notation have the same basic anatomy: both specify an index, a lower limit, an upper limit, and a term that changes with the index. The operation symbol determines whether those terms are added or multiplied.

For completeness, when an index range contains no terms, we use the conventions

These values preserve the usual rules for splitting sums and products.

Indexed Unions and Intersections

Chapter 2 introduced the union and intersection of two sets. When working with a finite sequence of sets

we can use indexed notation to combine all of them compactly.

Definition: Indexed Unions and Intersections

The indexed union contains every element that belongs to at least one of the sets:

The indexed intersection contains every element that belongs to all of the sets:

As with summation and product notation, is the index, while and specify its lower and upper limits.

Example: Indexed Union and Intersection

Consider the following three sets:

First, form their indexed union by collecting the elements that occur in at least one set:

Next, form their indexed intersection by keeping only the elements that occur in every set:

Thus, the union contains all four elements appearing across the sets, whereas the intersection contains only the shared element .

The same notation can be used for an infinite sequence of sets. The indexed union

contains the elements that belong to at least one set in the sequence. In contrast, the indexed intersection

contains the elements that belong to every set in the sequence.

Sums and Products Over Sets

The sums and products above run over consecutive integer indices, such as . In some mathematical statements, however, the index runs over the elements of a set instead. This is useful when the objects being added or multiplied are not naturally described by consecutive integers.

Definition: Sums and Products Over a Finite Set

Let be a finite set, and suppose that assigns a number to each element . The notation

means that we add the values for all elements in . Similarly,

means that we multiply the values for all elements in .

If , then

and

For finite sets, the order of the elements does not matter because addition and multiplication are commutative.

Example: Summing and Multiplying Over a Set

For a finite set, the notation tells us to apply the rule to each element and then combine the results.

Consider the set

First, square each element of and add the resulting values:

Next, add to each element of and multiply the resulting values:

Set-indexed notation is also useful when the set contains labels rather than numbers. For example, let

be a set of categories, and let denote the number of observations in category . The total number of observations across the categories can then be written as

When using this notation, remember that a set contains each element only once. If repeated values matter, for example in a data set where the same value occurs multiple times, a sequence, list, or frequency table may be more appropriate than an ordinary set.

Chapter 14: Mathematical Logic

This chapter introduces the basic concepts of mathematical logic. These principles form part of the foundation for digital circuits, formal mathematical reasoning, and conditional logic in programming. The focus is the mathematical language of propositions, predicates, connectives, and truth tables.

Propositions and Predicates

Propositions and predicates both express mathematical claims, but they differ in whether a truth value has already been determined. A proposition is a complete statement that is true or false. A predicate contains one or more variables and becomes a proposition after values are assigned to the variables or after a claim is made about the allowed values.

Definition: Proposition

A proposition is a declarative statement that can be assigned a definite truth value: true or false, but never both.

Examples: Propositions

The following are examples of propositions:

  • "Four is even." (True)
  • "1 + 1 is 3." (False)
  • "." (True)
  • "." (False)

Definition: Predicate and Domain

A statement involving an unspecified variable, such as "" or " is even," is called a predicate or open statement. It does not yet have one fixed truth value. The domain is the set of allowed values for the variable, and the truth of the predicate depends on which value is chosen from this set.

Example: Predicate

Let be the predicate " is even" with domain . Substituting a value for produces a proposition: is true, while is false.

Stating that holds for every integer, or that it holds for at least one integer, also produces a proposition. The symbols for these statements are introduced near the end of the chapter.

A flow from a predicate and a selected domain value to a proposition with a definite truth value.
Figure 14.1. Here, is the domain (the set of allowed values for ), and choosing turns the predicate into the proposition with a definite truth value.

The distinction provides the link to logical operations: predicates describe conditions, substituted values turn those conditions into propositions, and logical connectives combine propositions into more complex statements. This framework supports mathematical proofs and conditional statements in programs.

Logical Operations

Logical operations extend the connection between predicates and propositions. If and are predicates with the same domain, then the combined condition " and " is a new predicate. After a value is selected, and are propositions, and their combined statement has a definite truth value.

More generally, propositions can be combined using logical connectives such as and, or, not, if...then..., and if and only if. Each connective has a precise meaning and a standard symbolic representation.

Except for negation (not), which acts on a single proposition, all logical operations act on pairs of propositions. Since each proposition can be either true () or false (), there are four possible combinations of truth values for two propositions. The effect of a logical operation on these combinations is most clearly shown using a truth table.

Definitions: Logical Connectives

Logical connectives are symbols or words used to build compound propositions from simpler propositions.

Conjunction. The connective means " and " and is true only when both propositions are true.

Disjunction. The connective means " or " and is true when at least one proposition is true.

Negation. The connective means "not " and reverses the truth value of .

Conditional. The connective means "if , then " and is false only when is true and is false.

Biconditional. The connective means " if and only if " and is true when and have the same truth value.

An AND gate with inputs p and q and output p and q. An OR gate with inputs p and q and output p or q. A NOT gate with input p and output not p.
Figure 14.2. The logical connectives AND, OR, and NOT correspond directly to three basic gates used in digital circuits.

Conjunction (AND)

If and are propositions, their conjunction, " and ," denoted by , is defined by the truth table:

Note: Reading Truth Tables

Each row in the table represents one possible case. The conjunction is true only when both and are true, just as in ordinary language.

The symbols , , and are commonly used as placeholders for propositions, similar to how , , and are used for numeric variables.

Example: Conjunction

For , the conditions and require to satisfy both inequalities simultaneously:

The following values illustrate that the conjunction is true only when both inequalities are true:

Table 14.1. Truth values for a conjunction of two inequalities.

010
111
100

Thus, the conjunction is true exactly for .

Disjunction (OR)

If and are propositions, their disjunction, " or ," denoted by , is defined by:

This operation reflects the inclusive or, meaning the result is true if either or both propositions are true.

Example: Disjunction

A quadratic equation has two possible solutions:

For , the following values illustrate that the disjunction is true when at least one of the equations is true:

Table 14.2. Truth values for a disjunction of two equations.

011
000
101

Thus, the disjunction is true exactly for or .

Negation (NOT)

Negation, denoted by , is the only standard operation that applies to a single proposition.

Example: Negation

The statement that is not equal to is written

For , the following values illustrate that negation reverses the truth value of the original equation:

Table 14.3. Truth values for negating an equation.

10
01
01

Conditional

The conditional statement "If then ," denoted , is defined by:

The conditional is false only when is true and is false. The symbol is a logical connective: it combines and to form a new proposition whose truth value is given by the table. It does not by itself state that is true or that has been inferred.

Example: Conditional

Let and consider the conditional predicate "If is greater than , then is even." This is written

The selected values illustrate the four possible combinations and highlight the case where the conditional is false:

Table 14.4. Truth values for a conditional statement.

is even
111
100
011
001

Converse and Contrapositive

Note: Converse and Contrapositive

The converse of is .

The contrapositive of is . The original conditional and its contrapositive always have the same truth value, while the converse need not have the same truth value.

Example: Conditional Forms

Let the domain be the integers, and define the predicates

  • : " is divisible by ," and
  • : " is even."

The three associated conditional forms are:

  • Original: .
  • Converse: .
  • Contrapositive: .

The relationship between these forms comes from the truth table:

Table 14.5. Truth values for a conditional, its converse, and its contrapositive.

00111
01101
10010
11111

The original and contrapositive columns agree in every row. For the integer predicates, the original conditional holds for every integer because a number divisible by can be written as for some and is therefore even. The converse is false: is even but is not divisible by . The contrapositive states that an integer that is not even cannot be divisible by , and its truth values match those of the original conditional.

Biconditional

If and are propositions, the biconditional, " if and only if ," denoted , is defined by:

The biconditional is true when and share the same truth value, i.e., both true or both false. Like the conditional, is a connective that forms a proposition. A particular biconditional may therefore be true or false. It expresses logical equivalence only when it is true in every possible case.

Example: Biconditional

For a real number , the number is zero if and only if both and :

Both sides have the same truth value for every real number .

Example: Biconditional Inequality

For a real number , compare the conditions " is not less than " and " is greater than or equal to ":

The table illustrates the agreement for three values. The two predicates agree for every real because any real number that is not less than must be greater than or equal to :

Table 14.6. Truth values for a biconditional involving inequalities.

1001
0111
0111

Tautologies and Contradictions

Tautologies and contradictions describe expressions whose truth values do not vary from one possible case to another.

Tautology

Definition: Tautology

A tautology is a logical expression that is true in every possible case. The symbol is often used to denote a tautology.

Examples: Tautologies

A tautology covers every possible truth case. Examples include:

  • ("Either is true, or it is not.")
  • ("If both and are true, then is true.")

Example: Tautological Predicate

Over the domain , consider the predicate

For each fixed value of , this predicate becomes a true proposition. It has the tautological form . Equivalently, the statement "for every real number , either or " is a true proposition.

The table illustrates the predicate for a few values. Its universal truth does not follow from testing these examples; it follows because every value of is either equal to or not equal to :

Table 14.7. Truth values showing a tautology.

101
011
011

Contradiction

Definition: Contradiction

A contradiction is a logical expression that is false in every possible case. The symbol is often used to denote a contradiction.

Examples: Contradictions

A contradiction combines conditions in a way that can never be satisfied. Examples include:

  • (" and not ," which is impossible to be true simultaneously.)
  • ("Either or is true, but neither nor is true.")

Example: Contradictory Predicate

Over the domain , consider the predicate

For each fixed value of , this predicate becomes a false proposition. Equivalently, the statement "for every real number , it is not the case that both and " is a true proposition.

The table illustrates the predicate for a few values. The conclusion for every real follows because no number can be both greater than and less than :

Table 14.8. Truth values showing a contradiction.

010
000
100

Logical Equivalence

Two propositional expressions and are logically equivalent, written , if they have the same truth value under every assignment of truth values to their component propositions. The symbol states that this general relationship has been established; it is not another connective with a separate truth table. Equivalently, the biconditional

is a tautology.

The conditional and its contrapositive give one example:

Example: De Morgan's Law

Consider two propositions:

  • : "I have been to Toronto."
  • : "I have been to Chicago."

Now compare these two propositions:

  • : "I have not been to both Toronto and Chicago."
  • : "I have not been to Toronto or I have not been to Chicago."

The two expressions have the same truth value in every possible case. Thus:

Table 14.9. Truth values for De Morgan's law.

0011
0111
1011
1100

The final two columns agree in every row, which verifies the equivalence.

Example: Logical Equivalence

Over the domain , the predicate " is not less than " is logically equivalent to " is greater than or equal to ":

Implication and Bi-implication

The earlier sections distinguished propositions from predicates. If and are propositions, then and are compound propositions with truth values determined by their truth tables. If and are predicates with the same domain, then

are also predicates. Choosing a value from the domain turns them into the propositions and . These propositions may be true for some values and false for others.

Implication arises when the corresponding conditional is valid throughout the relevant domain. If is true for every allowed value of , then implies , written

Similarly, bi-implication arises when the corresponding biconditional is valid throughout the domain. If is true for every allowed value of , then and bi-imply one another, written

For propositional expressions, the same distinction is made across all relevant assignments of truth values. Thus,

and

Equivalently, a bi-implication consists of two implications, one in each direction:

The small arrows and therefore form propositions that can be evaluated in a particular case. The large arrows and state that the corresponding relationship is valid in every relevant case.

For propositional expressions, and both communicate logical equivalence. This book uses when comparing logical expressions and also uses for reversible reasoning or algebraic steps with the same solution set. This common convention is used throughout this book, although some texts use these symbols differently.

Example: One-way and Two-way Predicates

Let the domain be , and define

  • : "," and
  • : "."

For every real number , is true. Therefore,

The reverse conditional fails at , because is true while is false. Consequently, and do not bi-imply one another.

Now define

  • : "," and
  • : "."

For every real , both and are true. Hence,

or, written directly,

The two predicates have the same truth value throughout the domain, and the two equations have the same solution set.

Valid Inference

Implication describes a relationship that is valid across the relevant cases. An inference applies propositions in a particular argument: it starts from one or more assumed propositions, called premises, and draws a conclusion. The inference is valid if there is no possible case in which all the premises are true and the conclusion is false.

A predicate does not yet have a fixed truth value, so it must first be turned into a proposition by choosing a value or making a statement about its domain before it can serve as a premise. In this book, marks a valid conclusion or a one-way reasoning step; it is not a connective used to form a proposition.

Example: Valid Inference

Suppose and are both given as premises. Then follows:

This inference is valid because, when is true, the conditional can be true only when is also true. Thus, there is no case in which both premises are true and the conclusion is false.

Statements that a predicate holds for every value in a domain or for at least one value are propositions. The notation for expressing these domain-wide claims is introduced next.

Additional Notation

A few other foundational logical symbols are commonly used in mathematics. Predicate logic is not developed in detail in this course, but the table below provides a brief overview of notation used in definitions, proofs, and statements about sets or functions.

Quantifiers are especially important because they turn open statements involving variables into propositions by specifying whether a claim holds for every element of a domain or for at least one element. The two central quantifiers, together with closely related notation, are introduced below.

Table 14.10. Common logical notation and its meaning.

SymbolOperationDescription
Universal quantifierMeans "for all" or "for every"; the statement must hold for every object in the given domain.
Existential quantifierMeans "there exists"; the statement must hold for at least one object in the given domain.
Unique existence quantifierMeans "there exists exactly one"; the statement must hold for one and only one object in the given domain.

Connection to Set Theory

Logic and set theory describe closely related ideas from different viewpoints. A predicate states a condition that elements of a domain may or may not satisfy, while a set can collect precisely the elements that satisfy that condition. In this way, a logical statement can be viewed as describing membership in a corresponding set.

Logical operations then parallel familiar set operations from Chapter 2: "and" resembles intersection, "or" resembles union, and "not" resembles complement. This connection is also why identities such as De Morgan's laws have the same general structure in logic and set theory.

More precisely, let mean "" and let mean "." Then

In each row, the logical condition and the corresponding set-membership statement are true for exactly the same values of .

Chapter 15: Probability

Probability gives us a way to measure how likely it is that something will happen. We use probabilities when reasoning about uncertainty, making decisions, and interpreting information in areas such as weather forecasts, games, business decisions, insurance, and data science models.

In this chapter, we use two complementary viewpoints. Sometimes probabilities can be computed from a mathematical model of the possible outcomes. Other times, probabilities are estimated from repeated observations or collected data. Both viewpoints use the same basic language of experiments, outcomes, sample spaces, and events.

Probability Terminology

Before discussing how to find probabilities, we need a few basic terms.

Definitions: Probability Terminology

These terms describe the possible results of a random experiment and the collections of results we want to study.

Random experiment. A random experiment is an activity or operation with a result that cannot be predicted ahead of time.

Outcome. An outcome is any possible result from conducting an experiment.

A dashed sample space S containing an event E. Outcomes x and y lie inside E, while outcomes z and w lie elsewhere in S.
Figure 15.1. The sample space contains all possible outcomes. The event contains the outcomes and , while and are outcomes in but not in .

Sample space. The sample space, usually denoted , is the set of all possible outcomes of an experiment.

Event. An event, denoted , is a subset of the sample space and describes a collection of outcomes.

Example: Rolling a Die

Consider an experiment of rolling a regular six-sided die. There are six possible outcomes, so the sample space is

Examples of events include:

  • Rolling a 2: .
  • Rolling an even number: .
  • Rolling a number greater than 4: .

Example: Tossing Two Coins

Two distinguishable coins, labeled 1 and 2, are tossed at the same time. In each outcome, the first letter records Coin 1 and the second records Coin 2. The sample space is

If event is "getting at least one head," then

If event is "getting one head and one tail," then

A dashed sample space S containing the nested events E and F. HT and TH lie in E, HH lies in F but outside E, and TT lies outside F.
Figure 15.2. The nested regions show : and belong to both events, belongs only to , and belongs to neither event.

Example: Coin and Die Outcomes

Gabe performs an experiment of flipping a coin and then rolling a regular six-sided die.

The sample space contains all possible coin-die outcomes:

If event is "rolls an odd number," then

If event is "gets tails and rolls an even number," then

A dashed sample space S containing separate event regions A and B. The outcomes H2, H4, and H6 lie outside both events.
Figure 15.3. The separate regions show that events and are mutually exclusive, or disjoint, subsets of . The outcomes , , and lie outside both events.

Theoretical Probability

One way to learn about a probability is to repeat an experiment many times and record how often an event occurs. This is not always practical, and in some situations it is not necessary. For simple experiments such as rolling a fair die or drawing from a well-shuffled deck of cards, we can often compute probabilities directly from a mathematical model of the sample space.

The key assumption in this section is that all outcomes in the sample space are equally likely. This means that every individual outcome has the same chance of occurring. Under this assumption, finding the probability of an event becomes a counting problem: count the outcomes in the event and compare that number with the total number of outcomes in the sample space.

Definition: Probability

Probability is a numerical measure of the likelihood that an event will occur. If is an event, then denotes the probability that event occurs.

Definition: Theoretical Probability

A theoretical probability is based on a mathematical model for the sample space.

can be viewed as a function: it takes an event as input and returns a number between and . The value is the probability that event occurs.

Under the equally likely model, if is an event in a finite sample space , then

In this model, each single outcome has probability

Example: Rolling a Six-Sided Die

Using the equally likely die model, start with the sample space and then count how many outcomes belong to each event.

Let

Define the events

Find the probability of each event:

  • Rolling a 2, represented by :
  • Rolling an even number, represented by :
  • Rolling a number greater than 4, represented by :
  • Rolling a 7:
  • Rolling a number less than 7:

Note: When Outcomes Are Not Equally Likely

The counting formula

only applies when all outcomes in the sample space are equally likely.

For a finite or countable discrete sample space whose outcome probabilities are known, the probability of an event is found by adding the probabilities of the outcomes in that event:

Example: A Loaded Die

Suppose a loaded six-sided die has sample space

but the outcomes are not equally likely. For example, suppose

These probabilities add to , so they define a valid probability model for the individual outcomes.

If is the event of rolling an even number, then

Since the outcomes are not equally likely, we do not use . Instead,

The examples above motivate the following basic properties of valid probabilities.

Properties: Probability

Impossible event. An event that cannot occur has probability . In set notation, the impossible event is the empty set. If , then

Certain event. An event that must occur has probability . The sample space is the certain event. If , then

Partition of the sample space. If events are mutually exclusive and together cover the whole sample space, then

Bounds. The probability of any event must be between and , inclusive:

Combining Events

The set operations introduced in Chapter 2 provide a compact way to describe events that occur together or separately.

Definitions: Unions and Intersections of Events

Let and be events in the same sample space.

Union. The event occurs when occurs, occurs, or both occur.

Intersection. The event occurs when both and occur.

Mutually exclusive events. Events and are mutually exclusive, or disjoint, if they cannot occur in the same trial. In set notation,

When adding and , outcomes in have been counted twice. Subtracting their probability once gives the addition rule.

Rule: Addition Rule

For any two events and ,

If and are mutually exclusive, then , so

Example: Union and Intersection

Roll a fair six-sided die. Let be the event of rolling an even number and let be the event of rolling a number greater than . Then

Therefore,

The result can be checked directly because contains four of the six equally likely outcomes.

Conditional Probability and Independence

Sometimes additional information changes the sample space under consideration. Conditional probability describes this change.

Definition: Conditional Probability

If , the probability of given that has occurred is

Rearranging this definition gives the multiplication rule

Example: Conditional Probability

One card is drawn from a well-shuffled standard deck. Let be the event that the card is an ace and the event that it is a spade. Given that the card is a spade, only the spades remain under consideration, and one of them is an ace. Thus,

Definition: Independent Events

Events and are independent if knowing that one occurred does not change the probability of the other. Equivalently,

If , this is equivalent to .

Warning: Mutually Exclusive vs. Independent

Mutually exclusive events cannot occur together. Independent events do not affect each other's probabilities. If two events have positive probability and are mutually exclusive, then they are not independent because their intersection has probability .

Example: Independent Trials

Flip a fair coin and roll a fair six-sided die independently. Let be the event of getting heads and the event of rolling a . Then

A Minimal Counting Rule

Suppose an experiment is repeated times. We call the occurrence of an event of interest on any trial a success. If we want exactly successes, those successes can occur in different positions within the sequence. For instance, two successes in five trials could occur in the first two trials, the first and third trials, and so on.

To determine the probability of exactly successes, we must account for every possible arrangement of those successes among the trials. The binomial coefficient counts these arrangements.

Definition: Binomial Coefficient

The binomial coefficient

counts the number of ways to choose positions from positions, where and are integers satisfying and . Here and .

Example: Two Successes in Five Trials

Suppose five trials contain exactly two successes. Write for success and for failure. Each arrangement is determined by choosing which two of the five positions contain the successes. Therefore,

so there are possible arrangements. For example, has successes in positions and .

Complements

Complements use the set-theoretic idea from Chapter 2: instead of counting outcomes in an event, we can sometimes count the outcomes not in it.

Definition: Complement

If is an event in sample space , then the complement of , denoted , is the set of all outcomes in that are not in :

The events and are mutually exclusive and together cover the entire sample space. Therefore,

so

A dashed sample space S containing event E, with its complement shown by diagonal hatching outside E.
Figure 15.4. An event and its complement split the sample space into two disjoint parts whose probabilities add to one.

Example: Complement of an Event

Roll a fair six-sided die and let

be the event of rolling an even number. Then the complement is the event of rolling an odd number:

Since ,

A dashed die sample space S with the even outcomes inside event A and the odd outcomes in the hatched complement.
Figure 15.5. The even outcomes lie in ; the odd outcomes lie in the diagonally hatched complement . Together, the two regions cover the sample space .

Empirical Probability

Theoretical probability depends on a model. In many real situations, however, the model may be unknown, too complicated, or not based on equally likely outcomes. In those cases, we can estimate probabilities from data by repeating or observing the experiment and recording how often the event occurs.

Definitions: Theoretical and Empirical Probability

These two terms distinguish model-based probabilities from data-based estimates.

Theoretical probability. A theoretical probability is computed from a mathematical model.

Empirical probability. An empirical probability is an estimate based on collected data. After trials, if the event occurs times, its relative frequency is

Note: Fractions, Decimals, Percentages, and Proportions

Probabilities are numbers between and . They can be written as fractions, decimals, or proportions on this scale.

To write the same quantity as a percentage, multiply the decimal by and add the percent sign. For example,

so is when written as a percentage.

A relative frequency is an observed proportion: it tells us what fraction of the trials produced an event. It can also be reported as a percentage by multiplying the proportion by .

Example: Empirical Probability with Two Coins

Suppose two distinguishable fair coins are tossed independently and we are interested in the event

meaning exactly one head and one tail.

The theoretical probability is

As a percentage, multiply by : , so this is .

If we perform the experiment times and observe or in of the trials, then the empirical probability is

As a percentage, multiply by : , so this is .

The empirical probability differs from the theoretical probability because it is based on a small number of trials.

Example: Theoretical and Empirical Probability

Consider drawing one card at random from a well-shuffled standard 52-card deck and recording whether the card is a queen.

The theoretical probability of drawing a queen is

which is about , so about .

If the experiment is repeated times, with the card replaced each time, and a queen is drawn times, then the empirical probability is

which is , so .

The Law of Large Numbers

Empirical probabilities can vary substantially when the number of trials is small. As the number of trials increases, they tend to stabilize near the theoretical probability.

Law: The Law of Large Numbers

The Law of Large Numbers states that, over many independent repetitions of the same experiment, the empirical probability of an event tends to approach its theoretical probability.

For repeated independent tosses of two distinguishable fair coins, the event has theoretical probability . Suppose the experiment is repeated many times:

Table 15.1. Empirical probability of one head and one tail over repeated trials.

Number of TrialsTimes ObservedEmpirical Probability
107
2013
3017
4022
5026

Notice that the empirical probability begins to approach the theoretical probability .

Running empirical probability of one head and one tail converging toward 0.5 over repeated two-coin tosses.
Figure 15.6. The running empirical probability for fluctuates but gradually stabilizes near the theoretical value .

The table and figure show the main idea of the law: the empirical probability can fluctuate from trial to trial, but over many repetitions it tends to move closer to the theoretical probability. This approach is not necessarily monotone: after an additional trial, the estimate can temporarily move farther away before later moving closer again.

Chapter 16: Statistics

Statistics gives us tools for collecting, organizing, describing, and interpreting data. We use statistics to uncover patterns, make predictions, and support decision-making under uncertainty.

In this chapter, we introduce basic statistical vocabulary, methods for displaying data, and numerical summaries for the center, spread, and position of a data set.

Population, sample, data, statistics, and parameters
Figure 16.1. Relationship between a population, a sample, observed data, statistics, and parameters.

The figure previews the main idea behind statistical reasoning: we observe data from a sample, compute statistics from those data, and use them to learn about the larger population.

Populations, Samples, Parameters, and Statistics

When working with data, we usually want to say something about a larger group. The language of populations, samples, parameters, and statistics helps us distinguish between the group we care about and the data we actually observe.

Definitions: Population, Sample, Parameter, and Statistic

These four terms come in two related pairs: population and sample describe the group being studied, while parameter and statistic describe numerical summaries.

Population. The population of a study is the entire group the collected data is intended to describe. If the population has units, we may write it as

The units may be people, objects, or events. A variable assigns a measurement or category to each unit. If a quantitative variable gives the values for the population units, then these values, rather than the units themselves, enter numerical calculations.

Sample. A sample is a smaller subset of the population, ideally one that is representative of the whole population. If the sample contains units, we often write their observed values as

where is the sample size.

Parameter. A parameter is a fixed numerical characteristic of a population. Parameters are usually denoted with Greek letters, such as the population mean

Statistic. A statistic is a value calculated from the data in a sample. Statistics are often used to estimate population parameters. For example, the sample mean

may be used to estimate the population mean .

Note: Common Statistical Notation

Statistical notation often indicates the role of a quantity:

  • A bar usually denotes an average. For example, is the sample mean.
  • A hat usually denotes an estimate. For example, may estimate an unknown population proportion .
  • Greek letters often denote population parameters, such as the population mean and standard deviation .
  • Latin letters often denote sample statistics, such as the sample mean and standard deviation .
  • A subscript identifies an individual value or group, as in for the th observation.

These are common conventions rather than universal rules, so each symbol should still be defined when introduced.

Example: Population, Sample, Parameter, and Statistic

Suppose an online shop wants to understand the spending behavior of all customers during a year.

  • The population is all customers who bought something from the shop during that year.
  • A sample might be the first customers shown in this chapter.
  • A parameter could be the true mean spending of all customers that year.
  • A statistic could be the mean spending of the sampled customers, which we can compute from the observed data.

Populations can be made up of people, objects, events, or measurements. Examples include patients in a hospital, all cars produced by a factory in one year, books in a library, daily temperatures in a city, or earthquake occurrences worldwide.

Sampling Methods

Studying a full population is often impractical, so we choose a sample. The quality of the sample matters: a well-designed sample supports valid conclusions, while a biased sample can lead to misleading conclusions.

The following table summarizes common sampling methods.

Table 16.1. Common sampling methods and their selection rules.

Sampling methodHow the sample is selectedMain idea or concern
Simple random sampleEvery possible sample of a fixed size has the same probability of being selected.Treats all samples of that size symmetrically.
Stratified sampleThe population is divided into meaningful groups, called strata, and units are sampled from each group.Ensures important groups are represented.
Cluster sampleThe population is divided into clusters, some clusters are randomly selected, and all units in those clusters are surveyed.Useful when surveying units across the full population is impractical.
Systematic sampleA random starting point is chosen, and then every th unit is selected.Simple to carry out, but can be biased if the ordering has a pattern.
Convenience sampleData are collected from units that are easy to reach.Often biased because easy-to-reach units may not represent the population.

The figure below shows the same population under the different selection rules.

Five panels illustrating simple random, stratified, cluster, systematic, and convenience sampling methods.
Figure 16.2. Common sampling methods applied to the same population. Red markers indicate selected sample units; in cluster sampling, whole groups are selected, while in convenience sampling the selected units come from an easy-to-reach part of the population.

This is not an exhaustive list. Other sampling designs exist, but these are among the most common introductory examples.

Warning: Sampling Bias

Sampling bias is a systematic tendency for some parts of the population to be overrepresented or underrepresented. It makes it harder to use a sample statistic as a reliable estimate of a population parameter. Unequal selection probabilities do not by themselves imply bias if the sampling design and analysis account for them, as can happen in stratified sampling.

Categorizing Data

To compute statistics, we start with a data set organized into observations and variables. Each observation, or record, contains the information collected about one unit, such as a person or object. A variable is a characteristic measured or described for every unit, and a data value is one recorded value of one variable.

We will use the following online customer data set throughout the chapter.

Table 16.2. Online customer data used as the running example in this chapter.

IDRegionProductSignup YearSatisfactionPurchasesSpending (EUR)
1EastB202146294
2WestA201938380
3NorthA20244545
4EastA20204738
5EastA201821155
6WestB202228224
7NorthB202037595
8NorthB202357371
9EastB202134216
10SouthA2019210125
11EastC202441090
12EastB20184888
13EastB202235165
14EastA202346207
15WestA202015245

Definitions: Variable Types

Variables are first divided into categorical and quantitative variables. Quantitative variables can then be described as discrete or continuous.

Categorical variable. A categorical variable, also called a qualitative variable, describes a category or characteristic. Categorical variables may be nominal or ordinal and cannot generally be added, multiplied, or averaged meaningfully.

Quantitative variable. A quantitative variable, also called a numerical variable, represents a measurable quantity numerically. Which arithmetic operations are meaningful depends on the variable's level of measurement.

Discrete quantitative variable. A discrete quantitative variable can take only specific values, often because it is counted.

Continuous quantitative variable. A continuous quantitative variable can take values across an interval, often because it is measured.

One way to connect variable types with the set-theoretic language from Chapter 1 is to ask: What set of possible values can this variable take? The level of measurement then tells us what structure those possible values have and what comparisons or calculations are meaningful.

Definitions: Levels of Measurement

The levels of measurement describe what kinds of comparisons or calculations are meaningful for a variable. Four common levels are nominal, ordinal, interval, and ratio.

Nominal variable. A nominal variable is a categorical variable whose categories have no natural order.

Ordinal variable. An ordinal variable is a categorical variable whose categories have a natural order, but the differences between neighboring categories are not necessarily equal.

For interval and ratio variables, equal differences are meaningful: a change of the same number of units represents the same amount of change anywhere on the scale. The key difference is whether division comparisons are meaningful.

Interval variable. An interval variable is quantitative. Differences are meaningful, so it makes sense to subtract two values. However, the zero point is chosen as part of the scale. If the zero point were moved, the differences between values would stay the same, but division comparisons would change. Therefore, interval variables are compared by differences, not by statements such as "twice as large."

Ratio variable. A ratio variable is quantitative. Its zero point is fixed by the quantity itself, so measurements are counted from that starting point. Differences are meaningful, and division comparisons are meaningful too. This means we can say both "how much more" and "how many times as large."

The difference between interval and ratio variables is therefore a question about what comparisons the scale supports. Interval variables support subtraction. Ratio variables support both subtraction and division.

Example: Classifying Variables in the Customer Data

The variables in the customer data can be classified using the two systems introduced above: variable type and measurement level.

The variables in the customer data can also be classified by looking at their possible values. Categorical variables use sets of labels or categories, while quantitative variables use numerical values. Some numerical values are separated, such as counts, while others are modeled on intervals of the real number line.

A useful way to decide the measurement level is to ask what statements are meaningful. Can we only name groups? Can we put values in order? Can we subtract values? Can we divide one value by another and interpret the result as "how many times as large"?

The table below pairs each visual summary with the reason for the classification shown in the illustration.

Table 16.3. Classification and justification of the customer variables.

Variable categorizationExplanation
Visual classification of Region and Product as categorical nominal variables.Region and Product are names of groups. A customer can be in the East region or have product A, but those labels are not numerical amounts. We can count how many customers are in each group, but the groups have no natural order. Subtraction and division comparisons are not meaningful for these labels.
Visual classification of Satisfaction as a categorical ordinal variable.Satisfaction uses the ordered ratings . The order is meaningful: means more satisfied than , and means more satisfied than . The exact distance between neighboring ratings is not guaranteed to be the same, so the safest interpretation is an ordinal categorical variable, not a quantitative measurement.
Visual classification of Signup Year as a discrete quantitative interval variable.Signup Year is recorded in whole years, such as . Subtraction is meaningful: , so a customer who signed up in signed up years after one who signed up in . Division comparisons are not meaningful for calendar-year labels. The statement " is twice " only compares labels on the calendar scale; it does not say something useful about signup time.
Visual classification of Purchases as a discrete quantitative ratio variable.Purchases is a count, so the values are non-negative integers. Subtraction is meaningful: purchases is more than purchases. Division is meaningful too: , so purchases is twice as many as purchases.
Visual classification of Spending as a continuous quantitative ratio variable.Spending is an amount of money. It is treated as continuous because money is measured on a scale, even if the table rounds to whole euros. Subtraction is meaningful: EUR is EUR more than EUR . Division is meaningful too: , so EUR is twice as much spending as EUR .

The later numerical summaries focus mainly on Purchases and Spending.

Presenting Data Graphically

Once data are collected, one of the most effective ways to summarize them is with graphs. The type of graph we choose depends on the type of data:

  • Categorical data are often summarized using bar charts.
  • Quantitative data are often summarized using histograms.

Before creating graphs, we often organize the data into a frequency distribution.

Definitions: Frequency and Relative Frequency

Frequency. Frequency is the number of times a data value, category, or interval occurs.

Relative frequency. Relative frequency is the frequency divided by the sample size . It describes the proportion of the data represented by that value, category, or interval.

If a category or bin has frequency , then its relative frequency is

When relative frequency is reported as a percentage, we multiply by :

The next example uses the Spending column to show how values can be grouped into intervals and converted from frequencies to relative frequencies.

Example: Relative Frequency

Using EUR 100 intervals, the Spending column can be summarized as follows:

Table 16.4. Frequency and relative-frequency distribution for spending values.

Spending bin (EUR)FrequencyValuesRelative frequency
0-99538, 45, 55, 88, 90
100-1992125, 165
200-2995207, 216, 224, 245, 294
300-3992371, 380
400-4990--
500-5991595

In the spending table, of the customers have spending values between EUR 0 and EUR 99. The relative frequency of this bin is therefore

This means that about one third of the sampled customers are in the lowest spending bin.

Definition: Bar Chart

A bar chart displays one bar for each category. The height or length of each bar indicates the frequency or relative frequency of that category.

Example: Bar Charts for Customer Data

The categorical variables Region and Product can be summarized using bar charts. Since the values are categories, the important comparison is the height of the bars rather than the order of the category names.

Categorical frequency bar charts
Figure 16.3. Frequency bar charts for the categorical variables Region and Product.

In this sample, East is the most common region. For Product, categories A and B occur equally often, while C occurs only once.

Categorical relative-frequency bar charts
Figure 16.4. Relative-frequency bar charts for the categorical variables Region and Product.

The relative-frequency charts show the same pattern, but the vertical scale is converted from counts to proportions.

Definition: Histogram

A histogram groups numerical data into adjacent intervals, called bins. Its bars can show frequency or relative frequency. To prevent a boundary value from entering two bins, intervals may be written as half-open intervals such as and ; the final interval can include its right endpoint.

Example: Histograms for Customer Data

The quantitative variables Purchases and Spending can be summarized using histograms. Here the horizontal scale has numerical meaning, so the shape of the bars tells us how the values are distributed. The ordinal variable Satisfaction should instead be summarized with an ordered bar chart because the ratings are ordered categories.

Frequency histograms for Purchases and Spending.
Figure 16.5. Frequency histograms for Purchases and Spending.

The spending histogram has a longer right tail than the purchases histogram: most spending values are below EUR 300, but a few customers spend more.

Relative-frequency histograms for Purchases and Spending.
Figure 16.6. Relative-frequency histograms for Purchases and Spending.

As with bar charts, changing from frequency to relative frequency changes the vertical scale but not the overall shape. For this fixed sample of customers, the frequency and relative-frequency versions contain the same information for each variable: the relative-frequency version divides each count by . This becomes useful when comparing histograms based on samples of different sizes, because the bars are then measured on the same proportion scale.

The look of a histogram depends on both the sample size and the bin width. A small sample size can make a histogram unstable, while a large sample size often reveals a smoother shape. Wide bins give fewer bars and less detail; narrow bins give more detail but can look noisy if the sample is small.

Example: Sample Size and Bin Width

The following grid shows how the same variable can appear differently when the sample size or bin width changes.

Effect of sample size and bin width on histograms
Figure 16.7. Effect of sample size and bin width on the shape of a spending histogram.

Across each row, narrower bins reveal more detail but can make the histogram look more irregular. Down each column, larger samples make the right-skewed shape easier to recognize.

Histograms help us describe the overall shape of a quantitative distribution. One important shape feature is whether the distribution is roughly balanced or whether it has a longer tail on one side.

Definitions: Symmetric and Skewed Distributions

A symmetric distribution has left and right sides that are roughly balanced around the center.

A right-skewed distribution, also called a positively skewed distribution, has a longer tail to the right. This means that a few relatively large values stretch the distribution toward larger numbers.

A left-skewed distribution, also called a negatively skewed distribution, has a longer tail to the left. This means that a few relatively small values stretch the distribution toward smaller numbers.

Skewness matters because the mean is pulled toward the longer tail, while the median is usually less affected by extreme values.

Prototype shapes for symmetric, right-skewed, and left-skewed distributions.
Figure 16.8. Prototype distribution shapes: a symmetric distribution is roughly balanced, a right-skewed distribution has a longer tail toward larger values, and a left-skewed distribution has a longer tail toward smaller values.

Measures of Central Tendency

Quantitative data can be described not only verbally and graphically, but also with numbers. When summarizing a distribution, we often want to know:

  • a representative value, or center, and
  • how spread out the data values are.

In this section, we focus on measures of central tendency: the mean, median, and mode.

Distributions before center summaries are marked
Figure 16.9. Example distributions before mean, median, and mode are marked.

We will use these four distributions repeatedly. This makes it easier to see how different summaries respond to symmetry, skewness, and multiple peaks.

Mean

The arithmetic mean, often simply called the mean, is found by dividing the sum of the data values by the number of values.

Definition: Mean

For data values , the sample mean is

Here, is the th data value, is the sample size, and is read as "x bar."

Distributions with means marked
Figure 16.10. Means marked on example distributions.

The mean marks a balance point of the distribution. In skewed distributions, this balance point is pulled toward the longer tail.

Example: Mean Spending

For the first 15 customers, the spending values are

The mean spending is

The mean spending is EUR 209.20.

Mean spending without an outlier
Figure 16.11. Mean spending for the original data without the EUR 2000 outlier.

The mean lies near the center of the main cluster, but it is slightly pulled toward the larger spending values.

Outliers

Outliers are especially important when interpreting measures of center.

Definition: Outlier

An outlier is a value much higher or lower than the rest of the data. Outliers may represent unusual but valid behavior, or they may be data entry errors.

Example: Effect of an Outlier

Suppose a new customer spends EUR 2000. Including this value, the data set now has values and the mean becomes

The mean is now about EUR 321.13. While this is mathematically correct, it no longer represents a typical customer very well because the outlier has pulled the mean upward.

Mean spending with an outlier
Figure 16.12. Mean spending after adding a EUR 2000 outlier.

Compared with the previous plot, the mean marker moves far to the right even though all the original data values are unchanged.

When outliers are present, another measure of center is often more useful: the median.

Median

Definition: Median

The median is the middle value of an ordered data set.

To find the median:

  1. Order the data values from smallest to largest.
  2. If there is an odd number of values, the middle value is the median.
  3. If there is an even number of values, the median is the mean of the two middle values.

If the ordered data values are

then the median is

Distributions with means and medians marked
Figure 16.13. Means and medians marked on example distributions.

When a distribution is roughly symmetric, the mean and median tend to be close. When a distribution is skewed, the mean is usually pulled farther toward the tail than the median.

Example: Median Spending with an Outlier

Including the EUR 2000 outlier, the sorted spending values are

There are data values, so the median is the mean of the two middle values:

Notice that the median remains close to the original center of the data, even with the outlier.

Median spending with an outlier
Figure 16.14. Median spending after adding a EUR 2000 outlier.

The plot illustrates why the median is resistant to this outlier: it still depends only on the two middle ordered values.

Mode

Definition: Mode

The mode is the data value or category that occurs most frequently in a data set.

The value with the largest frequency is always a formal maximizer in a finite data set. In this book, if every value occurs equally often, we say that the data set has no reported mode because no value is more frequent than the others. Otherwise, a data set may have one mode (unimodal), two modes (bimodal), or more than two modes (multimodal).

For grouped data, the modal class is the bin or interval containing the largest number of values.

If denotes the frequency of the value or category , then a mode is any value satisfying

Distributions with means, medians, and modes marked
Figure 16.15. Means, medians, and modes marked on example distributions.

The mode identifies where the distribution is most concentrated. It can agree with the mean and median in a symmetric distribution, but in skewed or multi-peaked distributions it may tell a different story.

Example: Modal Class for Spending

After grouping data into bins, we report a modal class rather than a single modal value: the bin with the largest count.

In the spending frequency table above, the bins EUR 0-99 and EUR 200-299 both have frequency , the highest frequency. Therefore, the grouped spending data have two modal classes: EUR 0-99 and EUR 200-299.

Measures of Spread

Consider three lists of quiz scores on a 10-point quiz:

  • Class A:
  • Class B:
  • Class C:

All three data sets have mean and median , yet the distributions are clearly different. Measures of spread help describe this variation.

Range

The first and simplest way to measure spread is the range.

Definition: Range

The range is the difference between the maximum value and the minimum value of a data set:

Distributions with range marked
Figure 16.16. Ranges marked on example distributions.

The range uses only the two endpoints. In the plots above, long tails stretch the range even when most of the data are concentrated in a much smaller interval.

Example: Range of Spending

For the original 15 customer spending values, the minimum is and the maximum is . Therefore,

Spending range
Figure 16.17. Range of the original spending values.

Most of the data values are much lower than EUR 595, but the range is determined entirely by the minimum and maximum.

The range only considers the extremes and ignores all the values between them. For example, the data sets

and

both have range , but their spreads are very different.

Deviation, Variance, and Standard Deviation

The difference between a data value and the mean is called the deviation from the mean:

Positive deviations indicate values above the mean, and negative deviations indicate values below the mean. The sum of all deviations is always zero apart from small rounding errors, because positive and negative deviations cancel out.

For the original 15 spending values, :

Table 16.5. Deviations from the mean and squared deviations for spending values.

SpendingDeviation Squared deviation
29484.87191.04
380170.829172.64
45-164.226961.64
38-171.229309.44
55-154.223777.64
22414.8219.04
595385.8148841.64
371161.826179.24
2166.846.24
125-84.27089.64
90-119.214208.64
88-121.214689.44
165-44.21953.64
207-2.24.84
24535.81281.64
Sum330926.40

Definition: Sample Variance

For a sample containing values, the sample variance is the sum of the squared deviations from the mean divided by :

The divisor is used because the deviations are calculated from the sample mean: once deviations are known, the final deviation is determined by the requirement that they sum to zero. This adjustment makes suitable for estimating population variance.

Variance is measured in squared units, which makes it less intuitive. The standard deviation takes the square root of the variance, returning the measure of spread to the original units.

Definition: Sample Standard Deviation

For a sample containing values, the sample standard deviation is

It measures the typical distance of the data values from the mean.

Distributions with mean and standard deviation marked
Figure 16.18. Mean and standard deviation marked on example distributions.

The shaded interval shows one standard deviation on each side of the mean. Wider shaded intervals indicate greater typical variation around the mean.

Example: Variance and Standard Deviation of Spending

For the original spending values, the table above gives

The sample variance is

The sample standard deviation is

Thus, the spending values are typically about EUR 153.75 away from the mean.

Spending mean, standard deviation, and range
Figure 16.19. Mean, standard deviation, and range for the original spending values.

The standard deviation gives a more typical spread around the mean than the full range, because the range is driven only by the smallest and largest spending values.

Measures of Position

Percentiles and Quartiles

Definition: Percentiles

The th percentile is a value that places approximately of the ordered data at or below it. Percentiles describe relative position within a data set.

Percentiles describe position. For example, a value at the 80th percentile is interpreted as placing approximately 80% of the data at or below it and approximately 20% above it.

Note: Percentile Conventions

There are several accepted rules for calculating percentiles, and statistical software may interpolate between ordered values in different ways. Consequently, two methods can give slightly different answers for a small data set. In this chapter, quartiles are calculated with the median-of-halves method below.

Definition: Quartiles

Quartiles are common percentiles that split a data set into four parts:

  • is the first quartile, or 25th percentile.
  • is the second quartile, or 50th percentile. This is the median.
  • is the third quartile, or 75th percentile.

In percentile notation,

Method: Finding Quartiles

To find quartiles:

  1. Order the data from smallest to largest.
  2. Find the median, .
  3. If the data set has an odd number of values, exclude the overall median before forming the lower and upper halves. If it has an even number of values, divide it into two halves of equal size.
  4. Find the median of the lower half of the data; this is .
  5. Find the median of the upper half of the data; this is .

Example: Quartiles of Spending

For the sorted spending values

the median is . Using the lower and upper halves of the data,

Thus, the middle half of the spending values lies between EUR 88 and EUR 294.

Five-Number Summary and IQR

Definition: Five-Number Summary and IQR

The five-number summary is:

The interquartile range (IQR) measures the spread of the middle 50% of the data:

Five-number summary on example distributions
Figure 16.20. Five-number summaries marked on example distributions.

The five-number summary combines the endpoints with the quartiles. The shaded IQR focuses on the middle half of the data and is less affected by extreme values than the full range.

Example: Five-Number Summary for Spending

Now that the quartiles are known, we can collect the endpoints and quartiles into one compact summary.

The sorted spending values are

The five-number summary is:

  • Minimum:
  • :
  • Median:
  • :
  • Maximum:

The interquartile range is

Spending histogram with five-number summary
Figure 16.21. Original spending histogram with the five-number summary.

The marked values show that the central 50% of sampled customers spent between EUR 88 and EUR 294, while the maximum EUR 595 creates a longer upper tail.

Box-and-Whisker Plots

Definition: Box Plot

A box plot, or box-and-whisker plot, is a graphical representation of the five-number summary.

In a box plot:

  • the box spans from to ,
  • a line inside the box marks the median,
  • whiskers extend to the most extreme values that are not treated as outliers, and
  • separate symbols may be used to mark potential outliers.

If no data values are shown separately as outliers, the whiskers extend to the minimum and maximum.

A box plot shows the center of the data, the spread of the data, and possible skewness or outliers.

A common rule marks data values as potential outliers if they lie below the lower fence or above the upper fence:

Example: Interpreting the Spending Box Plot

For the original spending data, the box extends from to , and the median line is at . The whiskers extend to the minimum and maximum .

Spending box plot
Figure 16.22. Box plot of the original spending values.

The box represents the IQR, so it contains the middle 50% of the data values. The longer upper whisker suggests that the higher spending values are more spread out than the lower spending values.

Since , the lower and upper fences are

and

The maximum value is below the upper fence, so this rule does not mark any of the original spending values as a potential outlier.

Example: Box Plot with an Outlier

Now return to the EUR 2000 customer used in the mean and median examples. With this value included, the quartiles become , median , and , so

The upper fence is

Since EUR 2000 is above the upper fence, the box plot marks it separately as a potential outlier. The upper whisker stops at EUR 595, the largest spending value that is not treated as an outlier by this rule.

Spending box plot with an outlier
Figure 16.23. Box plot of spending after adding the EUR 2000 outlier.

Compared with the original box plot, the box and median move only slightly, while the separate point makes the outlier visible immediately.