Skip to main content
Mathematics LibreTexts

1.9: Combining Functions

  • Page ID
    89285
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)
    Motivating Questions
    • How can we create new functions by adding, subtracting, multiplying, or dividing given functions?
    • What are piecewise functions and what are different ways we can represent them?

    In arithmetic, we execute processes where we take two numbers to generate a new number. For example, \(2 + 3 = 5\text{:}\) the number \(5\) results from adding \(2\) and \(3\text{.}\) Similarly, we can multiply two numbers to generate a new one: \(2 \cdot 3 = 6\text{.}\)

    We can work similarly with functions. Indeed, we have already seen a sophisticated way to combine two functions to generate a new, related function through composition. If \(g : A \to B\) and \(f : B \to C\text{,}\) then we know there's a new, related function \(f \circ g : A \to C\) defined by the process \((f \circ g)(x) = f(g(x))\text{.}\) Said differently, the new function \(f \circ g\) results from executing \(g\) first, followed by \(f\text{.}\)

    Just as we can add, subtract, multiply, and divide numbers, we can also add, subtract, multiply, and divide functions to create a new function from two or more given functions.

    Preview Activity \(\PageIndex{1}\)

    Consider the functions \(f\) and \(g\) defined by Table \(\PageIndex{1}\) and functions \(p\) and \(q\) defined by Figure 1.9.2.

    Table \(\PageIndex{1}\) Table defining functions \(f\) and \(g\text{.}\)
    \(x\) 0 1 2 3 4
    \(f(x)\) 5 10 15 20 25
    \(g(x)\) 9 5 3 2 3

    inverse-ez-p-q.svg

    Figure \(\PageIndex{1}\) Graphs defining functions \(p\) and \(q\text{.}\)
    1. Let \(h(x) = f(x) + g(x)\text{.}\) Determine \(h(3)\text{.}\)
    2. Let \(r(x) = p(x) - q(x)\text{.}\) Determine \(r(-1)\) exactly.
    3. Are there any values of \(x\) for which \(r(x) = 0\text{?}\) If not, explain why; if so, determine all such values, with justification.
    4. Let \(k(x) = f(x) \cdot g(x)\text{.}\) Determine \(k(0)\text{.}\)
    5. Let \(s(x) = \frac{p(x)}{q(x)}\text{.}\) Determine \(s(1)\) exactly.
    6. Are there any values of \(x\) in the interval \(-4 \le x \le 4\) for which \(s(x)\) is not defined? If not, explain why; if so, determine all such values, with justification.

    Arithmetic with functions

    In most mathematics up until calculus, the main object we study is numbers. We ask questions such as

    • “what number(s) form solutions to the equation \(x^2 - 4x - 5 = 0\text{?}\)”
    • “what number is the slope of the line \(3x - 4y = 7\text{?}\)”
    • “what number is generated as output by the function \(f(x) = \sqrt{x^2 + 1}\) by the input \(x = -2\text{?}\)”

    Certainly we also study overall patterns as seen in functions and equations, but this usually occurs through an examination of numbers themselves, and we think of numbers as the main objects being acted upon.

    This changes in calculus. In calculus, the fundamental objects being studied are functions themselves. A function is a much more sophisticated mathematical object than a number, in part because a function can be thought of in terms of its graph, which is an infinite collection of ordered pairs of the form \((x,f(x))\text{.}\)

    It is often helpful to look at a function's formula and observe algebraic structure. For instance, given the quadratic function

    \[ q(x) = -3x^2 + 5x - 7 \nonumber \]

    we might benefit from thinking of this as the sum of three simpler functions: the constant function \(c(x) = -7\text{,}\) the linear function \(s(x) = 5x\) that passes through \((0,0)\) with slope \(m = 5\text{,}\) and the concave down basic quadratic function \(w(x) = -3x^2\text{.}\) Indeed, each of the simpler functions \(c\text{,}\) \(s\text{,}\) and \(w\) contribute to making \(q\) be the function that it is. Likewise, if we were interested in the function \(p(x) = (3x^2 + 4)(9 - 2x^2)\text{,}\) it might be natural to think about the two simpler functions \(f(x) = 3x^2 + 4\) and \(g(x) = 9 - 2x^2\) that are being multiplied to produce \(p\text{.}\)

    We thus naturally arrive at the ideas of adding, subtracting, multiplying, or dividing two or more functions, and hence introduce the following definitions and notation.

    Definition \(\PageIndex{13}\)

    Let \(f\) and \(g\) be functions that share the same domain. Then,

    • The sum of \(f\) and \(g\) is the function \(f + g\) defined by \((f+g)(x) = f(x) + g(x)\text{.}\)
    • The difference of \(f\) and \(g\) is the function \(f - g\) defined by \((f-g)(x) = f(x) - g(x)\text{.}\)
    • The product of \(f\) and \(g\) is the function \(f \cdot g\) defined by \((f \cdot g)(x) = f(x) \cdot g(x)\text{.}\)
    • The quotient of \(f\) and \(g\) is the function \(\frac{f}{g}\) defined by \(\left( \frac{f}{g} \right)(x) = \frac{f(x)}{g(x)}\) for all \(x\) such that \(g(x) \ne 0\text{.}\)
    Exercise \(\PageIndex{1}\)

    Consider the functions \(f\) and \(g\) defined by Figure \(\PageIndex{4}\) and Figure \(\PageIndex{5}\)

    combining-act-f.svg
    Figure \(\PageIndex{4}\) The function \(f\text{.}\)
    composite-ez-g.svg
    Figure \(\PageIndex{4}\) The function \(g\text{.}\)
    1. Determine the exact value of \((f+g)(0)\text{.}\)
    2. Determine the exact value of \((g-f)(1)\text{.}\)
    3. Determine the exact value of \((f \cdot g)(-1)\text{.}\)
    4. Are there any values of \(x\) for which \(\left( \frac{f}{g} \right)(x)\) is undefined? If not, explain why. If so, determine the values and justify your answer.
    5. For what values of \(x\) is \((f \cdot g)(x) = 0\text{?}\) Why?
    6. Are there any values of \(x\) for which \((f-g)(x) = 0\text{?}\) Why or why not?

    Combining functions in context

    When we work in applied settings with functions that model phenomena in the world around us, it is often useful to think carefully about the units of various quantities. Analyzing units can help us both understand the algebraic structure of functions and the variables involved, as well as assist us in assigning meaning to quantities we compute. We have already seen this with the notion of average rate of change: if a function \(P(t)\) measures the population in a city in year \(t\) and we compute \(AV_{[5, 11]}\text{,}\) then the units on \(AV_{[5, 11]}\) are “people per year,” and the value of \(AV_{[5, 11]}\) is telling us the average rate at which the population changes in people per year on the time interval from year \(5\) to year \(11\text{.}\)

    Example \(\PageIndex{6}\)

    Say that an investor is regularly purchasing stock in a particular company. 1  Let \(N(t)\) represent the number of shares owned on day \(t\text{,}\) where \(t = 0\) represents the first day on which shares were purchased. Let \(S(t)\) give the value of one share of the stock on day \(t\text{;}\) note that the units on \(S(t)\) are dollars per share. How is the total value, \(V(t)\text{,}\) of the held stock on day \(t\) determined?

    This example is taken from Section 2.3 of Active Calculus.
    Solution. Observe that the units on \(N(t)\) are “shares” and the units on \(S(t)\) are “dollars per share”. Thus when we compute the product

    \[ N(t) \, \text{shares} \cdot S(t) \, \text{dollars per share}\text{,} \nonumber \]
    it follows that the resulting units are “dollars”, which is the total value of held stock. Hence,

    \[ V(t) = N(t) \cdot S(t)\text{.} \nonumber \]

    Activity \(\PageIndex{3}\)

    Let \(f\) be a function that measures a car's fuel economy in the following way. Given an input velocity \(v\) in miles per hour, \(f(v)\) is the number of gallons of fuel that the car consumes per mile (i.e., “gallons per mile”). We know that \(f(60) = 0.04\text{.}\)

    1. What is the meaning of the statement “\(f(60) = 0.04\)” in the context of the problem? That is, what does this say about the car's fuel economy? Write a complete sentence.
    2. Consider the function \(g(v) = \frac{1}{f(v)}\text{.}\) What is the value of \(g(60)\text{?}\) What are the units on \(g\text{?}\) What does \(g\) measure?
    3. Consider the function \(h(v) = v \cdot f(v)\text{.}\) What is the value of \(h(60)\text{?}\) What are the units on \(h\text{?}\) What does \(h\) measure?
    4. Do \(f(60)\text{,}\) \(g(60)\text{,}\) and \(h(60)\) tell us fundamentally different information, or are they all essentially saying the same thing? Explain.
    5. Suppose we also know that \(f(70) = 0.045\text{.}\) Find the average rate of change of \(f\) on the interval \([60,70]\text{.}\) What are the units on the average rate of change of \(f\text{?}\) What does this quantity measure? Write a complete sentence to explain.

    Piecewise functions

    In both abstract and applied settings, we sometimes have to use different formulas on different intervals in order to define a function of interest.

    A familiar and important function that is defined piecewise is the absolute value function: \(A(x) = |x|\text{.}\) We know that if \(x \ge 0\text{,}\) \(|x| = x\text{,}\) whereas if \(x \lt 0\text{,}\) \(|x| = -x\text{.}\)

    Definition \(\PageIndex{7}\)

    The absolute value of a real number, denoted by \(A(x) = |x|\text{,}\) is defined by the rule

    \[ A(x) = \begin{cases} -x, & x \lt 0 \\ x, & x \ge 0 \end{cases} \nonumber \]

    combining-piecewise-abs-val.svg
    Figure \(\PageIndex{8}\) A plot of the absolute value function, \(A(x) = |x|\text{.}\)

    The absolute value function is one example of a piecewise-defined function. The “bracket” notation in Definition 1.9.7 is how we express which piece of the function applies on which interval. As we can see in Figure 1.9.8, for \(x\) values less than \(0\text{,}\) the function \(y = -x\) applies, whereas for \(x\) greater than or equal to \(0\text{,}\) the rule is determined by \(y = x\text{.}\)

    As long as we are careful to make sure that each potential input has one and only one corresponding output, we can define a piecewise function using as many different functions on different intervals as we desire.

    Exercise \(\PageIndex{1}\)

    In what follows, we work to understand two different piecewise functions entirely by hand based on familiar properties of linear and quadratic functions.

    1. Consider the function \(p\) defined by the following rule:
      \[ p(x) = \begin{cases} -(x+2)^2 + 2, & x \lt 0 \\ \frac{1}{2}(x-2)^2 + 1, & x \ge 0 \end{cases} \nonumber \]

      What are the values of \(p(-4)\text{,}\) \(p(-2)\text{,}\) \(p(0)\text{,}\) \(p(2)\text{,}\) and \(p(4)\text{?}\)

    2. What point is the vertex of the quadratic part of \(p\) that is valid for \(x \lt 0\text{?}\) What point is the vertex of the quadratic part of \(p\) that is valid for \(x \ge 0\text{?}\)
    3. For what values of \(x\) is \(p(x) = 0\text{?}\) In addition, what is the \(y\)-intercept of \(p\text{?}\)
    4. Sketch an accurate, labeled graph of \(y = p(x)\) on the axes provided in Figure \(\PageIndex{9}\)
    functions-y-x-blank-axes-centered-2.svg
    Figure \(\PageIndex{9}\) Axes to plot \(y = p(x)\text{.}\)
    combining-act-f-1.svg
    Figure \(\PageIndex{10}\) Graph of \(y = f(x)\text{.}\)

    5. For the function \(f\) defined by Figure 1.9.10, determine a piecewise-defined formula for \(f\) that is expressed in bracket notation similar to the definition of \(y = p(x)\) above.

    Summary

    • Just as we can generate a new number by adding, subtracting, multiplying, or dividing two given numbers, we can generate a new function by adding, subtracting, multiplying, or dividing two given functions. For instance, if we know formulas, graphs, or tables for functions \(f\) and \(g\) that share the same domain, we can create their product \(p\) according to the rule \(p(x) = (f \cdot g)(x) = f(x) \cdot g(x)\text{.}\)
    • A piecewise function is a function whose formula consists of at least two different formulas in such a way that which formula applies depends on where the input falls in the domain. For example, given two functions \(f\) and \(g\) each defined on all real numbers, we can define a new piecewise function \(P\) according to the rule
      \[ P(x) = \begin{cases} f(x), & x \lt a \\ g(x), & x \ge a \end{cases} \nonumber \]

      This tells us that for any \(x\) to the left of \(a\text{,}\) we use the rule for \(f\text{,}\) whereas for any \(x\) to the right of or equal to \(a\text{,}\) we use the rule for \(g\text{.}\) We can use as many different functions as we want on different intervals, provided the intervals don't overlap.

    Exercises

    1.
    2.
    3.
    4.
    5.
    6.
    7.

    Let \(r(t) = 2t - 3\) and \(s(t) = 5 - 3t\text{.}\) Determine a formula for each of the following new functions and simplify your result as much as possible.

    1. \(\displaystyle f(t) = (r+s)(t)\)
    2. \(\displaystyle g(t) = (\frac{s}{r})(t)\)
    3. \(\displaystyle h(t) = (r \cdot s)(t)\)
    4. \(\displaystyle q(t) = (s \circ r)(t)\)
    5. \(\displaystyle w(t) = r(t-4) + 7\)
    8.

    Consider the functions \(s\) and \(g\) defined by the graphs in Figure \(\PageIndex{11}\) and Figure \(\PageIndex{12}\) Assume that to the left and right of the pictured domains, each function continues behaving according to the trends seen in the figures.

    inverse-act-does-it-2.svg
    Figure \(\PageIndex{11}\) The graph of a piecewise function, \(s\text{.}\)
    functions-act-is-it-2.svg
    Figure \(\PageIndex{12}\) The graph of a piecewise function, \(g\text{.}\)
    1. Determine a piecewise formula for the function \(y = s(t)\) that is valid for all real numbers \(t\text{.}\)
    2. Determine a piecewise formula for the function \(y = g(x)\) that is valid for all real numbers \(x\text{.}\)
    3. Determine each of the following quantities or explain why they are not defined.
      • \(\displaystyle (s \cdot g)(1)\)
      • \(\displaystyle (g-s)(3)\)
      • \(\displaystyle (s \circ g)(1.5)\)
      • \(\displaystyle (g \circ s)(-4)\)
    9.

    One of the most important principles in the study of changing quantities is found in the relationship between distance, average velocity, and time. For a moving body traveling on a straight-line path at an average rate of \(v\) for a period of time \(t\text{,}\) the distance traveled, \(d\text{,}\) is given by

    \[ d = v \cdot t \nonumber \]

    In the Ironman Triathlon, competitors swim \(2.4\) miles, bike \(112\) miles, and then run a \(26.2\) mile marathon. In the following sequence of questions, we build a piecewise function that models a competitor's location in the race at a given time \(t\text{.}\) To start, we have the following known information.

    • She swims at an average rate of \(2.5\) miles per hour throughout the \(2.4\) miles in the water.
    • Her transition from swim to bike takes \(3\) minutes (\(0.05\) hours), during which time she doesn't travel any additional distance.
    • She bikes at an average rate of \(21\) miles per hour throughout the \(112\) miles of biking.
    • Her transition from bike to run takes just over \(2\) minutes (\(0.03\) hours), during which time she doesn't travel any additional distance.
    • She runs at an average rate of \(8.5\) miles per hour throughout the marathon.
    • In the questions that follow, assume for the purposes of the model that the triathlete swims, bikes, and runs at essentially constant rates (given by the average rates stated above).
    1. Determine the time the swimmer exits the water. Report your result in hours.
    2. Likewise, determine the time the athlete gets off her bike, as well as the time she finishes the race.
    3. List 5 key points in the form (time, distance): when exiting the water, when starting the bike, when finishing the bike, when starting the run, and when finishing the run.
    4. What is the triathlete's average velocity over the course of the entire race? Is this velocity the average of her swim velocity, bike velocity, and run velocity? Why or why not?
    5. Determine a piecewise function \(s(t)\) whose value at any given time (in hours) is the triathlete's total distance traveled.
    6. Sketch a carefully labeled graph of the triathlete's distance traveled as a function of time on the axes provided. Provide clear scale and note key points on the graph.
      aroc-s-t-blank-axes.svg
      tandem-V-t-blank-axes.svg
    7. Sketch a possible graph of the triathete's velocity, \(V\text{,}\) as a function of time on the righthand axes. Here, too, label key points and provide clear scale. Write several sentences to explain and justify your graph

    This page titled 1.9: Combining Functions is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by Matthew Boelkins, David Austin & Steven Schlicker (ScholarWorks @Grand Valley State University) via source content that was edited to the style and standards of the LibreTexts platform.

    • Was this article helpful?