Grade 9 Math and Coding. Making Connections

Grade 9 Math and Coding

In grade 9 Math and Coding become a more organic combination and meaningful connections can be made between the two.

In this blogpost we will go over a number of concepts that could be discussed in class in order to demonstrate the connections between math and coding in a grade 9 math class.

Variables in Math and Coding

A variable is a value that is represented by a symbol and can change based on specifically defined conditions.

In mathematics we see variables in algebraic expressions and algebraic equations; in proportions; in word problems that require us to assign variables to certain given quantities.

3x^2 - 2y

In the above algebraic expression there are two variables represented by two letters of the alphabet: x and y. Depending on what numerical values we substitute in place of these variables, the value of the whole expression changes.

Given that  x=3 and y=10, evaluate the expression 3x^2-2y

3(3)^2-2(10)=27-20=7

If the variables were different numbers, the value of the expression could be different.

When it comes to coding, we also set variables and assign values to them. In coding, the variables are not necessarily letters of the alphabet and their values are not always numerical.

For example, using JavaScript, we can assign the following

var carName;

carName = “Ford”;

What we are stating is that the name of the car can differ and depends on what value we assign to the variable. In the above case, the variable is the carName.

Notation and Accuracy in Math and Coding

Math teacher always emphasize proper notation, form and accuracy in mathematics. They do so because it helps students learn to pay attention to details and organize their solution in a clear manner, which can also translate onto coding.

When we code, one missed comma or one wrong line of code will make the whole program not work. Programmers are very attentive to format and ensure their code is 100% accurate. If they miss something in, for example, three pages of code, it would be extremely difficult to find the ommission.

We call this process of adhering to proper notation, form and accuracy the algorithm. It means a set of steps that need to be taken/followed in order to obtain the desired result.

Solving an algebraic equation is the best example of following the algorithm:

2x+1=x+10

2x-x=10-1

x=9

In order to get the right solution to the above equation, we followed the steps precisely. If we missed a sign or combined the algebraic terms incorrectly, the solution would not make sense and our “code” would be “broken”.

When we code (let us do JavaScript again), we do so line by line, ensuring commas, colons, semicolons are inserted properly, as each one of the symbols means a whole lot and affects the outcome:

<script>
let carName = “Ford”;
document.getElementById(“presentation”).innerHTML = carName;
</script>

Functions in Math and Coding

A concept of a function is a very important one in both mathematics and programming.

Setting a function means to create a relation where there is an input and a corresponding unique output.

In grade 9 math we focus on linear functions and talk about real life situations where there is a relationship involving a constant change. Students also learn how to operate different formulas.

There are other types of basic mathematical functions, as well as function combinations.

In coding functions help predetermine certain outputs based on specific inputs.

Say, we want to convert temperature in Fahrenheit into temperature in Celsius. There is an established formula that determines the relationship between the two systems. That formula is unique and when we input the value in Fahrenheit into that formula we get the corresponding value in Celsius. This is how functions work.

Instead of doing the calculations ourselves every time, we can program the computer using JavaScript to do it:

function toCelsius(fahrenheit) {
  return (5/9) * (fahrenheit32);
}
document.getElementById(“temperature”).innerHTML = toCelsius(77);

Can you think of more examples of connections between math and coding? Comment below.

Read about the history of equations and algorithms.

Learn more about functions.

1

One thought on “Grade 9 Math and Coding. Making Connections

  1. Pingback: My Homepage