# LINEAR RELATIONS – with Python

The Python code shown below plots 2 linear relations, y1 & y2.

The code is available at: https://colab.research.google.com/drive/1CPXgmUuG2sz4GOkUXc8izM2hm73dqjBr?usp=sharing.

Execute, edit and re-execute, and study the code and its output to understand how it works.

Alter the code to plot a 3rd relation which is:

1. The sum of y1 and y2
2. The difference of y1 and y2
3. The product of y1 and y2
4. The quotient of y1 and y2

For each of the above:

1. Alter parameters and execute the code to understand the characteristics and meaning of y3
2. Add organized notes in the text cell above the code to illustrate, through examples, the characteristics and meaning of y3

2. SCAFFOLDING

This ideas below may be used, as needed, to support students in understanding and completing the above task.

## 1. CONTEXT

#### A. CURRICULUM CONNECTIONS

Coding topics (Python): lists (arrays), plotting libraries

Math topics: properties of linear relations, plotting linear relations, “operations” with linear relations, non-linear relations

## 2.  LINEAR RELATIONS

#### A.  Slope

The slope of a linear relation is represented by m in y = mx + b.

• Slope is the rate at which the y-values change The greater the value of m, the faster the the graph rises.
• In the image on the right, the blue graph has a greater slope or rate of change than the green one.
• A useful analogy is to think of x as time, y as distance, and m as speed. The greater the speed, the more distance that is travelled over time.

#### B.  y-intercept

The y-intercept in a linear relation is  represented by b in y = mx + b.

• The y-intercept is where the graph crosses the y-axis.
• The y-intercept is sometimes also  referred to as the initial value. Initially, when x = 0, y = mx + b = m(0) + b = b

#### C.  x-intercept

The x-intercept in a linear relation is the point where the graph crosses the x-axis, or when y = 0.

• To find the x-intercept, we set y =0 and solve 0 = mx + b.
• So, for y = 2x – 8, we have: 0 = 2x -8, or x = 4.2.

## 3. “OPERATIONS” WITH LINEAR RELATIONS

When we add (or subtract) linear relations then, for every x-value, we add (or subtract) their y-values.

• Notice how this works in the table.
• Is y3 a linear relation?
• How do you know?

#### B.  Multiplication

When we multiply linear relations then, for every x-value, we multiply their y-values.

• Notice how this works in the table.
• Is y3 a linear relation?
• How do you know?

#### C.  Division

When we multiply linear relations then, for every x-value, we divide their y-values.

• Notice how this works in the table.
• Is y3 a linear relation?
• How do you know?