Skip to main content
Mathematics LibreTexts

1.1: Functions and Function Notation

  • Page ID
    58685
  • \( \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}\)

    What is a Function?

    The natural world is full of relationships between quantities that change. When we see these relationships, it is natural for us to ask "If I know one quantity, can I then determine the other?" This establishes the idea of an input quantity, or independent variable, and a corresponding output quantity, or dependent variable. From this we get the notion of a functional relationship in which the output can be determined from the input.

    For some quantities, like height and age, there are certainly relationships between these quantities. Given a specific person and any age, it is easy enough to determine their height, but if we tried to reverse that relationship and determine age from a given height, that would be problematic, since most people maintain the same height for many years.

    Definition: Function

    A function is a rule for a relationship between an input, or independent, quantity and an output, or dependent, quantity in which each input value uniquely determines one output value. We say "the output is a function of the input."

    Example \(\PageIndex{1}\)

    In the height and age example above, is height a function of age? Is age a function of height?

    Solution

    In the height and age example above, it would be correct to say that height is a function of age, since each age uniquely determines a height. For example, on my 18 \({}^{th}\) birthday, I had exactly one height of 69 inches.

    However, age is not a function of height, since one height input might correspond with more than one output age. For example, for an input height of 70 inches, there is more than one output of age since I was 70 inches at the age of 20 and 21.

    Example \(\PageIndex{2}\)

    At a coffee shop, the menu consists of items and their prices. Is price a function of the item? Is the item a function of the price?

    Solution

    We could say that price is a function of the item, since each input of an item has one output of a price corresponding to it. We could not say that item is a function of price, since two items might have the same price.

    Example \(\PageIndex{3}\)

    In many classes the overall percentage you earn in the course corresponds to a decimal grade point. Is decimal grade a function of percentage? Is percentage a function of decimal grade?

    Solution

    For any percentage earned, there would be a decimal grade associated, so we could say that the decimal grade is a function of percentage. That is, if you input the percentage, your output would be a decimal grade. Percentage may or may not be a function of decimal grade, depending upon the teacher’s grading scheme. With some grading systems, there are a range of percentages that correspond to the same decimal grade.

    Exercise \(\PageIndex{1}\)

    Let’s consider bank account information.

    1. Is your balance a function of your bank account number? (if you input a bank account number does it make sense that the output is your balance?)
    2. Is your bank account number a function of your balance?(if you input a balance does it make sense that the output is your bank account number?)
    Answer a

    Yes: for each bank account, there would be one balance associated

    Answer b

    No: there could be several bank accounts with the same balance

    Function Notation

    To simplify writing out expressions and equations involving functions, a simplified notation is often used. We also use descriptive variables to help us remember the meaning of the quantities in the problem.

    Rather than write "height is a function of age", we could use the descriptive variable \(h\) to represent height and we could use the descriptive variable \(a\) to represent age.

    "height is a function of age" if we name the function \(f\) we write "\(h\) is \(f\) of \(a\)" or more simply \(h = f(a)\) we could instead name the function \(h\) and write \(h(a)\) which is read "\(h\) of \(a\)"

    Remember we can use any variable to name the function; the notation \(h(a)\) shows us that \(h\) depends on a. The value "\(a\)" must be put into the function "\(h\)" to get a result. Be careful - the parentheses indicate that age is input into the function (Note: do not confuse these parentheses with multiplication!).

    Definition: Function Notation

    The notation output = \(f\)(input) defines a function named \(f\). This would be read “output is \(f\) of input”

    Example \(\PageIndex{4}\)

    Introduce function notation to represent a function that takes as input the name of a month, and gives as output the number of days in that month.

    Solution

    The number of days in a month is a function of the name of the month, so if we name the function \(f\), we could write “days = \(f\)(month)” or \(d = f(m)\). If we simply name the function \(d\), we could write \(d(m)\)

    For example, \(d\)(March) = 31, since March has 31 days. The notation \(d(m)\) reminds us that the number of days, \(d\) (the output) is dependent on the name of the month, \(m\) (the input)

    Example \(\PageIndex{5}\)

    A function \(N = f(y)\) gives the number of police officers, \(N\), in a town in year \(y\). What does \(f\)(2005) = 300 tell us?

    Solution

    When we read \(f\)(2005) = 300, we see the input quantity is 2005, which is a value for the input quantity of the function, the year (\(y\)). The output value is 300, the number of police officers (\(N\)), a value for the output quantity. Remember \(N = f(y)\). This tells us that in the year 2005 there were 300 police officers in the town.

    Tables as Functions

    Functions can be represented in many ways: Words (as we did in the last few examples), tables of values, graphs, or formulas. Represented as a table, we are presented with a list of input and output values. In some cases, these values represent everything we know about the relationship, while in other cases the table is simply providing us a few select values from a more complete relationship.

    Table 1: This table represents the input, number of the month (January = 1, February = 2, and so on) while the output is the number of days in that month. This represents everything we know about the months & days for a given year (that is not a leap year)
    (input) Month number, \(m\) 1 2 3 4 5 6 7 8 9 10 11 12
    (output) Days in month, \(D\) 31 28 31 30 31 30 31 31 30 31 30 31
    Table 2: The table below defines a function \(Q = g(n)\). Remember this notation tells us \(g\) is the name of the function that takes the input n and gives the output \(Q\).
    \(n\) 1 2 3 4 5
    \(Q\) 8 6 7 6 8
    Table 3: This table represents the age of children in years and their corresponding heights. This represents just some of the data available for height and ages of children.
    (input) \(a\), age in years 5 5 6 7 8 9 10
    (output) \(h\), height inches 40 42 44 47 50 52 54

    Example \(\PageIndex{6}\)

    Which of these tables define a function (if any)? Are any of them one-to-one?

    Input Output
    2 1
    5 3
    8 6
    Input Output
    -3 5
    0 1
    4 5
    Input Output
    1 0
    5 2
    5 4

    Solution

    The first and second tables define functions. In both, each input corresponds to exactly one output. The third table does not define a function since the input value of 5 corresponds with two different output values.

    Only the first table is one-to-one; it is both a function, and each output corresponds to exactly one input. Although table 2 is a function, because each input corresponds to exactly one output, each output does not correspond to exactly one input so this function is not one-to-one. Table 3 is not even a function and so we don’t even need to consider if it is a one-to-one function.

    Exercise \(\PageIndex{2}\)

    If each percentage earned translated to one letter grade, would this be a function? Is it one-to-one?

    Answer

    Yes it’s a function; No, it’s not one-to-one (several percents give the same letter grade)

    Solving and Evaluating Functions

    When we work with functions, there are two typical things we do: evaluate and solve. Evaluating a function is what we do when we know an input, and use the function to determine the corresponding output. Evaluating will always produce one result, since each input of a function corresponds to exactly one output.

    Solving equations involving a function is what we do when we know an output, and use the function to determine the inputs that would produce that output. Solving a function could produce more than one solution, since different inputs can produce the same output.

    Example \(\PageIndex{7}\)

    Using the table shown, where \(Q = g(n)\)

    \(n\) 1 2 3 4 5
    \(Q\) 8 6 7 6 8
    1. Evaluate \(g(3)\)
    2. Solve \(g(n) = 6\)

    Solution

    Evaluating \(g(3)\) (read: "\(g\) of 3") means that we need to determine the output value, \(Q\), of function \(g\) given the input value of \(n = 3\). Looking at the table, we see the output corresponding to \(n = 3\) is \(Q = 7\), allowing us to conclude \(g(3) = 7\).

    (b) Solve \(g(n) = 6\)

    Solving \(g(n) = 6\) means we need to determine what input values, \(n\), produce an output value of 6. Looking at the table we see there are two solutions: \(n = 2\) and \(n = 4\).

    • When we input 2 into the function \(g\), our output is \(Q = 6\)
    • When we input 4 into the function \(g\), our output is also \(Q = 6\)

    Exercise \(\PageIndex{3}\)

    Using the function in Example \(\PageIndex{7}\), evaluate \(g(4)\)

    Answer

    When \(n = 4\), \(Q = g(4) = 6\)

    Graphs as Functions

    Oftentimes a graph of a relationship can be used to define a function. By convention, graphs are typically created with the input quantity along the horizontal axis and the output quantity along the vertical.

    graph (3).svg

    The most common graph has \(y\) on the vertical axis and \(x\) on the horizontal axis, and we say \(y\) is a function of \(x\), or \(y = f(x)\) when the function is named \(f\).

    Example \(\PageIndex{8}\)

    Which of these graphs defines a function \(y = f(x)\)? Which of these graphs defines a one-to-one function?

    graph.svg
    graph (1).svg
    graph (2).svg

    Solution

    Looking at the three graphs above, the first two define a function y=f(x), since for each input value along the horizontal axis there is exactly one output value corresponding, determined by the y-value of the graph. The 3 \({}^{rd}\) graph does not define a function y=f(x) since some input values, such as x=2, correspond with more than one output value.

    • Graph 1 is not a one-to-one function. For example, the output value 3 has two corresponding input values, -1 and 2.3
    • Graph 2 is a one-to-one function; each input corresponds to exactly one output, and every output corresponds to exactly one input.
    • Graph 3 is not even a function so there is no reason to even check to see if it is a one-to-one function.

    Vertical Line Test

    The vertical line test is a handy way to think about whether a graph defines the vertical output as a function of the horizontal input. Imagine drawing vertical lines through the graph. If any vertical line would cross the graph more than once, then the graph does not define only one vertical output for each horizontal input.

    Horizontal Line Test

    Once you have determined that a graph defines a function, an easy way to determine if it is a one-to-one function is to use the horizontal line test. Draw horizontal lines through the graph. If any horizontal line crosses the graph more than once, then the graph does not define a one-to-one function.

    Evaluating a function using a graph requires taking the given input and using the graph to look up the corresponding output. Solving a function equation using a graph requires taking the given output and looking on the graph to determine the corresponding input.

    Example \(\PageIndex{9}\)

    Given the graph of \(f(x)\)

    1. Evaluate \(f(2)\)
    2. Solve \(f(x) = 4\)
    graph (5).svg

    Solution

    (a) To evaluate \(f(2)\), we find the input of \(x = 2\) on the horizontal axis. Moving up to the graph gives the point (2, 1), giving an output of \(y = 1\). \(f(2) = 1\).

    (b) To solve \(f(x) = 4\), we find the value 4 on the vertical axis because if \(f(x) = 4\) then 4 is the output. Moving horizontally across the graph gives two points with the output of 4: (-1, 4) and (3, 4). These give the two solution to \(f(x) = 4\): \(x = -1\) or \(x =3\) This means \(f(-1) = 4\) and \(f(3) = 4\), or when the input is -1 or 3, the output is 4.

    Notice that while the graph in the previous example is a function, getting two input values for the output value of 4 shows us that this function is not one-to-one.

    Exercise \(\PageIndex{4}\)

    Using the graph from example \(\PageIndex{9}\), solve \(f(x) = 1\)

    Answer

    There are two points where the output is 1: \(x = 0\) or \(x = 2\)

    Formulas as Functions

    When possible, it is very convenient to define relationships using formulas. If it is possible to express the output as a formula involving the input quantity, then we can define a function.

    Example \(\PageIndex{10}\)

    Express the relationship \(2n + 6p = 12\) as a function \(p = f(n)\) if possible.

    Solution

    To express the relationship in this form, we need to be able to write the relationship where p is a function of n, which means writing it as \(p\) = [something involving \(n\)].

    \[2n + 6p = 12\nonumber \]subtract \(2n\) from both sides

    \[6p = 12 - 2n\nonumber \]divide both sides by 6 and simplify

    \[p=\dfrac{12-2n}{6} =\dfrac{12}{6} -\dfrac{2n}{6} =2- \dfrac{1}{3} n\nonumber \]

    Having rewritten the formula as \(p =\), we can now express \(p\) as a function:

    \[p=f(n)=2 - \dfrac{1}{3} n\nonumber \]

    It is important to note that not every relationship can be expressed as a function with a formula.

    Note the important feature of an equation written as a function is that the output value can be determined directly from the input by doing evaluations - no further solving is required. This allows the relationship to act as a magic box that takes an input, processes it, and returns an output. Modern technology and computers rely on these functional relationships, since the evaluation of the function can be programmed into machines, whereas solving things is much more challenging.

    As with tables and graphs, it is common to evaluate and solve functions involving formulas. Evaluating will require replacing the input variable in the formula with the value provided and calculating. Solving will require replacing the output variable in the formula with the value provided, and solving for the input(s) that would produce that output.

    Example \(\PageIndex{11}\)

    Given the function \(k(t) = t^3 + 2\)

    1. Evaluate \(k(2)\)
    2. Solve \(k(t) = 1\)

    Solution

    (a) To evaluate \(k(2)\), we plug in the input value 2 into the formula wherever we see the input variable \(t\), then simplify

    \[k(2) = 2^3 + 2\nonumber \]

    \[k(2) = 8 + 2\nonumber \]

    So \[k(2) = 10\nonumber \]

    (b) To solve \(k(t) = 1\), we set the formula for \(k(t)\) equal to 1, and solve for the input value that will produce that output

    \[k(t) = 1\nonumber \] substitute the original formula \[k(t) = t^3 + 2\nonumber \]

    \[t^3 + 2 = 1\nonumber \] subtract 2 from each side

    \[t^3 = -1\nonumber \] take the cube root of each side

    \[t = -1\nonumber \]

    When solving an equation using formulas, you can check your answer by using your solution in the original equation to see if your calculated answer is correct.

    We want to know if \(k(t)=1\) is true when \(t=-1\).

    \[\begin{array} {rcl} {(k(-1)} &= & {(-1)^3 + 2} \\ {} &= & {-1 + 2} \\ {} &= & {1 \text{ which was the desired result.}} \end{array}\nonumber \]

    Example \(\PageIndex{12}\)

    Given the function \(h(p)=p^{2} +2p\)

    1. Evaluate \(h(4)\)
    2. Solve \(h(p) = 3\)

    Solution

    To evaluate \(h(4)\) we substitute the value 4 for the input variable \(p\) in the given function.

    (a) \[\begin{array} {rcl} {h(4)} &= & {(4)^2 + 2(4)} \\ {} &= & {16 + 8} \\ {} &= & {24} \end{array}\nonumber \]

    (b) \(h(p) = 3\) Substitute the original function \[h(p) = p^2 + 2p\nonumber \]

    \[p^{2} +2p = 3\nonumber \] This is quadratic, so we can rearrange the equation to get it = 0

    \[p^{2} +2p - 3 = 0\nonumber \] subtract 3 from each side

    \[p^{2} +2p - 3 = 0\nonumber \] this is factorable, so we factor it

    \[(p + 3) (p - 1) = 0\nonumber \]

    By the zero factor theorem since \((p + 3)(p - 1) = 0\), either \((p+3)=0\) or \((p-1)=0\) (or both of them equal 0) and so we solve both equations for \(p\), finding \(p = -3\) from the first equation and \(p = 1\) from the second equation.

    This gives us the solution: \(h(p) = 3\) when \(p = 1\) or \(p = -3\)

    We found two solutions in this case, which tells us this function is not one-to-one.

    Exercise \(\PageIndex{5}\)

    Given the function \(g(m) = \sqrt{m - 4}\)

    1. Evaluate \(g(5)\)
    2. Solve \(g(m) = 2\)
    Answer

    a. \(g(5) = \sqrt{5 - 4} = 1\)
    b. \(\sqrt{m - 4} = 2\). Square both sides to get \(m - 4 = 4\). \(m = 8\)

    Important Topics of this Section

    • Definition of a function
    • Input (independent variable)
    • Output (dependent variable)
    • Definition of a one-to-one function
    • Function notation
    • Descriptive variables
    • Functions in words, tables, graphs & formulas
    • Vertical line test
    • Horizontal line test
    • Evaluating a function at a specific input value
    • Solving a function given a specific output value

    This page titled 1.1: Functions and Function Notation is shared under a CC BY-SA license and was authored, remixed, and/or curated by David Lippman & Melonie Rasmussen (The OpenTextBookStore) .