## Programming and Making Use of Structure in Math

A tweet from James Tanton caught my eye last night:

Frequent readers likely know about my obsession with playing around the borders of computational thinking and mathematical reasoning. This question from James has some richness that I think brings out the strengths of considering both approaches quite nicely. For one of the few times I can remember since starting my teaching career, I went to a computational solution before analyzing it analytically.

A computational approach is pretty simple. In Python:

sum = 0
for i in range(1,11):
for j in range(1,11):
sum += i*j
print(sum)

…and in Javascript:

sum = 0
for(i=1;i<=10;i++) { for(j = 1;j<=10;j++) { sum+=i*j } } console.log(sum)

The basic idea is the same in both languages. We iterate over each number in the first row and column of the multiplication table and add them up. From a first look, one could call this a brute force way to a solution, and therefore not elegant from a mathematical standpoint.

Taking this approach does, however, reveal some of the underlying mathematical structure that is needed to resolve this using other techniques. The sequence below is exactly how I analyzed the problem once I had written the program to solve it:

• For a single row of the table, we are adding together the elements of that row. Instead of adding the individual elements together one by one, we could instead think about finding the sum of the elements of a single row, and then add together all of the rows. For example: \(1 + 2 + 3 + ... + 10 = 55\). This is a simple arithmetic series.
• Each row is the same as the row before it, aside from each element being multiplied by the first element in the row. Every row's sum therefore is being multiplied by the numbers in the first column of the table. \(1(1+2+3...+10)+2(1+2+3...+10)+3(1+2+3+...+10)+...+10(1+2+3+...+10)\).
• Taking this one step further, this is equivalent to the sum of that first row multiplying the sum of the first column: \((1 + 2 + 3 + ... + 10)(1 + 2 + 3 + ... + 10)\). In other words, the answer to our problem is really the square of the sum of that first row (or column), or 55*55.

I bring up this problem because I think it suggests a useful connection between a practical method of solving a problem, and what we often expect in the world of classroom mathematics. This is clearly a great application of concepts behind a traditional presentation of arithmetic series, and a teacher might give this as part of such a unit to see if students are able to see the structure of the arithmetic series formulas within it.

My question is what a teacher does if he or she presents this problem and the students don't make that connection. Is the next step a whole class discussion about how to proceed? Is it a leading question asking how arithmetic series applies here? This, by the way, zaps the whole point of the activity if the goal was to see if students see that underlying structure based on what they already know. Once this happens, it becomes yet another 'example' presented to the class.

I wonder what happens if a computer/spreadsheet solution is consistently recognized throughout the class as a viable tool to investigate problems like this. A computer solution is really nothing more than an abstraction of the process of adding the numbers together one by one. If a student did actually do this by hand, we'd groan and ask if they thought there was a better way, and the response inevitably is 'yes, but I don't know a better way'. In the way I found myself thinking about this problem last night, I started from the computational method, discovered the structure from those computations, and then found a path toward a more elegant solution using algebraic techniques.

In other words, I made use of the structure of my program to identify an analytical approach. Contrast this with a more traditional approach where we start with an abstract definition of an arithmetic series (by hand), do practice problems (by hand) and once we understand how it works, use computational shortcuts.

The consistent power that I see in approaching and developing ideas with students from a computational standpoint first is not that it often makes it easier to find an answer, though that can be a good thing when the goal is to find an answer. Computational methods can make it easy to change things around and generalize a problem - what Polya termed generalization. It's easy to change the Javascript program to this and ask what multiplication table it models:

sum = 0
for(i=5;i<=10;i++) { for(j = 5;j<=10;j++) { sum+=i*j } } console.log(sum)

Computation makes the process of finding a more elegant way seems much more natural - in the best situations, it builds intellectual need for an easier way. It is arbitrary to say that a student should be able to do a problem without a calculator. Computational tools demand that we find a more compelling reason to solve problems by hand if computers are able to do them rapidly once they are set up to solve them through programming. It is a realistic motivation to show that an easier way speeds up finding a solution to a problem by a factor of 10. It means less waiting for a web page to load or an image to post.

The language of mathematics is difficult enough to throw in the additional complications of computer language syntax. I fully acknowledge that this is a hurdle. I also think, however, that this syntax is more closely related to the concepts that we are trying to teach our students (3*x is three times x) than we sometimes think. The power of computer programming to be a bridge between the hand calculations that our students do and the abstractions of the mathematical content we teach is too great to ignore.

