## Rethinking my linear function approach in Algebra 2

My treatment of linear functions in the past has been pretty traditional. Solve for y, y = mx + b, graphing using slope intercept, then move on to linear inequalities in two variables…it is just dull this way. Most students have seen it before in one form or another, and it wasn’t exciting (or that novel) to them the first time they learned it. It doesn’t have to be this way, and I committed myself this year to doing things differently.

My approach has been centered on two big ideas:

1. Linear functions have a constant rate of change. All of the other qualities they have are related to this important fact.
2. There is an amazing connection between graphs, tables of values, and the equations that generate linear functions. These are not three separate skills, they are three views of the same fundamental mathematical object. Corollary: Teaching them on three separate days or sticking to one view at a time creates an unnecessary pigeon-holing effect that sticks with students for as long as conditions in your class permit.

On day one, we did my Robot Tracking activity posted here at GeogebraTube. The video introduction was reviewed in class and students worked on it for much of the period. This emphasized a fundamental concept around linear functions of distance and time that was pretty intuitive to nearly all of the students that did this activity.

Predicting where something is located, assuming it continues moving at a constant rate is one of the most common applications of linearity. We do it all the time. Can we cross the street in front of the bus? Mental calculation. Where should I kick the soccer ball to get it right in front of the forward moving toward the goal? Mental calculation. I don’t mean actually sitting down and calculating where it will be, but that the human brain is pretty good at noticing the velocity of objects, and making a pretty good guess of where it will be. They had a number of methods of coming to an answer that ranged from geometric (simply drawing a line) to counting grid squares, using the trace function, and proportional reasoning.

We ended the period looking at the Python script I posted here and trying to calculate speed from the information generated by the program. Part of the homework assignment for the next class was to try to answer the question posed by another Python program posted here. The table of values is randomly determined each time, and students could (and often did) try it multiple times to get it right.

The next lesson had a single instance of this program as a warm up for the whole class – everyone had to agree on what value of position I needed to enter for the given time value.. They were pretty good at checking each other and having good conversations about how to go about it. They answered correctly, but we had a good conversation about the different ways to get there. They all centered on using the fact that there was equal spacing between all of the points. Most students used some variation of finding the distance moved per second and whether it was positive or negative, and then counted off intervals. In most cases, it was a bit complicated and required a lot of accounting to get to their answer.

We went over the reason we could do this – the constant rate of change – and verified it using a few different pairs of points. I then threw in the idea of using the point (x,y) and using the constant rate of change with that point. We got to \$latex frac{y – b}{x – a}=m \$ and I asked them to write this using the slope we calculated and any point they liked from the table of data. Students seated next to each other I encouraged to use different points. I then asked them to answer the original question from the Python program using their equation. (Un)surprisingly enough, they all ended up with the correct (and same) answer as before.

Some of them started distributing and writing in slope intercept form. THe thing I was kind of excited about was that they didn’t feel the equation had to be written that way, they just felt like seeing what happened. Many discovered the fact that their answers were the same after doing so, even though they started with different points. We did a couple examples of solving more basic ‘Write an equation for a line that…” questions, but did so without making a huge deal out of slope-intercept form or point-slope form and why one might be better than the other in different situations.

Today was the third day going through this concept – the warm up activity had three levels to it:

The goal here was to constantly push the students to go back and forth between the equation and numerical representations of these functions. There were lots of good things students figured out from these. We then made the jump to looking at how the graph is connected to the table and equation – just one more way of looking at the same mathematical function, and it shares the meaning that comes with the other two representations: a constant rate of change. The new idea introduced as part of this was that of an intercept. What does it mean on the graph? What does it mean for the table? We didn’t talk explicitly about the intercept’s meaning of the equation (again, trying to avoid the “that’s just y = mx + b, I know this already…TUNED OUT”) , but it came out in the process of identifying it algebraically, from tables, and then graphing.

