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
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.
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.
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.
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.
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.
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.
| Symbol | Name | Description | Examples |
|---|---|---|---|
| Natural numbers | The counting numbers. | ||
| Natural numbers with zero | The counting numbers together with . | ||
| Integers | The natural numbers, their negatives, and zero. | ||
| Rational numbers | Numbers of the form , where and . | ||
| Real numbers | Numbers represented by points on the number line. | ||
| Irrational numbers | Real numbers that are not rational. | ||
| Complex numbers | Numbers 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.
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.
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.
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.
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.
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.
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 .
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.
| Set | Interval Notation | Set-Builder Notation | Illustration |
|---|---|---|---|
| All real numbers | |||
| Open interval | |||
| Closed interval | |||
| Infinite to the right | |||
| Infinite to the right | |||
| Infinite to the left | |||
| Infinite to the left | |||
| Half-open (left open) | |||
| Half-open (right open) |
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.
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.
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 .
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.
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
The cardinality of a set , written , indicates the number of elements in . In other words, the cardinality is the size of .
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.
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.
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 .
The following examples compare sets by checking whether every element of one set appears in the other.
-
Let and . Since both sets contain the same elements: Therefore, and are equal sets, and each is a subset of the other.
-
Let and . The empty set contains no elements, so it is a subset of every set:
-
Let and . Every element of is in , so: Since , is also a proper subset, although it can first be identified as a subset.
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.
The following examples emphasize the extra requirement for a proper subset: the larger set must contain at least one additional element.
-
Let and . Every element of is in , but has one additional element. Therefore: That is, is a proper subset of .
-
Similarly, let and . All elements of are contained in , but has additional elements ( and ). Hence: That is, again, is a proper subset of .
-
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.
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.
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.
The universe depends on the context of the problem. The following examples show how changing the universe changes what the named subsets mean.
-
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.
-
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.
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.
In each example below, keeps only the elements that belong to and not to .
-
Taking and gives Thus, the irrational numbers are precisely the real numbers that are not rational.
-
Let and . Then: These are the vowels that are not in the set .
-
Let and . The elements in that are not in are:
-
Let and . The fruits in that are not in are:
-
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 .
-
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.
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.
Each complement is taken relative to a chosen universe, so must first be stated or described.
-
Let and . The complement of is: Here, contains the elements of that are not in .
-
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.
-
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.
-
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."
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.
Let and be sets.
The intersection of and , written , is the set of all elements that are in both and :
Let
The union contains every element that appears in at least one of the 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.
Let , , and be sets. The following identities hold:
Table 2.1. Basic properties of union and intersection.
| Property | Union | Intersection |
|---|---|---|
| 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.
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.
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 .
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 .
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.
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.
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 .
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 .
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.
| Symbol | Operation | Description |
|---|---|---|
| Cartesian product of and | The set of all ordered pairs where and | |
| The power set | The 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.
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.
Evaluate an expression in the following order:
- Parentheses and other grouping symbols, including the numerator and denominator of a fraction.
- Exponents and roots.
- Multiplication and division, working from left to right.
- Addition and subtraction, working from left to right.
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.
Like terms have the same variable part, including the same exponents. They can be collected by adding or subtracting their coefficients.
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.
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 .
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.
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.
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.
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:
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.
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:
The following examples show the same rule in three common situations: matching denominators, different denominators, and subtraction.
-
Evaluate the following expression (fractions with the same denominator):
-
Evaluate the following expression (fractions with different denominators):
- Evaluate the following expression (subtracting two fractions):
Multiplication of fractions is straightforward: multiply the numerators together and the denominators together.
The multiplication rule applies whether both factors are fractions or one factor is an integer:
-
Evaluate the following expression (multiply two fractions directly): Multiplying straight across gives , which simplifies to .
-
Evaluate the following expression (simplify before multiplying): Since appears in both numerator and denominator, it can be simplified before or after multiplication.
-
Evaluate the following expression (multiply an integer by a fraction): Integers can be treated as fractions with denominator , making the same rule apply.
To divide one fraction by another, multiply the first fraction by the reciprocal (or multiplicative inverse) of the second fraction.
Each example below rewrites division as multiplication by a reciprocal before simplifying.
-
Evaluate the following expression (divide one fraction by another): The reciprocal of is ; multiplying gives .
-
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 .
-
Evaluate the following expression (divide a fraction by an integer): Note here that the integer can be written as , and its reciprocal is .
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.
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.
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.
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.
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.
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 .
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.
The following calculations apply the Negative Exponent rule.
- First, consider an expression with a positive base:
- Next, consider an expression with a negative base:
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.
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.
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.
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.
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, .
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.
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.
| Name | Expression | Factored Form | Expanded 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.
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.
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 .
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.
We now provide a more formal definition of a function and introduce several related concepts.
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:
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.
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.
The temperature at a given time of day can be expressed as a function of time. Suppose the temperature (in °C) follows the rule
- 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 .
If a car travels at a constant speed of 60 km/h, the distance traveled after hours is given by
- 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.
A platform summarizes a customer's star rating as a feedback category. Let be the submitted rating and define
by
- 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.
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 () |
|---|---|
| 0 | 3.4942 |
| 1 | 3.5038 |
| 2 | 3.5133 |
| 3 | 3.5228 |
| 4 | 3.5322 |
| 197 | 4.1589 |
| 198 | 4.1559 |
| 199 | 4.1530 |
| 200 | 4.1500 |
| 201 | 4.1469 |
| 396 | 2.3319 |
| 397 | 2.3163 |
| 398 | 2.3008 |
| 399 | 2.2851 |
| 400 | 2.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.
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
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.
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.
| Feature | Definition | Why It Matters |
|---|---|---|
| Intercepts | Points 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 Points | Points 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. |
| Asymptotes | Lines 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.
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.
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 Terms | Name | Example |
|---|---|---|
| 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.
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.
| Degree | Name | Example |
|---|---|---|
| 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.
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 .
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.
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.
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
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.
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 .
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.
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: .
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.
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:
The graph below shows how two different formulas can describe one function on different parts of its domain.
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 :
The absolute value function is a familiar example where the rule changes at zero.
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.
Another common piecewise example comes from machine learning, where negative inputs are clipped to zero.
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.
Suppose and are real-valued functions. The following operations define new functions:
Table 5.1. Standard arithmetic operations for combining two functions.
| Operation | Notation | Definition |
|---|---|---|
| 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.
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.
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.
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 :
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.
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 :
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.
Let and be functions, so every output of is a valid input for . The composition of and , denoted , is the function
defined by
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.
-
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.
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.
To decompose a function as :
- Identify the expression that is evaluated first; this becomes the inner function .
- Identify the operation applied to that expression; this becomes the outer function .
- Check the decomposition by recomposing: verify that .
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 .
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
To solve an equation reliably:
- Record the domain and any restrictions, such as denominators that cannot equal zero or logarithm arguments that must be positive.
- Simplify both sides and use reversible algebraic transformations whenever possible.
- Isolate the chosen variable when possible.
- If a step is not reversible, treat the resulting values as candidates rather than confirmed solutions.
- Check all candidates in the original equation.
- 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.
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.
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.
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.
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 .
The figure below shows the same equation in two ways: as an intersection problem and as a root-finding problem.
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 .
Here the same root-finding idea applies to two quadratic functions, producing two intersection points.
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:
- By factoring the quadratic expression into a product of two linear factors.
- 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.
To solve a polynomial equation by factorization:
- Rewrite the equation so one side is .
- Factor the polynomial as a product of simpler factors.
- Use the zero product property by setting each factor equal to .
- Solve the resulting simpler equations.
- Check that the solutions satisfy the original equation.
- State the final solution set.
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.
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.
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.
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.
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.
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.
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.
| Interval | Test Value | Sign of | Behavior |
|---|---|---|---|
| is positive | |||
| is negative | |||
| is positive |
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.
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.
The inequality
has solution set
To solve a linear inequality:
- Simplify both sides.
- Collect the variable terms on one side and the constant terms on the other.
- If the coefficient of the variable is nonzero, divide by it. If it is negative, reverse the inequality sign.
- If the variable terms cancel, determine whether the remaining statement is always true or always false.
- Write the final solution set using interval or set-builder notation.
When multiplying or dividing both sides of an inequality by a negative number, the direction of the inequality must be reversed.
Solve
We isolate :
The solution set is
Solve
Dividing both sides by reverses the inequality sign:
The solution set is
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.
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
To solve a compound inequality:
- Separate the compound statement into its individual inequalities.
- Solve each inequality.
- Combine the individual solution sets using intersection for and or union for or.
- Write the final solution set using interval notation.
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.
Solve
The connective means that a value only needs to satisfy one of the two inequalities. Therefore, the solution set is the union
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.
To solve a polynomial inequality such as or :
- Move all terms to one side so the inequality compares a function with .
- Find the roots of the function.
- Use the roots to divide the real line into intervals.
- Test one value in each interval to determine the sign of the function.
- Select the intervals on which the sign satisfies the inequality.
- Include roots for or , and exclude them for or .
- Write the final solution set using interval notation.
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 .
| Interval | Test value | Sign 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:
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.
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.
The figure contrasts a function where each output comes from at most one input with one where two inputs share an output.
Let be defined by:
This function is injective because different -values always produce different -values. However, is not injective on since .
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.
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.
Let be defined by:
For any , there exists , so is surjective. However, from is not surjective because negative -values are never reached.
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.
A bijective function combines both requirements: no output is repeated, and none are missing.
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.
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 :
- 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:
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 .
To find an inverse function:
- Write the function as .
- Solve the equation for in terms of .
- Rewrite the result as , or rename the input variable.
- Check that composing the two functions in either order returns the original input.
Let be defined by
To find its inverse, solve for :
Therefore,
For example, gives
We can check the formula in both directions:
and
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.
| Rule | Formula | Description |
|---|---|---|
| Logarithm Product Rule | The logarithm of a product equals the sum of the logarithms. | |
| Logarithm Quotient Rule | The logarithm of a quotient equals the difference of the logarithms. | |
| Logarithm Power Rule | A power in the argument becomes a multiplier in front of the logarithm. | |
| Logarithm of 1 | Any valid base raised to the power equals . | |
| Logarithm of the Base | Any valid base raised to the power equals itself. | |
| Inverse Property | Exponential and logarithmic functions cancel each other. | |
| Natural Log of | The natural logarithm means logarithm to base . | |
| Change of Base | Here 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.
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
To check whether a relation describes as a function of :
- For a list of ordered pairs, check that each input has only one associated output .
- Graphically, use the vertical line test: each vertical line should intersect the graph at most once.
- 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 .
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 .
The Vertical Line Test
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.
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.
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.
To illustrate this and build an intuitive understanding of the concept of limit, consider the function and its corresponding graph:
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.
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).
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.
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:
-
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 .
-
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.
-
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.
Consider the function
We want to determine whether is continuous at .
-
The limit exists:
Since both one-sided limits are equal, the limit exists and equals 2. The condition is satisfied.
-
The function value is defined:
The function has a defined value at . The condition is satisfied.
-
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.
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.
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.
Here is an example where the graph approaches one value, but the function is defined to take another value at the point.
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.
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.
| Operation | Limit Law |
|---|---|
| Constant Multiple | |
| Sum/Difference | |
| Product | |
| Quotient |
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.
This calculation shows how the limit laws let us split a combined expression into simpler parts.
Determine
- Split into two limits (use the difference law):
- Evaluate each part directly (direct substitution):
Sometimes direct substitution produces an indeterminate form; then algebraic simplification can reveal the limit.
Determine
- Check direct substitution (does not work!):
- 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 :
- 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
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:
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.
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 .
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.
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
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.
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.
Consider the quadratic function , for any . We compute the derivative of the function, using the limit laws, as follows:
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
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.
| Rule | Formula | Name |
|---|---|---|
| Sum/Difference | Sum/Difference Rule | |
| Product | Product Rule | |
| Quotient | Quotient Rule | |
| Constant Multiple | Constant Multiple 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.
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.
Let and be functions such that:
- is differentiable at
- is differentiable at
For the composite function:
the derivative is then defined as:
To differentiate , follow the steps:
- Identify the outer function and the inner function
- Differentiate with respect to its argument to get
- Evaluate by substituting into
- Differentiate with respect to its argument to get
- Compute as
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:
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.
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.
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.
To classify critical numbers, we can use the so-called first derivative sign test or second derivative 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.
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.
To find local extrema using derivatives:
- Compute the first derivative .
- Find the critical numbers in the domain, where or where is undefined.
- Use the first derivative sign test or, when applicable, the second derivative test to classify each critical number.
- 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.
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.
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 .
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.
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:
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.
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.
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.
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.
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.
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.
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.
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.
Second, fix rainfall at mm and vary fertilizer. The trace shows how yield changes with fertilizer for that rainfall level.
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.
The following examples show how domain restrictions come from the algebraic form of the function.
Find the domain and range of each function.
-
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 .
-
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).
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.
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.
Here, each tuple identifies a point. In linear algebra, the same tuple can give the coordinates of a vector; context determines the interpretation.
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
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.
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:
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 .
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.
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:
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.
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.
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
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
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.
For a positive integer , the factorial of , written , is defined by
It is also standard to define
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.
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:
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.
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.
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.
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.
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.
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.
A proposition is a declarative statement that can be assigned a definite truth value: true or false, but never both.
The following are examples of propositions:
- "Four is even." (True)
- "1 + 1 is 3." (False)
- "." (True)
- "." (False)
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.
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.
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.
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.
Conjunction (AND)
If and are propositions, their conjunction, " and ," denoted by , is defined by the truth table:
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.
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.
| 0 | 1 | 0 | |
| 1 | 1 | 1 | |
| 1 | 0 | 0 |
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.
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.
| 0 | 1 | 1 | |
| 0 | 0 | 0 | |
| 1 | 0 | 1 |
Thus, the disjunction is true exactly for or .
Negation (NOT)
Negation, denoted by , is the only standard operation that applies to a single proposition.
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.
| 1 | 0 | |
| 0 | 1 | |
| 0 | 1 |
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.
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 | |||
|---|---|---|---|
| 1 | 1 | 1 | |
| 1 | 0 | 0 | |
| 0 | 1 | 1 | |
| 0 | 0 | 1 |
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.
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.
| 0 | 0 | 1 | 1 | 1 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 1 | 1 | 1 | 1 |
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.
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 .
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.
| 1 | 0 | 0 | 1 | |
| 0 | 1 | 1 | 1 | |
| 0 | 1 | 1 | 1 |
Tautologies and Contradictions
Tautologies and contradictions describe expressions whose truth values do not vary from one possible case to another.
Tautology
A tautology is a logical expression that is true in every possible case. The symbol is often used to denote a tautology.
A tautology covers every possible truth case. Examples include:
- ("Either is true, or it is not.")
- ("If both and are true, then is true.")
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.
| 1 | 0 | 1 | |
| 0 | 1 | 1 | |
| 0 | 1 | 1 |
Contradiction
A contradiction is a logical expression that is false in every possible case. The symbol is often used to denote a contradiction.
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.")
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.
| 0 | 1 | 0 | |
| 0 | 0 | 0 | |
| 1 | 0 | 0 |
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:
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.
| 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 0 |
The final two columns agree in every row, which verifies the 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.
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.
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.
| Symbol | Operation | Description |
|---|---|---|
| Universal quantifier | Means "for all" or "for every"; the statement must hold for every object in the given domain. | |
| Existential quantifier | Means "there exists"; the statement must hold for at least one object in the given domain. | |
| Unique existence quantifier | Means "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.
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.
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.
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: .
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
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
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.
Probability is a numerical measure of the likelihood that an event will occur. If is an event, then denotes the probability that event occurs.
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
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:
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:
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.
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.
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.
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.
If , the probability of given that has occurred is
Rearranging this definition gives the multiplication rule
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,
Events and are independent if knowing that one occurred does not change the probability of the other. Equivalently,
If , this is equivalent to .
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 .
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.
The binomial coefficient
counts the number of ways to choose positions from positions, where and are integers satisfying and . Here and .
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.
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
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 ,
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.
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
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 .
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.
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.
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 Trials | Times Observed | Empirical Probability |
|---|---|---|
| 10 | 7 | |
| 20 | 13 | |
| 30 | 17 | |
| 40 | 22 | |
| 50 | 26 |
Notice that the empirical probability begins to approach the theoretical probability .
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.
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.
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 .
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.
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 method | How the sample is selected | Main idea or concern |
|---|---|---|
| Simple random sample | Every possible sample of a fixed size has the same probability of being selected. | Treats all samples of that size symmetrically. |
| Stratified sample | The population is divided into meaningful groups, called strata, and units are sampled from each group. | Ensures important groups are represented. |
| Cluster sample | The 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 sample | A 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 sample | Data 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.
This is not an exhaustive list. Other sampling designs exist, but these are among the most common introductory examples.
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.
| ID | Region | Product | Signup Year | Satisfaction | Purchases | Spending (EUR) |
|---|---|---|---|---|---|---|
| 1 | East | B | 2021 | 4 | 6 | 294 |
| 2 | West | A | 2019 | 3 | 8 | 380 |
| 3 | North | A | 2024 | 4 | 5 | 45 |
| 4 | East | A | 2020 | 4 | 7 | 38 |
| 5 | East | A | 2018 | 2 | 11 | 55 |
| 6 | West | B | 2022 | 2 | 8 | 224 |
| 7 | North | B | 2020 | 3 | 7 | 595 |
| 8 | North | B | 2023 | 5 | 7 | 371 |
| 9 | East | B | 2021 | 3 | 4 | 216 |
| 10 | South | A | 2019 | 2 | 10 | 125 |
| 11 | East | C | 2024 | 4 | 10 | 90 |
| 12 | East | B | 2018 | 4 | 8 | 88 |
| 13 | East | B | 2022 | 3 | 5 | 165 |
| 14 | East | A | 2023 | 4 | 6 | 207 |
| 15 | West | A | 2020 | 1 | 5 | 245 |
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.
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.
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 categorization | Explanation |
|---|---|
![]() | 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. |
![]() | 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. |
![]() | 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. |
![]() | 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. |
![]() | 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.
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.
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) | Frequency | Values | Relative frequency |
|---|---|---|---|
| 0-99 | 5 | 38, 45, 55, 88, 90 | |
| 100-199 | 2 | 125, 165 | |
| 200-299 | 5 | 207, 216, 224, 245, 294 | |
| 300-399 | 2 | 371, 380 | |
| 400-499 | 0 | -- | |
| 500-599 | 1 | 595 |
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.
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.
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.
In this sample, East is the most common region. For Product, categories A and B occur equally often, while C occurs only once.
The relative-frequency charts show the same pattern, but the vertical scale is converted from counts to proportions.
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.
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.
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.
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.
The following grid shows how the same variable can appear differently when the sample size or bin width changes.
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.
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.
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.
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.
For data values , the sample mean is
Here, is the th data value, is the sample size, and is read as "x bar."
The mean marks a balance point of the distribution. In skewed distributions, this balance point is pulled toward the longer tail.
For the first 15 customers, the spending values are
The mean spending is
The mean spending is EUR 209.20.
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.
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.
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.
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
The median is the middle value of an ordered data set.
To find the median:
- Order the data values from smallest to largest.
- If there is an odd number of values, the middle value is the median.
- 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
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.
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.
The plot illustrates why the median is resistant to this outlier: it still depends only on the two middle ordered values.
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
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.
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.
The range is the difference between the maximum value and the minimum value of a data set:
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.
For the original 15 customer spending values, the minimum is and the maximum is . Therefore,
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.
| Spending | Deviation | Squared deviation |
|---|---|---|
| 294 | 84.8 | 7191.04 |
| 380 | 170.8 | 29172.64 |
| 45 | -164.2 | 26961.64 |
| 38 | -171.2 | 29309.44 |
| 55 | -154.2 | 23777.64 |
| 224 | 14.8 | 219.04 |
| 595 | 385.8 | 148841.64 |
| 371 | 161.8 | 26179.24 |
| 216 | 6.8 | 46.24 |
| 125 | -84.2 | 7089.64 |
| 90 | -119.2 | 14208.64 |
| 88 | -121.2 | 14689.44 |
| 165 | -44.2 | 1953.64 |
| 207 | -2.2 | 4.84 |
| 245 | 35.8 | 1281.64 |
| Sum | 330926.40 |
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.
For a sample containing values, the sample standard deviation is
It measures the typical distance of the data values from the mean.
The shaded interval shows one standard deviation on each side of the mean. Wider shaded intervals indicate greater typical variation around the mean.
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.
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
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.
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.
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,
To find quartiles:
- Order the data from smallest to largest.
- Find the median, .
- 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.
- Find the median of the lower half of the data; this is .
- Find the median of the upper half of the data; this is .
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
The five-number summary is:
The interquartile range (IQR) measures the spread of the middle 50% of the data:
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.
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
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
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:
For the original spending data, the box extends from to , and the median line is at . The whiskers extend to the minimum and maximum .
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.
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.
Compared with the original box plot, the box and median move only slightly, while the separate point makes the outlier visible immediately.




