Skip to Content

Making Math with Scratch

If you follow Patrick Honner on Twitter, you know that his ardor for math learning knows no bounds. His passion for Scratch—especially as a tool for deeper math learning—is also evident in many of his posts, such as this:

 

Patrick, a 2013 Presidential Award-winning teacher at Brooklyn Technical High School in New York, recently hosted a Math for America workshop called Mathematics and Scratch, wherein participants “solved math problems using computer science, and computer science problems using math.” On the event page, Patrick described his aims: “I hope that teachers will leave with some ideas about how to get their own students making math in Scratch.” We recently spoke with Patrick to learn more about what making math with Scratch looks like—both with the teachers in his recent workshop and in his classroom. 


Getting Started

As with any group, the teachers at the workshop had diverse interests, experiences, and levels of comfort with programming. And while teachers may be familiar with Scratch, they sometimes think of it as a "toy" programming language, Patrick said. So he begins by sharing example projects from his advanced high school courses. “I’ve been facilitating similar workshops for a year and a half in various venues. Now I know to start with an inoculation. You just show them some of the things that we can do!” For example:

A simple "random walk" that generates its own histogram:


 

A student project that explores solutions to the Traveling Salesperson problem:

After seeing some of what’s possible with Scratch, Patrick invited teachers to tinker with a basic function game in Scratch. The goal was to implement a variety of mathematical functions programmatically, and this required the teachers to think about how certain mathematical concepts—like order of operations and domain and range—are understood from a programmer's perspective. You may think you know how to compute x2 + 3x + 1, but trying to get a computer program to do it is a different story, Patrick explained.  “You can give this to kids and it will just drive them nuts.”

Screenshot from Basic Functions example project:

Implementing Algorithms

Once the participants were comfortable building their functions in Scratch, they were challenged with more complex mathematical procedures, like finding maximum and minimum values of functions, and even building their own graphing calculator. "Teachers often use the metaphor of a 'function machine' when talking about mathematical functions, but what’s beautiful about using Scratch in this way is that you’re really building the function machine!" Patrick said. "Students are getting access to the mathematical idea of a function in a different way."

As teachers tinkered with the various programs, Patrick traversed the room, helping people get unstuck. But grappling with the challenges was also part of the process. “In Scratch, if you’re not getting the results you want, you have to go back in and figure it out. This attitude is really important when doing math, but to students it might seem more natural when programming." Through this process, learners develop an experimental mindset, a key disposition for both math and computer science.


Asking Questions

In the classroom, Patrick starts off an exploration of simulations by sharing a project like this Basic Simulation of Falling Objects, asking students to pose questions about what they’re seeing, such as “How many times will the ball hit platform?” or "If we moved the platform up would it be more or less likely to get hit?" Patrick then helps make the connection to the power of computing, using data recording features in Scratch that allow users to run experiments tens of thousands of times. When students then have the experience of proposing, designing, and building their own simulations, they see the ways in which mathematical models can inform Scratch design decisions and the ways in which Scratch makes math learning math more rewarding and relevant. They puzzle over questions like, “Why does the platform get hit 42% of the time in my Scratch simulation, but only 35% of the time in my mathematical model?” And those fascinations persist as students design their own simulations based on their personal interests and experiences. For example, last year students built a simulation that modeled throwing paper into the garbage can using random angles, velocities, and distances.
 
In the workshop setting there wasn’t enough time for such a lengthy exploration but participants were given a glimpse of how to implement some basic mathematical simulations in Scratch, like random walks and Monte Carlo area approximations. For example, a region's area can be approximated by seeing how often a randomly placed point lands inside it: "This is a basic example of a very useful and powerful technique in mathematics, and it's very easy to implement in Scratch!"

Screenshot of the Monte Carlo Fadeout example project:


The purpose of the workshop and Patrick's classroom activities are to demonstrate the power of bringing mathematics and computer science together. "Ultimately the goal is to show how math and computer science are great partners in problem solving. And Scratch provides a terrific platform for that." 

And for anyone doubtful of whether Scratch is relevant for their context, Patrick shared his opinion:
 
"Teachers, and students, are sometimes surprised to learn that we will be using Scratch to explore mathematics. They might think that other tools or languages are more appropriate. But once they see how versatile and powerful Scratch is, and the cool things we can do, they jump right in. Scratch is a great way to level the playing field for learners: it makes computing immediately accessible to those who have never programmed before, and it offers a rich environment to explore for those more comfortable with programming. And I've found it to be an invaluable resource as I've brought more and more computer science to my mathematics students."
 
Links to all the projects Patrick shared at the workshop are available here. And you can read more about Patrick and his teaching, workshops, and photography on his website: http://patrickhonner.com/

randomness