By the end of the period, we were graphing linear functions. Students were asking excellent questions about when the intercepts alone can be used to graph the line, when they can’t (\$latex 2x+3y=6\$ versus \$latex 2x+3y=7\$) but they again stuck to the idea of finding a point they know is on the graph, and then using the constant rate of change to find others. Instead of spending a boring lesson explicitly telling them what my expectations are for graphing lines (labeled and scaled axes, line going all the way across the extent of the axes, arrows on axes and lines) I was able to gently nudge students to do this while they worked.

We’ll see how things go as we continue to move forward. The big thing I like about this progression so far is that modeling real phenomena will be a natural extension of what we’ve already done – not a lesson at the end of contrived examples with clean numbers. My goal originally was to get this group comfortable with messy data and being comfortable with using different tools to make sense of it.

I’ve kept my students hermetically sealed from this messiness in the past – integer coefficients, integer values, and explicit step-by-step ways of graphing, generating tables, and writing equations. As I mentioned before, it was, well, boring and predictable, and perpetuated the idea that these skills are all separated from each other. It also continued the pattern that there would be a day in each unit where the numbers are messy, the real world word problems day, but that the pain associated with it would last a day and would be over soon enough.

I’m hoping to reduce this effect by changing my approach. That by seeing the different aspects of linear functions, it will seem natural to use a graph to figure out something that might not make sense algebraically, or use numerical values to solve an algebraic problem. I especially like this because exploring the three views of functions really is, in my opinion, the primary learning goal of the Algebra 2 course. If I can establish this as an expectation early on, I think the latter parts of the course will work much more smoothly.

## Progress on Python-Powered randomized quiz generator

One of the projects floating around in my head since the end of last year is creating an easy to use tool that will automatically generate questions for students to test their skills either on their own or while in class. My first attempt at this was during a unit in Geometry on translations, my first attempt at implementing standards based grading. I was taking a Udacity course on web applications and realized that if I could write a quiz generator online, it would be the easiest way to give students a sense of how they were doing without needing me to be part of the process.

As most people doing reassessments tend to be, I was a bit overwhelmed with the paperwork side of things, especially because many of the students just wanted to know if they were right or not. I had made some Python programs to generate quiz questions one by one and decided to try to adapt it to the web application so students could input their answers to questions that had different numbers every time. I had tried to use other options such as PollEverywhere, Socrative to at least collect the data and check it as right/wrong (which would have been good enough for a start in terms of collecting data, but left out the randomization part). The problem with these is that I believe they are hosted in the US and are incredibly slow without a VPN. I needed a solution that was fast, and if I could add the randomization, that would be even better. I decided to try to adapt my quiz generator to a Google App Engine hosted web application.

Needless to say (at least for me) this was not an easy task. I had a loose understanding of how to manage GET and POST requests and use cookies to store random values used. The biggest challenge came from checking answers on the server side. For someone figuring out Python concept as he goes, it involved a lot of fists on the keyboard at the time. My attempt is posted here. There were tons of bugs (and still are) but I at least got up the nerve to try it in class. The morning I was excited to premiere it, I also found out another interestingly infuriating nugget of info: Google App Engine is blocked in China.

I gave up at the time, as it was almost summer. I was interested in helping out with the development of the Physics Problem Database project during the summer, but opportunities for sitting down and coding while on a whirlwind tour of the US seeing friends and family weren’t that numerous. It’s amazing to see how John, Andy, and others have gotten the database site together and doing functionally cool things in a short amount of time. I spent some time over the summer learning PHP and MYSQL, but was pulled back into Python when I saw the capabilities of webpy and web2py to do applications. I see a lot of features and possibility there, but fitting my ideas to that framework is beyond what I know how to do and what I have been able to figure out during my time prepping and starting school. That will come later.