## A computational approach to modeling projectile motion, continued.

Here is the activity I am looking at for tomorrow in Physics. The focus is on applying the ideas of projectile motion (constant velocity model in x, constant acceleration model in y) to a numerical model, and using that model to answer a question. In my last post, I detailed how I showed my students how to use a Geogebra model to solve projectile motion.

Let me know what I’m missing, or if something offends you.

A student is at one end of a basketball court. He wants to throw a basketball into the hoop at the opposite end.

• What information do you need to model this situation using the Geogebra model? Write down [______] = on your paper for any values you need to know to solve it using the model, and Mr. Weinberg will give you any information he has.
• Find a possible model in Geogebra that works for solving this problem.
• At what minimum speed he could throw the ball in order to get the ball into the hoop?

We are going to start the process today of constructing our model for projectile motion in the absence of air resistance. We discussed the following in the last class:

• Velocity is constant in the horizontal direction. (Constant velocity model)
• \$latex x(t) = x_{0} + v t\$

• Acceleration is constant in the vertical direction (Constant acceleration model)
• \$latex v(t) = v_{0} + a t\$
\$latex x(t)=x_{0}+v t +frac{1}{2}a t^2 \$

• The magnitude of the acceleration is the acceleration due to gravity. The direction is downwards.

Consider the following situation of a ball rolling off of a 10.0 meter high platform. We are neglecting air resistance in order for our models to work.

Some questions:

• At what point will the ball’s movement follow the models we described above?
• Let’s set x=0 and y = 0 at the point at the bottom of the platform. What will be the y coordinate of the ball when the ball hits the ground? What are the components of velocity at the moment the ball becomes a projectile?
• How long do you think it will take for the ball to hit the ground? Make a guess that is too high, and a guess that is too low. Use units in your answer.
• How far do you think the ball will travel horizontally before it hits the ground? Again, make high and low guesses.

Let’s model this information in a spreadsheet. The table of values is nothing more than repeated calculations of the algebraic models from the previous page. You will construct this yourself in a bit. NBD.

• Estimate the time when the ball hits the ground. What information from the table did you use?
• Find the maximum horizontal distance the ball travels before hitting the ground.

Here are the four sets of position/velocity graphs for the above situation. I’ll let you figure out which is which. Confirm your answer from above using the graphs. Let me know if any of your numbers change after looking at the graphs.

Now I want you to recreate my template. Work to follow the guidelines for description and labels as I have in mine. All the tables should use the information in the top rows of the table to make all calculations.

Once your table is generating the values above, use your table to find the maximum height, the total time in the air, and the distance in the x-direction for a soccer ball kicked from the ground at 30° above the horizontal.

I’ll be circulating to help you get there, but I’m not giving you my spreadsheet. You can piece this together using what you know.

Next steps (not for this lesson):

• The table of values really isn’t necessary – it’s more for us to get our bearings. A single cell can hold the algebraic model and calculate position/velocity from a single value for time. Goal seek is our friend for getting better solutions here.
• With goal seek, we are really solving an equation. We can see how the equation comes from the model itself when we ask for one value under different conditions. The usefulness of the equation is that we CAN get a more exact solution and perhaps have a more general solution, but this last part is a hazy one. So far, our computer solution works for many cases.

My point is motivating the algebra as a more efficient way to solve certain kinds of problems, but not all of them. I think there needs to be more on the ‘demand’ side of choosing an algebraic approach. Tradition is not a satisfying reason to choose one, though there are many – providing a need for algebra, and then feeding that need seems more natural than starting from algebra for a more arbitrary reason.

## Why computational thinking matters – Part I

My presentation at 21CLHK yesterday was an attempt to summarize much of the exploration I’ve done over the past year in my classroom into the connection between learning mathematical concepts and programming. I see a lot of potential there, but the details about how to integrate it effectively and naturally still need to be fleshed out.

After the presentation, I felt there needed to be some way to keep the content active other than just posting the slides. I’ve decided to take some of the main pieces of the presentation and package them as videos describing my thinking. I’m seeing this as an iterative process – in all likelihood, these videos will change as I refine my understanding of what I understand about the situation. Here is the start of what will hopefully be a developing collection:

[wpvideo HOucYa4m]

[wpvideo L3jr2hor]

[wpvideo PBc7xzdW]

