instagram

(Also available in Pyret)

Students build upon their understanding of booleans and simple inequalities to compose compound inequalities using the concepts of union and intersection.

Lesson Goals

Students will be able to:

  • Understand how the conjunctions and and or differ

  • Describe how functions can work together

  • Describe the solution set of a compound inequality

Student-Facing Lesson Goals

  • I can explain the difference between how and and or are used in programming

  • I can use two or more inequalities together and describe the area they enclose

Materials

Preparation

  • Make sure all materials have been gathered

  • Decide how students will be grouped in pairs

Glossary
function

a mathematical object that consumes inputs and produces an output

intersection

the set of values that makes both inequalities true

union

the set of values that makes either or both of a set of inequalities true

🔗Introducing Compound Inequalities

Overview

Students consider the need to compose inequalities, and think about how to write them.

Launch

We use inequalities for lots of things:

  • Is it hot out? (temperature > 80°)

  • Did I get paid enough for painting that fence? (paid \ge $100)

  • Are the cookies finished baking? (timer = 0)

Have students come up with other examples.

Many times we need to combine inequalities:

  • Should I go to the beach? (temperature > 80° and weather = "sunny")

  • Was this burrito worth the price? (taste = "delicious" and price ≤ $15)

Have students come up with other examples.

Guide students through other examples of and and or with various statements, such as "I’m wearing a red shirt AND I’m a math teacher, true or false?" or "I’m an NBA basketball star OR I’m having pizza for lunch, true or false?". This can make for a good sit-down, stand-up activity, where students take turns saying compound boolean statements and everyone stands if that statement is true for them.

Investigate

Both mathematics and programming have ways of combining - or composing - inequalities.

Synthesize

Be really careful to check for understanding here.

  • Expressions using and only produce true if both of their sub-expressions are true.

  • Expressions using or produce true if either of their sub-expressions are true.

Strategies for English Language Learners

When describing compound inequalities, be careful not to use "english shortcuts". For example, we might say "I am holding a marker and an eraser" instead of "I am holding a marker and I am holding an eraser." These sentences mean the same thing, but the first one obscures the fact that "and" joins two complete phrases. For ELL/ESL students, this is unecessarily adds to cognitive load!

🔗Solutions and Non-Solutions of Compound Inequalities

Launch

Have students identify 4 solutions and 4 non-solutions for each of the following inequalities.

  • x > 5

  • x \le 15

What about the solution set of x > 5 and x \le 15? What numbers make both of these inequality expressions true?

How would that be different from x > 5 or x \le 15? What numbers make at least one of these inequality expressions true?

Investigate

Have students log in to the

Compound Inequalities Starter File (Wescheme), read the code carefully and click run to see the graphs they’ve just considered.

This starter file includes two special functions.

and-intersection takes in two functions and a list of numbers and produces a graph with the points and the shaded intersection of values that make both of the inequalities true.

(define (gt5 x) (> x 5))

(define (lte15 x) (<= x 15))

(and-intersection gt5 lte15 (list -5 -2.1 0 5 10 39/5 15 20))

(define (lt5 x) (< x 5))

(define (gte15 x) (>= x 15))

(and-intersection lt5 gte15 (list -5 -2.1 0 5 10 39/5 15 20))

Note: Some pairs of inequalities do not intersect at all and therefore have no solutions.

or-union takes in two functions and a list of numbers and produces a graph with the points and the shaded union of values that make either or both of the inequalities true.

(define (lt5 x) (< x 5))

(define (gte15 x) (>= x 15))

(or-union lt5 gte15 (list -5 -2.1 0 5 10 39/5 15 20))

(define (gt5 x) (> x 5))

(define (lte15 x) (<= x 15))

(or-union gt5 lte15 (list -5 -2.1 0 5 10 39/5 15 20))

Note: Some unions, like the one below, include all real numbers; they have have infinite solutions that satisfy at least one of the inequalities.

Turn to Compound Inequalities: Solutions & Non-Solutions and explore the compound inequalities listed using the Compound Inequalities Starter File, identifying solutions and non-solutions for each.

Instead of defining two functions as simple inequalities, we could produce the same graph by defining one function to be a compound inequality.

(define (fiveto15 x) (and (> x 5) (<= x 15))) (inequality fiveto15 (list -5 -2.1 0 5 10 12 15 20))

Turn to Compound Inequality Functions and have students write code to describe the compound inequalities pictured.

Synthesize

  • How did the graphs of intersections and unions differ?

🔗Additional Exercises:

These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, and 1738598). 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.