instagram

(Also available in WeScheme)

Students learn to read function notation and evaluate expressions using function definitions, tables, and graphs.

Lesson Goals

Students will be able to:

  • Identify the value that applying a function (e.g. - f(3)) produces from symbolic definitions, tables, or graphs.

Student-Facing Lesson Goals

  • Let’s learn how to find the value of an expression such as f(3), from a table, a graph or a symbolic definiton.

Materials

Supplemental Materials

Glossary
apply

use a given function on some inputs

coordinate plane

a grid formed by a pair of intersecting horizontal and vertical number lines

evaluate

perform the computation in an expression, producing an answer

function

a relation from a set of inputs to a set of possible outputs, where each input is related to exactly one output

function notation

a standard way to denote functions, beginning with a function name, such as f or gt, the variable(s) the function takes in, such as x or size, and a definition of what the function does using a formula in terms of the variable. For example, f(x) = x + 1 takes in a number and adds 1.

line

an infinite collection of points forming a straight one-dimensional figure having no thickness and extending infinitely in both directions

substitute

replace a variable with a value or expression and evaluate or simplify the resulting expression

variable

a name or symbol that stands for some value or expression, often a value or expression that changes

🔗Function Notation (Definitions) 15 minutes

Overview

Students connect their understanding of function definitions in Pyret to function definitions in math.

Launch

We’ve seen how functions like gt can be defined, and then applied to a number to create a green triangle. And once gt is defined, we can use it with many different numbers to create many different triangles - all without having to write out "solid", "green", etc.

But how does this function work?

When we apply a function to some inputs, we substitute those inputs for the variables in the definition. In the example below, the inputs are substituted for the variable size in the body of the gt function.

fun gt​(​size​): triangle​(​size, "solid", "green"​) end

Apply the Function Substitute the Input(s) Compute the Answer

gt​(​10​)

triangle​(​10, "solid", "green"​)

gt​(​20​)

triangle​(​20, "solid", "green"​)

green triangle of size 20

gt​(​30​)

triangle​(​30, "solid", "green"​)

green triangle of size 30

gt​(​40​)

triangle​(​40, "solid", "green"​)

green triangle of size 40

gt​(​50​)

triangle​(​50, "solid", "green"​)

green triangle of size 50

Let’s take a look at a function that works with Numbers:

fun f​(​x​): x + 8 end

Apply the Function Substitute the Input(s) Compute the Answer

𝑓(10)

10 + 8

18

𝑓(20)

20 + 8

28

𝑓(30)

30 + 8

38

𝑓(40)

40 + 8

48

𝑓(50)

50 + 8

58

Once again, the input is substituted for the variable.

You’ve already seen that Pyret looks a little different from traditional math, even if it behaves the same way.

Math books use something called Function Notation to define functions. Here’s a side-by-side comparison of the same function, in our programming language and in function notation:

Defining Functions in Pyret Defining Functions in Function Notation

fun f​(​x​): x + 8 end

𝑓(𝑥) = 𝑥 + 8

  • What do these forms have in common?

    • Both forms show the name of the function, as well as the names of the variables. They also show what the function does with those variables.

  • How are these forms different from one another?

    • In Pyret, we use a colon instead of an equals sign. In Pyret, we see fun at the beginning and end at the end.

In math - just as in programming - we compute the value of the expression for any specific input by substituting numbers for the variable(s) used in the definition, just as we did with gt.

Investigate

  • Turn to Matching Examples and Definitions (Math)

  • Start by looking at each table and highlighting what is changing from the first row to the following rows.

  • Then, match each table to the function that defines it.

You may also want to have students complete Matching Examples & Function Definitions (Math) (Desmos)

For more challenging function notation evaluation exercises direct students to Function Notation Challenge.

Synthesize

You can think of 𝑓(3) as a question.

  • What question is it asking you to evaluate?

    • What is the value of 𝑥 + 8 when 𝑥 is 3?

  • What is another way you can ask it?

    • What is 3 + 8?

🔗Function Notation (Graphs) 15 minutes

Overview

Students will learn to connect function definitions to Graphs.