I keep coming back to the fact that randomization needs to be built into the program interface from the beginning. I want students that need to practice to be able to do so with different problems each time, because that frees them from needing me to be there to either generate them myself or prevent them from creating impossible problems. I want the reassessment process to be as simple as possible, and for the lowest level skills, they don’t necessarily need me to be testing them in person. That’s what in person interviews and conversations (including those through BlueHarvest) are all about. I won’t rely on a tool like this to check proficiency, but it’s a start for giving students a tool that will get them thinking along those lines.

I’ve had the structure for how to do this in my head for a while, and I started sketching out what it would be in a new Python program last week. This morning, after learning a bit more about the newer string formatting options in Python that offer more options than basic string substitution, I hunkered down and put together what is at least a workable version of what I want to do.

Please visit here to see the code, and here to give it a shot on repl.it.

The basic structure is that every question can use either random integers, an irrational decimal value, or signed integers in its text. With all of the messiness of methods to generate and replace the random numbers inside the Question class, it is fairly easy to generate questions with random values and answers. I admit that the formatting stinks, but the structure is there. I could theoretically make some questions for students this way that could be used on Monday, but I probably won’t just yet. I think a nap is in order.

Next steps:

• I need to work on the answer checking algorithm. At the moment it just compares an entered decimal answer to being within a certain tolerance of the calculated answer. My plan is to expand the Question definition to include another input variable for question type. Single numerical answers are one question type, Coordinates are another, and symbolic equations or expressions are yet another one I’d like to include. Based on the question type, the answer method in the Question class can be adjusted.
• As an extension to this, I’d like to include sympy as part of this for making both question generation and answer checking. It has the ability to show that two symbolic expressions are equal to each other, among many other really nice capabilities. This will let me generate all sorts of nice Calculus and algebraic manipulation questions without too much difficulty.
• I’d like to be able to format things nicely for algebraic questions, and possibly generate graphical questions as well.
• The ultimate goal is to then get this nicely embedded as a web application. As I mentioned before, there is too much going on in the web2py framework for me to really get how to do this, but I think this is something I can do with a bit of help from the right sources.

I’m having a ball learning all of this, and to know that it will eventually make for a nice learning tool that students will benefit from using is a nice incentive for doing it.

## Python in Algebra 2 – An Experiment

One of my goals is to include some Python programming as part of all of my courses this year, and to do so in a way that isn’t just wedging it in where it doesn’t belong. We don’t have a formal programming class in our school given our size, but I have heard that students are interested in the broad topic of programming, and know that they could benefit. So, I am finding times to get students playing around with it as a tool.

The perfect opportunity in Algebra 2 today came in evaluating algebraic expressions. I don’t like reviewing the topic, at least haven’t in the past, because in most cases the students remember enough of it to think that they know how to do it, but have forgotten all the nasty bits about order of operations, distributing negative signs, and the infamous -5^2 = 25 when evaluating -a^2 at a = -5. They typically have great interactions reminding each other of the rules, but by the time they get to me in Algebra 2, the idea is no longer fresh. The lesson then ends up being the math lesson equivalent of an air freshener – temporary and stale.

Following my goal, I figured this would be a perfect opportunity to introduce the topic first as a programming topic, and then use the computer as a resource for the students to check their arithmetic. We started the class with some basic order of operations questions:

This was followed by pasting the following into a Python interpreter as everyone was watching:

print “Answers to the Warm-Up Questions:”
print (8*3 – 2*4)
print (27 + 18/9 – 3**2+1)
print (40 + 24)/8 – (2**3+1)

This was following a suggestion from Kevin Krenz to demonstrate the fast way to solve it using the Python interpreter. While they weren’t wildly impressed, they did accept that this was an option for them to check their work in these types of questions, and were up for learning how it worked.

I then showed them how to run a Python file on their Macbooks, which all have at least Python 2.6 running on them in the terminal. I talked about working in the terminal as running around in the basement of their computer – lots of power and hidden secrets there to play around with (or mess up if not careful). After learning to do this, they edited a partially completed Python script which I have posted at Github here.

