### Programming Optical Illusions–Is it Mathematical?

As we continue to move along the steep trajectory of innovation and technological enhancement in the 21st century, it becomes increasingly important for students to engage with computers, coding, and programming. All teachers know the struggle to balance content with our limited time and resources, so how do we create opportunities for these types of experiences in the context of a math learning environment?

Last week our Math Specialist Jim Town was at the Contra Costa STEAM Colloquium, presenting on Programming Optical Illusions. Besides being incredibly engaging for all the participants, the session demonstrated not only how computer programming can help students develop in the Mathematical Practices, but also illuminated how Problem Based Learning can be implemented.

After some brief clarification regarding the HTML5 canvas

(of which *this* participant had no previous knowledge), Jim handed out the assignment and let us get to work.

What? What do mean I can figure out how to program one of these? In an hour? There’s no way…

**Free Exploration**

Just as with any new manipulative, model, or tool that you introduce to your students, participants were given time to explore the new coding environment. In this way, we were able to familiarize ourselves with the commands to create and adjust line and shape size, orientation, and color. As with students, giving us time to figure out the different commands allowed us to start to understand the code construction and commands.

Not to mention, the satisfaction of accomplishment in answering our own exploration questions led to increased engagement and perseverance. If I can figure out these basics on my own, l *have* to be able to figure out some part of the illusion programming! Can you see the same thing happening with your students?

Guiding questions such as:

- How can you change the slope of the line? length? color?
- How can you change the size of the rectangle? color? location?

provided participants with an entry point for the exploration, but for those with some background in coding, or who preferred less scaffolding, the problem itself provided a platform for figuring out those questions as well.

**The Problem**

As all of us worked to figure out how to create our selected optical illusion through code, we naturally began to collaborate and ask each other questions.

“How did you figure out how to make the arrow?”

“Did you try looking at the start and end points for the line?

“Where is the code for the color?”

“How do I fill in my rectangle?”

And while some answers were straightforward, the implementation required critical thinking and understanding of the code. Notice how engaged we all are!

The resulting collaboration through questioning, testing of hypotheses, trial-and-error, and general problem-solving led to tables of cooperative exploration and individual and group opportunities for learning.

**Is It Mathematical?**

To reflect on how these types of problems and coding opportunities are relevant in a math classroom, the session ended with the following discussion questions, to which I plant a few seedling thoughts.

1. How were you ‘doing’ math?

*We worked on every single Math Practice Standard through this problem. An understanding of slope, ratio, coordinate graphing, were all required to program the various illusions. What a perfect integration of geometry and algebra content, not to mention a deeply engaging way for students to explore the various concepts.*

2. Where would this fit into your classes?

*This would be a perfect way to expose students to the concept of slope before introducing it formally. It could be an interesting application context for coordinate graphing. Perhaps this could serve as a formative assessment (since students can comment in the code to describe their commands). *

3. Which students would benefit from this type of lesson?

*Traditionally highly performing math students (another discussion entirely) would benefit from a non-traditional way to understand the math concepts presented. Struggling students have access to a problem out of the context of traditional math problems, and a way to develop their understanding before being introduced to standard algorithms. Students with interest in computers and art have an authentic problem to engage them (with lots of opportunity for further creativity and extensions). English Language Learners could benefit from the visual and minimal-language approach to coding as a scaffold to more formal academic language about the math concepts. In short, which students *wouldn’t* benefit from this type of lesson?*

**How might you fit this kind of lesson into your own classes?**