I want to express my appreciation to Dan Meyer for his time chatting with during the conference about my ideas on making computation a part of the classroom experience. He pushed back against some my assertions and was honest about which arguments made sense and which needed more definition. I think this is a big deal, but the message on the power of computational thinking has to be spot on so it isn’t misunderstood or misused.

With the help of the edu-blogging community, I think we can nail this thing down together. Let’s talk.

## A Response to Slate: How the recent article on technology misses the point.

Ah, summer. A great time to kick back, relax, and have time to write reactions to things that bug me.

I read through the article on Slate titled ‘Why Johnny Can’t Add Without a Calculator’ and found it to be a rehashing of a whole slew of arguments that drive me nuts about technology in education. It also does a pretty good job of glossing over a number of issues relative to learning math.

The problem isn’t that Johnny can’t add without a calculator. It’s that we sometimes focus too much about turning our brain into one.

This was the sub-heading underneath the title of the article:

Technology is doing to math education what industrial agriculture did to food: making it efficient, monotonous, and low-quality.

The author then describes some ancedotes describing technology use and implementation:

• An experienced teacher forced to give up his preferred blackboard in favor of an interactive whiteboard, or IWB.
• A teacher unable to demonstrate the merits of an IWB beyond showing a video and completing a demo of an electric circuit.
• The author trying one piece of software and finding it would not accept an answer without sufficient accuracy.

I agree with the author’s implication that blindly throwing technology into the classroom is a bad idea. I’ve said many times that technology is only really useful for teaching when it is used in ways that enhance the classroom experience. Simply using technology for its own sake is a waste.

These statements are true about many tools though. The mere presence of one tool or another doesn’t make the difference – it is all about how the tool is used. A skilled teacher can make the most of any textbook – whether recently published or decades old – for the purposes of helping a student learn. Conversely, just having an interactive whiteboard in the classroom does not make students learn more. It is all about the teacher and how he or she uses the tools in the room. The author acknowledges this fact briefly at the end in arguing that the “shortfall in math and science education can be solved not by software or gadgets but by better teachers.” He also makes the point that there is no “technological substitute for a teacher who cares.” I don’t disagree with this point at all.

The most damaging statements in the article surround how the author’s misunderstanding of good mathematical education and learning through technology.

Statement 1: “Educational researchers often present a false dichotomy between fluency and conceptual reasoning. But as in basketball, where shooting foul shots helps you learn how to take a fancier shot, computational fluency is the path to conceptual understanding. There is no way around it.”

This statement gets to the heart of what the author views as learning math. I’ve argued in previous posts on how my own view of the relationship between conceptual understanding and learning algorithms has evolved. I won’t delve too much here on this issue since there are bigger fish to fry, but the idea that math is nothing more than learning procedures that will someday be used and understood does the whole subject a disservice. This is a piece of the criticism of Khan Academy, but I’ll leave the bulk of that argument to the experts.

I will say that I’m really tired of the sports skills analogy for arguing why drilling in math is important. I’m not saying drills aren’t useful, just that they are never the point. You go through drills in basketball not just to be able to do a fancier shot (as he says) but to be able to play and succeed in a game. This analogy also falls short in other subjects, a fact not usually brought up by those using this argument. You spend time learning grammar and analysis in English classes (drills), but eventually students are also asked to write essays (the game). Musicians practice scales and fingering (drills), but also get opportunities to play pieces of music and perform in front of audiences (the game).

The general view of learning procedures as the end goal in math class is probably the most destructive reason why people view math as something acceptable not to be good at. Learning math this way can be low-quality because it is “monotonous [and] efficient”, which is not technology’s fault.

One hundred percent of class time can’t be spent on computational fluency with the expectation that one hundred percent of understanding can come later. The two are intimately entwined, particularly in the best math classrooms with the best teachers.

Statement 2: “Despite the lack of empirical evidence, the National Council of Teachers of Mathematics takes the beneficial effects of technology as dogma.”

If you visit the link the author includes in his article, you will see that what NCTM actually says is this:

“Calculators and other technological tools, such as computer algebra systems, interactive geometry software, applets, spreadsheets, and interactive presentation devices, are vital components of a high-quality mathematics education.”

…and then this:

“The use of technology cannot replace conceptual understanding, computational fluency, or problem-solving skills.”

In short, the National Council for Teachers of Mathematics wants both understanding and computational fluency. It really isn’t one or the other, as the author suggests.