I really liked what happened afterwards, though it did not feel (at all) like a clean, straightforward way of going over algebraic expressions. It was messy. Different people were at different places during the entire 30 minutes we worked on it, which was much longer than I expected. Quite appropriately though, it slowly came together like writing a program often does. Lots of good discoveries and realizations of simple errors that I didn’t need to force.

Students realized the difference between 2*x and 2x to the computer. They realized quite cleanly that they needed to tell the computer outright that there is multiplication between a coefficient and a variable. They saw this was not the case for -x although they also thought they might need to write it as -1*x. The Python interpreter pointed this out to them immediately. The interpreter didn’t do so well on 4(3 – x) since it considered it a function call, but with some prodding, most students realized it was the same error.

There was enough information in the script for them to figure out how to do exponents, so I was happy not to have to go through that separately. The only really big problem was the fact that Python 2.6 doesn’t have the nice floating point capability for division that 3.2 has. For the first problem, part (a), the answer is 0.5, but Python returns 0 since it assumes integer division with a plain / symbol. I went around to student computers replacing x/y with x*1./y, but this became an opportunity to converse with students about division as multiplication by the multiplicative inverse or reciprocal. Another unintended complication that then resulted in more review of pure mathematical concepts.

With all of this done, the students were then pretty proficient at trying to do the substitution by hand and checking against the answers from the computer. Most caught the serious mistakes without too much input from me – the computer did that work for me.

After finishing problem 1, the students got a big kick out of how I told them to program Problem 2 at the end of the script. They were directly teaching the computer to answer these questions through code. I think they saw that programming really is how you teach a computer to do what you want it to do, and had at least a minimal sense of pride in being able to do so.

One student said this was pretty cool, and compared it to a video game. Another appeared to want to kill me the entire time. They were all pretty patient with the activity though, and trusted that this would make them better at what they needed to learn for my class – probably the most important part to this not leading to a serious case of Thursday afternoon mutiny.

In the grand scheme of technology implementation, this activity was nothing more than using Python to replace a graphing calculator with substitution capability. This type of knowledge, however, is important for doing more substantial applications of computational thinking. I think it’s important to get students to see what it can do before being interested in creating something as simple as ‘Hello world’. That doesn’t seem to interest the vast majority of students. While I did most of the programming for this task, this is a gateway to the students doing more and seeing more down the line. Now that they know how to do the basics of editing and running a program, we will be more successful in doing more sophisticated things later on.

## On not getting in the way.

Today continued a run of some great class time working on electric circuits. Our whole class period (85 minutes) consisted of looking at the following six circuits:

### Circuit 1

Describe what you would expect to happen when this circuit is connected.

A student blurted out this would be a short circuit, so things would get hot. Everyone immediately agreed (WHY DID YOU BLURT THAT OUT!). Still time to save it; I ask why it is a short circuit?

Answer: Because the path through the wire is shorter than traveling through the resistors.

I smirk.

### Circuit 2

Groans from students…then a more refined answer about differences of resistance between the two branches of the wires.

### Circuit 3

Tell me anything you can tell me about this circuit. If you see something to calculate, calculate it. Build the circuit on the PHET circuit constructor and show that your calculations confirm what happens in the simulator.

Insert student-centered-learning opportunities and fantastic conversations between students here. Students seeing a difference between their answers and what the simulation is telling them causes conflict that they help each other to resolve. Some students bring up the term ‘parallel’, which I’ve never said in class. Others don’t understand what that is, so there is some fighting. One student describes qualitatively what should happen and then shows he is correct in the simulation, no calculations. Furthermore, this student usually is one that gets anxious when there are limited formulas to cling to, which is the norm in my class.

### Circuit 4

Repeat the same procedure. Calculate what you can calculate. Build the circuit in the simulator and verify. Explain away differences, or see if there is something you are missing.