Launch

  • If 𝑓(𝑥) = 𝑥 − 5, what is the value of 𝑓(7), and why?

    • 2. Because if we substitute 7 for x we get 7 − 5 = 2

  • What is the value of 𝑓(8)?

    • 3. Because if we substitute 8 for x we get 8 − 5 = 2

  • What is the value of 𝑓(9)?

    • 4

For each of these inputs, we have an output. If we graph each input-output pair on the coordinate plane, we can "see" the function as a line on a graph.

Let’s take a look at the graph of 𝑓(𝑥) = 𝑥 − 5.

a diagonal line passing through the points (0, -5) (1, -4) (2, -3) (3, -2) (4, -1) (5,0) (6,1) (7,2) 8,3) (9,4)

  • How could we have determined that 𝑓(7) = 2 from looking at the graph, if we hadn’t started with the function definition?

    • We could have looked for a point whose y-coordinate was 2. This would lead us to the point (7, 2), which tells us that the output of the function when x is 7 is 2.

  • From looking at the graph, what is the value of 𝑓(3)?

    • -2

  • What other values on this graph could we describe using function notation?

    • Answers will vary. For example: 𝑓(0) = −5 or 𝑓(0.5) = −4.5

Even if we can’t see the definition of a function, we can reason about it just by looking at the graph!

Let’s look at the graph below, which shows only a few points on the line drawn by a function:

a series of points on a graph: (-4,1), (-2,-4), (-1,4), (-3,-3), (1,2), (2,4), (4,-1)

  • From looking at the graph, what is the value of 𝑓(−2)?

    • -4

  • What is the value of 𝑓(1)?

    • 2

  • What is the value of 𝑓(3)?

    • There isn’t one! It’s undefined.

  • What other values on this graph could we describe using function notation?

    • Answers will vary. For example, 𝑓(−1) = 4 or 𝑓(2) = 4

Optional: Piecewise Functions

When evaluating an expression for a piecewise function, points on the graph marked with hollow circles are boundary points, but not part of the solution set, so we ignore them and focus on the solid points. For example, on the graph below, when evaluating 𝑓(2), we ignore the hollow point at (2, 4) and focus on the solid point at (2,3), so 𝑓(2) = 3.

graph of a piecewise function with 4 separate curvy and linear sections. Hollow endpoints at (0,2.5) and (2,4). solid endpoints at (0,3) and (2,3)

  • What is the value of 𝑓(0) in the graph above?

    • 3

Investigate

Synthesize

  • Can you think of any values that it would be difficult to determine from one of these graphs?

    • It would be hard to be precise for many of the points on the graphs that curve. For example, 𝑓(4) on the second graph would have to be a decimal value and it’s hard to know exactly what the decimal should be without a function definition to evaluate…​

🔗Function Notation (Tables) 15 minutes

Overview

Students will learn to connect function definitions to input-output Tables.

Launch

  • Let’s take a look at a table of input-output pairs that satisfy the function 𝑓(𝑥) = 𝑥 − 5, and think about how could we have determined the value of 𝑓(7) from looking at the table.

    • We would just look for 7 in the x-column and see that the value beside it is 2.

  • Looking at the table, what is the value of 𝑓(−10)?

    • -15

x

-10

-5

5

7

13

y

-15

-10

0

2

8

Investigate

Synthesize

  • What did you Notice?

  • What did you Wonder?

  • A few of the tables did not represent functions. Which ones?

    • The last one in the top row, the last one in the middle row and the 3rd one in the bottom row.

  • How did the fact that those tables weren’t functions impact our ability to describe a value using function notation?

    • When x appeared more than once in the table and was associated with different outputs, it wasn’t clear what number the expression should evaluate to.

These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, 1738598, 2031479, and 1501927). CCbadge Bootstrap by the Bootstrap Community is licensed under a Creative Commons 4.0 Unported License. This license does not grant permission to run training or professional development. Offering training or professional development with materials substantially derived from Bootstrap must be approved in writing by a Bootstrap Director. Permissions beyond the scope of this license, such as to run training, may be available by contacting contact@BootstrapWorld.org.