# Visual Patterns and Coding – Part 2 – Exponential and Inverse Relationships

Once we have got to grips with the basics of using python to create ‘visual pattern calculators’, it is time to take our thinking to the next level. Up to now we have only been looking at linear relationships with a straight line graph.

The visual pattern above is a quadratic relationship as the pattern grows in a linear fashion in two directions (It’s useful to talk separately about the width vs. length and then bring them together). The nth term is either (n+1)^2 or n^2+2n+1. Can you see both in the picture?

Let’s pause for a second. In 6th grade, I can use visual patterns to introduce the idea that a quadratic has two linear factors! I had HS seniors that struggled with this idea. I love this!

Next comes the coding. Again, we use CodeSkulptor to ‘skulpt’ our function in three lines: Input, Function/Output, and the display output command. The difference in this is that for exponents we have to use **.

OR:

Also, I get the students to Desmos to see if their prediction of the graph are correct. This brings up great discussions about why the graph is the shape it is in quadrants two and three.

OR:

I have also introduced the idea of an inverse function; using python to create a function that would enable us to answer the question: What step would contain 400 blocks? This forces the student to consider inverse operations and the fact that order matters. Here is the code (python reads from top to bottom so you can include this all in the one program):

The benifit of this has been less about coding or nth term and more about introducing the composition of functions. It also enabled me to run some rich lessons on the topic of ‘Straight Line vs. Curvey Lines – Who Cares’ exploring linear vs. exponential relationships with finance and population growth.

The effects of this series will not be truly measured until these students take Algebra, next year. However, my hope is that this will have given them a solid foundation for many of the concepts that they will study in the coming years. We’ll see…

# Visual Patterns and Coding – Part 1 – Linear Relationships

To bridge the gap between pattern and function and following an online course I took with Rice University, I have started to introduce some basic coding. Python in particular. Even after one lesson of using coding and graphing, I have been able to have rich conversations about the differences between functions, input/outputs, the shape of a graph and the y-intercept. Here is the process I have taken them through:

Part 1: Have the students run through a basic (linear) visual pattern (from visualpatterns.org) using this sheet and reviewing using this slide:

The nth term for this pattern is 4n+1.

Part 2: I now challenge them that we can create a calculator for this pattern using the Python coding language. I use the free python interface CodeSkulptor (from Rice University) to do this. I take them through step-by-step with some great conversations about functions and inputs/outputs.

The nice thing about CodeSkulptor is that when you hit the save button, it creates a brand new URL meaning that each student will have their own URL to post and share.

They can then change the input and see clearly what happens to the output.

(Note: Lines with # are ignored by the interface)

Part 3: They then go to the Desmos Online Graphing Calculator and input the function y = 4x+1 to confirm or deny their prediction for the graph shape, from the start of the exercise. This is a great opportunity to talk about ‘step zero’ (as well as step -10 etc.) and why they graph is the shape that it is. I feel it is also important to stress the difference between 4n+1 as an nth term and y=4x+1 (which includes everything in between).

Their homework is simply to follow the steps with a different (linear) visual pattern and to share their CodeSkulptor URL’s and Desmos screenshots on the class’ wiki page.

For student assistance I created this video:

Where Next?

There are two main places that I would like to take this:

• Exponential functions
• Inverse functions

I’m really excited about where this journey will take us. My hope is, that as these students start Algebra proper, next year, they will have a strong sense of functions graphs and their connections with patterns and geometry. Here goes…..

Have you done anything similar? I would love to hear your ideas/thoughts in the comments section, below.

# Desmos is Awesome

I love Desmos. I love how user-friendly and clean the whole thing is. I want my students to love it too, so I used the first lesson back after midterms to let them play.

### The Aim

For my students to get a feel for the shape of various functions and relations through using Desmos to create a piece of art. (CC Standard F.BF.3)

### The activity

• Students take a look at http://www.desmos.com/art to see what is possible just by typing in equations (Great hook)
• I explain to students that they have this lesson and a homework to come up with a piece of art of their own using desmos.com/calculator.
• I have a sheet ready with some example functions (linear, quadratic, circular relations, radical and rational) for them to use if they are struggling. I also introduce the idea of sliders for them to use.
• They have around 50 minutes plus a homework to come up with a piece of art of their own.

### Some of the resultant artwork

#### What went well

• Any lesson where students are crying out for the Math is a good thing. It was amazing to be asked how to draw a smiley face using a parabola and domain and range and how to draw circles and ellipses. I had one student ask how to do a ‘diagonal porabola!’ I had to look that one up.
• Students were constantly engaged. Sometimes frustrations got the better of them and they needed some encouragement to keep going but generally, the lesson went really fast.
• It was great for all abilities. Students that normally struggle got the chance to play around with linear and quadratic functions, helping them to understand what changing the numbers did to the graph.

#### Even better if

• This was too early in the year to do this lesson. I would like to do this next time at the end of the year when students had more functions and tools at their finger tips. I did like how it cemented the need for domain and range, though.
• This lesson is leading into our quadratics unit. Going back I would have really liked to focus far more on parabolas so that our next lesson on Vertex Form would make sense from the start. I still think it will help, I just think I may have missed an opportunity to go deep rather than broad.
• This lesson relies heavily on technology. Being a Bring-Your-Own-Device school, some students had tablets that were very tricky to use (this also happened with Khan Academy). I may have to rethink how I do this and use it possibly for homework.

### Student Reaction

Here are results from a mini survey I did at the end of each class

### Students also said:

This activity allowed me to visualize what adding variables does to the shape of an equation.

I loved the creativity involved with it, but also the brain work involved when trying to make different shapes and move them around.

Technical difficulties were frustrating, but I realize this is something that is hard to fix.

# ‘And then I stopped drawing’

Today I introduced the reason for Algebra 2 to my students starting with the Dan Meyer 3Acts Toothpick activity. Some students really loved it and some gave up quite quickly challenging me as a teacher to ask questions to reignite the inquiry.

The real magic happened when students shared their ideas at the end about how they solved for the number of triangles and rows. The comment that stuck out to me was one student mentioned that he started to draw out the triangles but then he stopped. As soon as he saw a pattern emerging he could switch to more efficient process of using numbers.

I was able to quite succinctly go on to describe how we use numbers to describe patterns but that algebra gives us the power to describe patterns for any given number, in this case, of toothpicks.

Next week we start the unit on ‘What is a function?’ I hope this has given me enough to build upon.