Continued progress in recognizing this is a combination of series and parallel resistors, but I don’t make a big deal out of this. A couple students look up formulas and discover the idea of finding equivalent resistance (which I have never mentioned to them). This helps, but the simulator telling them what the correct answers are is key. They are compelled to get the simulator’s answers through calculation – it’s almost as if they feel the simulator is cheating by giving them the answers, so they must understand how to get it on their own. Eventually, they are convincing each other why they are right.

### Circuit 5

Same as before, tell me anything you can tell me about this circuit. If you see something to calculate, calculate it. Build the circuit on the PHET circuit constructor as a last resort and to show that your reasoning has led to a correct analysis of the entire circuit.

This time the students hit a wall. Some continued finding equivalent resistance and the battery current, but weren’t sure how to find the current through the 10 ohm and 30 ohm resistors. One reasoned it would split proportionally, and confirmed the answer using the simulator. Another measured the voltage across one of the 10 ohm resistors using the simulated voltmeter, measured the current, and then calculated the voltage difference across it. Repeating for the other resistor, they figured out the voltage difference across the parallel resistors, which then led to a current calculation. Again, I only had to tap students in the right direction – the rest was them helping each other.

### Circuit 6

Try to analyze this circuit completely using what you have learned today. Once you are convinced you have accounted for all voltage differences and all current, build it in the simulator to confirm your answers. Find a way to calculate the power used by the 20 ohm and the 10 ohm resistors separately – look it up if you want.

They did a fantastic job of figuring this out – some very quickly and quantitatively. One student that oftenstruggles with concepts figured out how the current between the different branches would compare, and reasoned which ones would have the greatest voltage difference across them.

Then I started lecturing about the equivalence of electrical power and mechanical power, and the magic disappeared. They stopped talking and returned to compliance mode. I saw that happening, so I stopped. Anything I could do at this point would only ruin what was quite possibly a perfect learning experience for them.

When I taught AP Physics, we spent a day on series circuits and deriving resistance formulas, a day on parallel circuits and deriving equations for parallel resistors, and then another day on analyzing circuits that have both. Before today, I had never used the term ‘parallel’ with my students. This time they brought it up. They now have the ability to analyze the same level of circuits as my former AP students, but this group was able to figure much of it out on their own, with no mention of memorization of formulas and no extended periods spent listening to me blabber on about how ‘going through the theory helps you understand’.

There is lots I could say about this, but I think the points made are pretty clear. Let’s just say that I’m really proud of my students work today.

## Computational Thinking – Why do we need to do this?

I’ve been pushing programming tasks on my Algebra 2 class. Pushing is the operative word.

Specifically, I’ve given them tasks that require them to use programs written in Python to do something related to what we are learning. Previously I showed them a program I wrote for a homework assignment as part of my work for Programming a Robotic Car , which went just fine for what it was: a short activity. I’ve also given them a few tasks during previous classes asking them to adjust a program I had written. IN one case this was to calculate a solution to a linear system; in another to evaluate the quadratic formula.

What I admit I did a bad job of, however, of making it clear why we would even want to do so. I think I erred on the side of them seeing how great it was that the computer could do this, which is silly considering I’m also pushing applications like Wolfram Alpha that do much more than my programs, and in a much more eye-catching way. I imagine it’s sort of like showing my students a typewriter that can post on twitter and insisting they find it cool because such a thing exists. The power of programming is in making the computer do work that makes sense for a computer to do. The power of showing programming to students is to both demonstrate how a computer can do this type of work for them, and then empower the students to apply this knowledge on their own.

After reading a couple posts by David Wees on programming and mathematical thinking,  I realized that I was doing things backwards. I needed to establish a reason for doing and teaching computational thinking. I was going to have some students out for athletics last week, and those tend to be the days when I experiment. I mentioned in the previous class with this group that I was planning to do a lesson with Python, and the reaction was instant and violently vocal. Those that were going to be out were thrilled. The others looked about as excited as if they learned that lunch for the following week would be nothing but spinach.

