(Also available in Pyret)

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 I can find the value of an expression such as f(3), given a table, graph or symbolic definiton. Materials This lesson is unplugged and does not require a computer.
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 Wescheme 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.

(define (gt size) (triangle size "solid" "green"))

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

(gt 10)

(triangle 10 "solid" "green") 🖼Show image

(gt 20)

(triangle 20 "solid" "green") 🖼Show image

(gt 30)

(triangle 30 "solid" "green") 🖼Show image

(gt 40)

(triangle 40 "solid" "green") 🖼Show image

(gt 50)

(triangle 50 "solid" "green") 🖼Show image

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

(define (f x) (+ x 8))

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

f10$\displaystyle f(10)$

(+ 10 8)

18

f20$\displaystyle f(20)$

(+ 20 8)

28

f30$\displaystyle f(30)$

(+ 30 8)

38

f40$\displaystyle f(40)$

(+ 40 8)

48

f50$\displaystyle f(50)$

(+ 50 8)

58

Once again, the input is substituted for the variable.

You’ve already seen that Wescheme 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 Wescheme Defining Functions in Function Notation

(define (f x) (+ x 8))

fx = x + 8$\displaystyle f(x) = x + 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.

fx = x + 8$\displaystyle f(x) = x + 8$

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

f10$\displaystyle f(10)$

10 + 8$\displaystyle 10 + 8$

18

f20$\displaystyle f(20)$

20 + 8$\displaystyle 20 + 8$

28

f30$\displaystyle f(30)$

30 + 8$\displaystyle 30 + 8$

38

f40$\displaystyle f(40)$

40 + 8$\displaystyle 40 + 8$

48

f50$\displaystyle f(50)$

50 + 8$\displaystyle 50 + 8$

58

### Investigate

• 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)

### Synthesize

You can think of f3$\displaystyle f(3)$ as a question.

• What question is it asking you to evaluate?

• What is the value of x + 8$\displaystyle x + 8$ when x$\displaystyle x$ is 3?

• What is another way you can ask it?

• What is 3 + 8$\displaystyle 3 + 8$?

## 🔗Function Notation (Graphs) 15 minutes

### Overview

Students will learn to connect function definitions to Graphs.

### Launch

• If fx = x - 5$\displaystyle f(x) = x - 5$, what is the value of f7$\displaystyle f(7)$, and why?

• 2$\displaystyle 2$. Because if we substitute 7 for x we get 7 - 5 = 2$\displaystyle 7 - 5 = 2$

• What is the value of f8$\displaystyle f(8)$?

• 3$\displaystyle 3$. Because if we substitute 8 for x we get 8 - 5 = 2$\displaystyle 8 - 5 = 2$

• What is the value of f9$\displaystyle f(9)$?

• 4$\displaystyle 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 fx = x - 5$\displaystyle f(x) = x - 5$. 🖼Show image

• How could we have determined that f7 = 2$\displaystyle f(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 f3$\displaystyle f(3)$?

• -2

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

• Answers will vary. For example: f0 = -5$\displaystyle f(0) = -5$ or f0.5 = -4.5$\displaystyle f(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: 🖼Show image

• From looking at the graph, what is the value of f-2$\displaystyle f(-2)$?

• -4

• What is the value of f1$\displaystyle f(1)$?

• 2

• What is the value of f3$\displaystyle f(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, f-1 = 4$\displaystyle f(-1) = 4$ or f2 = 4$\displaystyle f(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 f2$\displaystyle f(2)$, we ignore the hollow point at (2, 4)$\displaystyle (2, 4)$ and focus on the solid point at 2,3$\displaystyle (2,3)$, so f2 = 3$\displaystyle f(2) = 3$. 🖼Show image What is the value of f0$\displaystyle f(0)$ in the graph above? 3

### 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, f4$\displaystyle f(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 fx = x - 5$\displaystyle f(x) = x - 5$, and think about how could we have determined the value of f7$\displaystyle f(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 f-10$\displaystyle f(-10)$?

• -15

 x -10 -5 5 7 13 y -15 -10 0 2 8

### 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, and 1738598). 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.