The author’s view of what “technology” entails in the classroom seems to be the mere presence of an interactive whiteboard, new textbooks, calculators in the classroom, and software that teaches mathematical procedures. This is not what the NCTM intends the use of technology to be. Instead the use of technology allows exploration of concepts in ways that cannot be done using just a blackboard and chalk, or pencil and paper. The “and other technological tools next to calculators in the quote has become much more significant over the past five years, as Geometers Sketchpad, Geogebra, Wolfram Alpha, and Desmos have become available.

Teachers must know how to use these tools for the nature of math class to change to one that emphasizes mathematical thinking over rote procedure. If they don’t, then math continues as it has been for many years: a set of procedures that students may understand and use some day in the future. This might be just fine for students that are planning to study math, science, or engineering high school. What about the rest of them? (They are the majority, by the way.)

Statement 3: “…the new Common Core standards for math…fall short. They fetishize “data analysis” without giving students a sufficient grounding to meaningfully analyze data. Though not as wishy-washy as they might have been, they are of a piece with the runaway adaption of technology: The new is given preference over the rigorous.”

If “sufficient grounding” here means students doing calculations done by hand, I completely disagree. Ask a student to add 20 numbers by hand to calculate an average, and you’ll know what I mean. If calculation is the point of a lesson, I’ll have students calculate. The point of data analysis is not computation. Just because the tools take the rigor out of calculation does not diminish the mathematical thinking involved.

Statement 4: “Computer technology, while great for many things, is just not much good for teaching, yet. Paradoxically, using technology can inhibit understanding how it works. If you learn how to multiply 37 by 41 using a calculator, you only understand the black box. You’ll never learn how to build a better calculator that way.”

For my high school students, I am not focused on students understanding how to multiply 37 by 41 by hand. I do expect them to be able to do it. Usually when my students do get it wrong, it is because they feel compelled to do it by hand because they are taught (in my view incorrectly) that doing so is somehow better, even when a calculator sits in front of them. As with Statement 3, I am not usually interested in students focusing on the details of computation when we are learning difference quotients and derivatives. This is where technology comes in.

I tweeted a request to the author to check out Conrad Wolfram’s TED Talk on using computers to teach math, and asked for a response. I still haven’t heard back. I think it would be really revealing for him to listen to Wolfram’s points about computation, the traditional arguments against computation, and the reasons why computers offer students new opportunities to explore concepts in ways they could not with mere pencil and paper. His statement that math is much more than computation has really changed the way I think about teaching my students math in my classroom.

Statement 5: “Technology is bad at dealing with poorly structured concepts. One question leads to another leads to another, and the rigid structure of computer software has no way of dealing with this. Software is especially bad for smart kids, who are held back by its inflexibility.”

Looking at computers used purely as rote instruction tools, I completely agree. That is a fairly narrow view of what learning mathematics can be about.

In reality, technology tools are perfectly suited for exploring poorly structured concepts because they let a student explore the patterns of the big picture. The situation in which “one question leads to another” is exactly what we want students to feel comfortable exploring in our classroom! Finally, software that is designed for this type of exploration is good for the smart students (who might quickly make connections between different graphical, algebraic, and numerical representations of functions, for example) and for the weaker students that might need different approaches to a topic to engage with a concept.

The truly inflexible applications of technology are, sadly, the ones that are also associated with easily measured outcomes. If technology is only used to pass lectures and exercises to students so they can perform well on standardized tests, it will be “efficient, monotonous, and low quality” as the author states at the beginning.

The hope that throwing calculators or computers in the classroom will “fix” problems of engagement and achievement without the right people in the room to use those tools is a false one, as the author suggests. The move to portray mathematics as more than a set of repetitive, monotonous processes, however, is a really good thing. We want schools to produce students that can think independently and analytically, and there are many ways that true mathematical thinking contributes to this sort of development. Technology enables students to do mathematical thinking even when their computation skills are not up to par. It offers a different way for students to explore mathematical ideas when these ideas don’t make sense presented on a static blackboard. In the end, this gets more students into the game.

This should be our goal. We shouldn’t going back to the most basic textbooks and rote teaching methods because it has always worked for the strongest math students. There must have been a form of mathematical Darwinism at work there – the students that went on historically were the ones that could manage the methods. This is why we must be wary of the argument often made that since a pedagogical method “worked for one person” that that method should be continued for all students. We should instead be making the most of resources that are available to reach as many students as possible and give them a rich experience that exposes them to the depth and variety associated with true mathematical thinking.