I designed the lesson knowing that if there was going to be any Python at all, it would need to be a task that justified itself quickly, clearly, and with as little trouble as possible.

The topic of the day was composition of functions. The warm up activity was this:

• Suppose f(x) = x^2. What is f(f(2))?
• This should also work for complex numbers. What is f(f(1 + i))?

What was neat was that a couple of the students were stuck on the first question playing around with it. I didn’t have to ask a student to perform the composition three, then four, then five times to its own value – they did it on their own to postpone having to deal with the complex numbers. Not a problem. They got the point that they could do this, but that it was tedious. That was phase 1.

This came next:

The program they used can be found at http://repl.it/CMz .

They quickly figured out how to use the program to run a whole bunch of times. Some found that they weren’t sure if an initial value escaped or not because the value was close to 1 or -1, so they figured out that they could change the number of iterations in the program to give them a better indication. Others realized they were looking at scientific notation and that they needed to review that that meant.

We talked about why the computer was the way to go for this, and then related it to the second warm up problem. Could it be possible to use the computer to do this for the more tedious task of managing complex numbers? Enter my second program at
The students used the second program to determine whether these points diverged/converged (I occasionally slipped these words in with hand motions to link them to escaping or being trapped) and found the concept pretty straight forward, as it had been with the points on the number line. I continued to ask them how they could do this manually using pencil and paper, and was met with groans – the computer clearly was the more logical tool to use for this. (Yes!)
My final task for them was simple: plot the points that are trapped. I gave them this:
I said I wanted them to color in any of the squares with bottom left hand corners that represented values that converged. That’s a lot of grid squares, but that was kind of the point. There were nine in class that day, so they started dividing up the space. Some picked points randomly. Others were more methodical, with some starting to trace the border of the region, but generally there was only a scattering of filled points on the class copy where I had asked them to record their colored in grid squares.
Having predicted how this would likely end, I was ready with this modified version of a Processing sketch written by Daniel Shiffman that basically did the entire task on the computer. The students were staring at the clock after doing this for about ten minutes and only having filled in a minimal portion of the plane. The students understandably said that this process was stupid and that there most likely was a better way for them to be spending their time. That’s when I said they were right.
You know when you design activities to carefully manipulate your students’ emotions so as to realize a particular point, and it totally works? My students have a pretty distinctive facial expression that they each make when they realize I’ve done this, and right about then, it spread like wildfire through the class.
I showed them this:
This didn’t contradict what they had come up with, but it was significantly more complete. I asked if there was any recognition, but there was none. So I decreased the pixel size more:
Still no recognition, but there was more recognition that the shape of the region was an odd one. One more iteration made it pretty clear:
We had looked at a video zooming into the Mandelbrot set earlier in the year, so they had seen it before. I wanted to push that the computer made it possible to investigate this sort of mathematics. This sort of thing could not have been done by hand at this level. Having the computer available to do repetitive calculations and construct graphs according to simple rules made it possible to investigate the mathematics of these areas in ways that were never known before. They were impressed that the mathematics of fractals was not investigated until 1980, which is recent enough for them to perhaps see that math is actually a dynamic field, in contrast to the way it is usually presented.
I liked this lesson, and plan to continue to push my students to use computation when necessary. Our first unit problem for the exponential and logarithmic functions unit was a twist on the penny problem (get one penny the first day,two the second, four the third, and continue on for a month, or just take a lump sum of \$50,000) and I insisted they use some computational tool to answer this, or just straight out find it extremely difficult.
This is an important skill, and I believe in it. To make it happen, I am committing to deliberately committing time for students to learn how to use computers to do the computation work so we don’t have to. I hope my days of seeing students solve the bee/train problem through tedious methods of manually adding terms together will soon be over.