Using coding to teach Algebra – creating simple scripts in Scratch

Algebra is one of those often reviled topics for students – it’s too hard, it doesn’t make sense, and what the heck are those letters doing in a maths equation! Finding ways to connect students with the concepts that underpin those seemingly meaningless questions helps them grow confidence and may even change their attitude!

Over the last few years I have played around with using Scratch to have my students engage with Algebra. Scratch is a free, online coding platform that can be used to teach a variety of subjects, including algebra.

I have developed a unit on Learning Algebra with Coding that is built around a project based approach. The unit has a progressive set of coding challenges that are rooted in an algebraic concept. The unit begins by introducing students to the basics of coding, such as variables, loops, and conditionals. Students then use these concepts to create projects that explore algebraic concepts, such as linear equations, functions, and recursion. Variables are an essential concept to understand and I often introduce this by getting students to think of where they see variables in their world.

Projects

Here is the list of project for students to complete (worked examples are also available in a Scratch studio). Please note that this list has links to worked solutions so shouldn’t be shared with students as they should figure out the solution themselves!

Pattern maker: create a project that has number patterns (odd, even, square, prime, Fibonacci…). Try to also create some sound patterns and drawing patterns using the pen tool.

Programming music patterns: create a programme for users to interact with to create or modify a musical pattern.

Cartesian plane: using the xy-backdrop, create a project where users input a co-ordinate pair which moves a sprite

Exploring Mars: follow the steps at this site to create a programme for a Mars rover

Plotting patterns: create a project where users enter a rule (e.g. + 3, – 5) or a gradient and y-intercept which the programme plots a straight line on a cartesian plane

Battle ships: create a project that is like the old school game of ‘Battleships’.

Function machine: create a project that generates a list of co-ordinate pairs and users have to input the rule

Guess my number: create a project that the user ‘guesses’ the number that the code started with

Polygon maker: create a project where the user inputs the number of sides of a polygon and the programme draws this shape showing the size of the interior angle, exterior angle, and sum of interior angles.

Pi finder: create a project where the user inputs a value for the diameter of a circle, and the programme draws the circle showing that the diameter fits about 3 times in the circumference.

Classroom noise monitor: create a project that monitors classroom noise (use the ‘loudness’ variable in the Sensing blocks)y

Finding water on Mars: make a remix of this Scratch project and programme the rover to autonomously ‘find’ the water (blue crystal).

Magic 8 Ball: Create a project for a magic 8 ball. Use a random probability (between 0-1) to return an answer relating to 8 different probability terms (unlikely, likely, possible, probable, impossible, very likely, certain, poor chance, 50-50 chance, good chance)

Calculator: Follow this tutorial to make a Scratch calculator.

Giving feedback on student projects

So you have your class working on all these different coding projects. How to see where they are all up to so that you can give them some next steps? You can use a combination of a Google Form and a shared Google Sheet. Check out this video for a walk through:

In conclusion, coding can be a fun and engaging way to teach algebra. Scratch is a visual and interactive platform that makes it easy for students to understand algebraic concepts. Students can experiment with different algebraic concepts and see how they affect the output of a program. This helps students to stay motivated and engaged in their learning.

If you are a math teacher looking for a way to make your lessons more engaging and interactive, then I encourage you to try using Scratch. It is a free, online platform that is easy to learn and use. Let me know how you get on!

This entry was posted in teaching. Bookmark the permalink.

Leave a Reply