(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
Glossary
function

a relation from a set of inputs to a set of possible outputs, where each input is related to exactly one 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°$\displaystyle temperature \gt 80°$)

• Did I get paid enough for painting that fence? (paid \ge $100$\displaystyle paid \ge 100$) • Are the cookies finished baking? (timer = 0$\displaystyle timer = 0$) Have students come up with other examples. Many times we need to combine inequalities: • Should I go to the beach? (temperature > 80°$\displaystyle temperature \gt 80°$ and weather = "sunny"$\displaystyle weather = "sunny"$) • Was this burrito worth the price? (taste = "delicious"$\displaystyle taste = "delicious"$ and price ≤$15$\displaystyle price \leq 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$\displaystyle x \gt 5$

• x \le 15$\displaystyle x \le 15$

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

How would that be different from x > 5$\displaystyle x \gt 5$ or x \le 15$\displaystyle 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, 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 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?