Programming in math classes

Leave a comment

Starting next year, the new Swedish course plan will require the inclusion of programming in math classes. I know not all math teachers, especially for younger years, have a lot of experience with this and so I thought I would blog about three good tools.

All the tools I will talk about share two important features:

  1. They are free to use
  2. They can be used directly in any web browser


  • Recommended uses in Sweden: lågstadiet and mellanstadiet
  • Available in Swedish and other languages

The first, and probably the most important, is Scratch, a tool developed at MIT and the best introduction to programming out there.

Instead of writing code, students drag and drop ready commands. It is incredibly easy to use and get started with. They recommend a starting age of 8, but younger kids have used it as well (with more guidance). It is also available in Swedish (as well as something like 40 other languages).

Even if it is easy to get start with, Scratch is quite versatile and it is possible to do quit complicated programs.

I recommend moving away from Scratch in högstadiet, since it will be easier to integrate into your math teaching. However, I did want to give a good example of how it is possible to use Scratch even in 9th grade.

The following is an example of a possible assignment. A 9th grade student was asked to create a Scratch project that showed found the equation of a line from two points. This is what he came up with.

Note that this is also an excellent way to assess math skills outside of standard testing. This project required good knowledge of linear equations, basic algebra, fractions, scaling and Euclid’s algorithm for reducing fractions.

However, this would have been much easier using something like JavaScript instead (e.g. using jsFiddle).

Khan Academy Programming Course

  • Recommended uses in Sweden: högstadiet and gymnasiet
  • English only

Khan Academy has their own online programming course. They have created their own language that seems to be roughly based on JavaScript, but is optimized for graphics.

The advantage here is that they have ready made videos and instructions for students, so even inexperienced teachers can let the students work through the material at their own pace. The focus on graphics and animation tends to make it more fun for students to learn, however it can make some math class applications more annoying to implement. Likely easiest (at least initially) for geometry projects.

A nice feature of their online programming editor is that the code is run as you type it. This gives instant feedback on any changes, which can be helpful for students. Another nice feature is that a teacher can create a sample or template program in the editor and then give a link to it to the students. This can be really nice for specific programming/math projects you want them to work with.


  • Recommended uses in Sweden: högstadiet and gymnasiet
  • English only (as much as JavaScript and HTML are based on English)

jsFiddle is an online JavaScript editor. This allows you to create JavaScript programs without needing a website to host them on. Instructions in JavaScript (and basic HTML) will need to come from elsewhere. But this is a great site for trying out programs.

Another nice feature is that, like with Khan Academy, the teacher can create sample or template programs for the students to study or modify.

Once students have some proficiency in JavaScript, this is likely the most versatile for using in math related programming assignments.

Here is a simple example of using the Newton-Raphon method to find the square root of a number.




Planning time and class size

Leave a comment

This is going to be a general rant about statistics, research and the workplace conditions for teachers.

I hear a lot of people (mostly those controlling the money or not working as a teacher) referring to research that indicates that class size doesn’t affect results significantly. For me, this is a great example of empty statistics and research removed from reality. Here’s what I believe:

  • A good teacher with a big class is better than a bad teacher with a small class
  • Class size standards differ greatly based on local culture and this is not always taken into account. Yes, in Japan they have far larger classes than in Sweden, but the students have a completely different attitude to school and learning there so it is ridiculous to make the comparison on number of students alone. This sort of cultural difference in attitudes towards academics even varies within a country. Just look in Sweden at the difference in student attitudes in a country side school compared to a school in a serious university city (I would say this is difference is even bigger for math than other subjects).
  • If you are only looking at average results on standardized test scores then you may miss lot of real differences

And here is what I know: I am personally a better teacher with a small class compared to a bigger one. People who have not taught have trouble understanding the energy it takes to simple stand in front of a class of 30 junior high students. Even if you are doing nothing but talking, there is this invisible energy interaction between you as teacher and the students, and it is exhausting. The difference between 30 and 20 students just on the simple psychological and physical toll it takes on a teacher is hard to accurately put into words, but it is huge.

With fewer students I have more time, energy and ability to get to know every single student personally. I have a much greater chance of learning their strengths and weaknesses on a real and deeper level and am much better able to find the appropriate way to challenge and reach them personally. Not just help them raise the average standardized test score, but help them gain a deeper understanding and (more importantly) a greater appreciation for math.

Standardized scores do not measure student motivation, interest and happiness.

With fewer students I can have more frequent graded assignments without killing myself. This helps get a much more detailed pictures of where potential problems lie and allows a lot more opportunity to help correct misconceptions. Constant formative evaluation is really helpful for both teaching, but also for learning. Even the students need to “test themselves” constantly to see what they really can do and not just what they think they can do. It is very hard for students at that age to develop an accurate understanding of their command of mathematics without a controlled testing environment. Doing this frequently also makes it not so stressful for the students, since they are no longer “tests” but “diagnostic assessments”. This is not possible with too many students without killing yourself as a teacher (been there, done that).

With fewer students I can plan more fun group activities. It is much easier to have classroom discussion with more students participating.

With fewer students I have more energy in general. I am less exhausted and less burned out after smaller classes. I can do more. Standardized test scores do not show the toll taken on teachers physically or mentally when they burn themselves out with big classes. The extra energy  I have from smaller classes translates into more motivation on my part and more creativity and better ideas.

And back to where I started – I am just a better teacher with fewer students.

Now on to planning time. This is the invisible part of our job that many who don’t teach don’t see or understand. The myth that once we have taught a topic we never have to prepare again. For bad teachers maybe, but not for those I know.

