# MATH + CODING WORKSHOP 5-6

Designed to serve as a base lesson plan for diverse learning settings (f2f, hybrid, online, parents/children).

Although designed with the Ontario 5-6 math curriculum in mind, this workshop would be of value to all educators interested in learning how to integrate math + coding.

Based on Understanding Math + Coding, 1-9.

## B. WHAT IS AN “INEQUALITY” IN MATH?

#### PUZZLE #1

I am thinking of a number on the number line.

The number I am thinking of is greater than 3.

1. What are the possible values of my number?

#### INEQUALITY

x > 3 is an inequality.

x > 3 is read as “x is greater than 3“.

If x > 3, then x could be one of the numbers in the set {4, 5, 6, 7 …}.

We can show this on a number line:

Notice the arrow after the number 7, indicating that the dot pattern continues.

#### PUZZLE #2

2. How many cubes might be in the bag?

3. Which of the following are equivalent to the above?

a)

x + 2 > 5

b)

x > 3

c)

d)

## C. WHAT IS A CONDITIONAL STATEMENT?

#### DO I NEED AN UMBRELLA OR BOOTS?

You know how to dress to match the weather outside because you use conditional thinking.

• If it is raining, then:
• take an umbrella
• If it is snowing, then:
• wear boots

#### MAKING COMPUTERS “THINK”

If you wanted a computer to print numbers that are greater than 3, you could say:

• print (4)
• print (5)
• print (6)
• print (7)
• … and so on

Or you can use a conditional statement, to create more efficient code, and to get the computer to do more thinking:

• if number > 3:
• print (number)

What this looks like in computer code:

## D. INEQUALITIES in 1D, 2D and 3D

How do we represent a solution to an inequality like x > 3?

• We can list the numbers that make the inequality true as a set: {4, 5, 6, 7, 8, 9 …}
• We can plot the numbers that make on a number line:

These solutions assume a one-dimensional (1D) setting.

What if we assume a two-dimensional (2D) setting, like the flat surface of a floor?

Or in our 3-dimensional (3D) setting, like a classroom?

#### ON A NUMBER LINE (1D)

If you live in one dimension (1D), you live on a line.

Let’s add numbers to make it a number line.

1. Use masking tape for the line, and sticky notes for the numbers, to create a number line on the floor. A square tile floor would be best.

2. Hop on the numbers that match each inequality:

• number > 5
• number < 2
• x > 0
• x <= 6

#### ON A FLOOR (2D)

If you live in two dimensions (2D), you live on a flat surface, like a floor. You live on “flatland”.

Let’s add axes in two directions, to create a coordinate system for the flat surface.

3. Add a second number line on the floor, as shown above.

If you were to paint your floor pink, to represent the inequality x > 3, it would look as shown on the right.

Why did we shade the whole region, and not just put dots where the grid lines meet?

We could use dots, and it would like the grid on the right.

How we represent an inequality on a grid (or number line) depends on what set of numbers we have in mind.

• If we are using integers, then x > 3 would like the dotted grid above.
• If we are using integers and all the numbers in-between, then x > 3 would be a shaded grid.

4. How would you represent each inequality?

• x > 0
• x < -6

#### IN A ROOM (3D)

If you live in three dimensions (3D), you live in the real world.

5. To add the third dimension, tape one end of a string to where the 2 axes on the floor meet, and tape the other end vertically above on the ceiling.

Here is what x > 0 looks like in 3D.

6. What would each inequality below look like in 3D?

• x > 50
• x < 0

## E. INEQUALITIES WITH PYTHON

In this section, we will use a Python coding environment, provided by the University of Waterloo, to represent inequalities with code.

#### Listing numbers with Python

1. Go to cscircles.cemc.uwaterloo.ca/console and enter the Python code below.

2. Run the code to see this output:

3. Edit the code to get a different result.

4. Explain how the code works.

#### SOLVING INEQUALITIES WITH PYTHON

5. Edit the code as shown below.

6. Predict which numbers will be listed.

7. Run the code to test your prediction.

8. Edit the code as shown below in a), b) and c).

• For each case:
• Predict which numbers will be listed.
• Run the code to test your prediction.
• Explain the results.

a)

b)

c)

#### COMPARE PYTHON & SCRATCH

9. See/run these 2 versions of Scratch code at https://scratch.mit.edu/projects/472582028/editor

10. Edit the second version of Scratch code, so it uses the following condition:

11. How is Scratch code different from or similar to Python code?

## F. PLOTTING INEQUALITIES WITH SCRATCH

1. Go to https://scratch.mit.edu/projects/494015607/editor to see and run the Scratch code shown below.

2. What does this code block do?

3. What does this group of code blocks do?

4. Edit the code to get the result below.

5. Edit the code to get the result below.

#### Inequalities in 2D

6. How is the Scratch code below different from the Scratch code in #1 above?

7. Predict what the output would be.

8. Go to https://scratch.mit.edu/projects/494017754/editor to run this Scratch code and test your prediction.

9. Edit the code to represent other inequalities.

10. What would the output be if we made this edit?

11. Make the edit and run the code to test your prediction.

#### INEQUALITIES IN 3D

By the way, other versions of Python can plot inequalities in 3D.

## G. NUMBERS ON THE HUNDRED CHART

2. Run the code to see this output.

3. Run this code https://learnx.ca/sets/?id=53ecb560631267fe8de955940d297efb to see its output.

4. Edit the code to create new patterns.