Each group of students I teach is different, which different needs and interests. I have to constantly adapt my teaching to each individual group. But more than that, I always try and evaluate every lesson – not just every topic, but every lesson. How could I have explained that better? Can I find a way to make that more clear? What were the problem and misunderstandings this time? And fixing that and creating lessons takes a lot of planning, over and over again. Refining and improving. Trying to always grow and develop as a teacher.

But this time is not recognized or given. We teach too many students and have to waste time with things like being a rastvakt (walking around the halls telling students to behave), or at our school being forced to sub for other teachers when they are sick for free during the little time we have to try and plan.

Ideally, I should be able to teach each group of students for more hours per week in math, but have far fewer groups to teach. This would make a huge difference in what I could do, who I could help, and how I would feel as a teacher emotionally.

Okay, end of rant.



My favorite algebra problem


I gave my 7th graders a quiz today on solving equations. It was fun (admittedly in a slightly evil way, but not really) to see their frustration with the final problem, which over the years has quickly become my favorite algebra problem. Of course I don’t put it on the quiz to be mean, but to teach important lesson about reasoning and life. Here is the question, always coming after a series of much more complicated ones that they usually have no trouble with:

x + 1 = x -1


New Motto

Leave a comment

I have a new teaching motto for my students (or maybe it’s a learning motto):

Don’t look for answers, look for questions!

I read New Scientist regularly, and usually solve the Enigma puzzle they have every issue. What I realized today was that quite often (especially with the geometric puzzles) the solution suggests some deeper ideas, and then I have a tendency to explore those ideas and see if they are true, and find their limitations. I’ll usually play around with some ideas first in Geogebra to see if there is a real indication of a more general principle and then try and prove it.

I think it is this kind of curiosity that has always made me like math and science so much. And I realized that what it comes down to is that I am not content with answers, but I want to know what the next question is. I’m curios and want to understand.

One thing that continually surprises me is how many students I see that don’t seem to have any innate curiosity about anything. I wonder if this has always been true, or if there is actually some change in more recent generations because of some change in modern society. Growing up you always hear about the insatiable curiosity of five-year-olds and their standard question of “Why is the sky blue?

It seems like a vast majority of kids I run into don’t care at all why the sky is blue, and it would never occur to them to ask. To be honest, I have a hard time relating to this lack of curiosity of the world we live in. I have always been curious, and so have my friends – but maybe it was more a case of who my friends were growing up rather than something with a change in society (i.e., I may have a biased sample space). I think it would make an interesting psychology study – and it should include changes in curiosity with age. Are people more or less curious in general during certain phases in their lives? Is there a demographic pattern? Is there a connection between natural curiosity and success in school?

All questions I’d be curious to know the answer to.

Concept Cartoons


I’ve been reading a bit about concept cartoons and think they could be really useful for teaching math. I’ve already been using a similar technique which I have been calling “who is right” problems. I have used these to good effect to highlight common misconceptions in different areas.

Concept cartoons are a simplified and more accessible way of presenting the same material.

The problem, as usual, is a lack of available free resources for teachers. So, if there is anyone out there in blog land, I thought we could start sharing some concept cartoon files. I’m not sure if this blog site supports uploading files, but I will try.

If anyone out there responds showing an interest in sharing I will be happy to set up some other share site to use if needed.

Here is a pdf version of a smartboard cartoon I made (I can’t seem to share smartboard files here).

triangle with 3 sticks

Structure in math

Leave a comment

I read the news at NCM regularly. I think all math teachers in Sweden should (that and Nämnare). Today I came across this really cool new project and idea:

Structure in problem solving is an endless theme with me in my classes. I have just as much trouble convincing the top performing students to have more structure as I do the struggling students.

On the plus side, I had recent confirmation that I am making progress in this area (which is a nice, though rare, occurrence). During our regional finals in the Pythagoras Quest contest, our team was complemented on their high quality explanations (redovisningar). It was nice for me and my students to hear that from an outside source.

I wonder how many of you out there (assuming anyone is out there) have had this problem with a student: the student is very talented and has a natural instinct for math. They are able to solve all the “standard” problems quickly and easily. Despite efforts to teach them formalized methods, structure and techniques, they like their own personal “winging it” methods. You warn them that these are great for the easier problems, but at some point they will hit a wall and have no idea how to move beyond it. Sure enough, you toss them something more challenging and they are completely stuck with no idea how to proceed (that’s when they hopefully become more receptive to using other mathematical techniques and structure). An even more interesting twist on the story is that on occasion when this has happened a student who is normally considered “weaker” is able to solve the harder problem because she has been practicing the structure and techniques the whole time, and so for her the “harder” problem is actually that different than the “easier” problems, since she just uses the same methods and techniques.

What I would really like, if anyone starts to read this someday, is to have a place for math teachers in Sweden to share good ideas and material. Or at least have meaningful discussions about teaching.

Japanese math

Leave a comment

I recently read about the failure of Japanese students to answer 5 questions posed by the Mathematical Society of Japan. After much searching, I was able to track down one of questions used:

I don’t know if it’s the translation or a fault of the original text, but as it stands the wording of this question has a lot of problems that make it (in my opinion) a poor gauge of a student’s understanding of statistics.

I will focus on just one of these problems: the use of the word “average”. This was the same mistake made by the Swedish national test for 9th graders a few years ago. They had a problem asking for the “genomsnitt” (average). I spend a lot of time explaining to my students that one of the strengths of mathematics is its ability to be precise with definitions. And in particular that the word average has no precise mathematical meaning. If you want the mean, ask for the mean, if you want the median, ask for the median. Yes, in common language “average” usually means “the mean”, but this has no place in a national math test in any language.

There are of course a number of other problems with the text in this question …