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.




Math video prompts

Leave a comment

In case any of you don’t already follow Dan Meyer, I highly recommend his math teacher blog – best around:

In line with his theories about trying to create video or picture prompts to stimulate natural questions that require math to really answer, I have a couple ideas. The problem is I’m not really good at video editing and suspect I might not get around to actually making them.

So this post is a request for anyone interested in seeing if they can/want to produce one or two short videos.

  1. This one is of two people running around a track. I think it should be a standard 400 meter running track so that distances are known, though the 100 meter marks should maybe be added to the videos. Two runners/joggers start facing each other a short distance from each other. When they pass each other they smack hands and at that moment a timer starts on the screen. The video is stopped after a short time (before they meet on the other half). The question you are hoping for is where will they pass each other again? The timing information and known distances on the track should provide enough information for estimates. The rest of the video is then shown afterwards to show the answer.
  2. In this one you need a full class of students to help out. The students are standing in a line outside a room, each is holding a big bag of presents. One student is in the room. The first student in line walks in and shakes hands with the student there, and they give each other a present from their bags. They put their presents on a big table maybe (or maybe just keep them in a pile at their feet). The next student comes in and does the same (shakes hands and exchanges gifts) with EVERY student already in the room. The video would show the first two or three students doing this, then pan down the line of students. The exact number in line should be a bit unclear. The questions to answer here are how many presents total (which is why they should maybe be on a big table) and how many handshakes total (for those who don’t know, this is showing an easy connection between these ideas and which later is used to easily motivate the Gauss formula for adding up sequences of integers easily).

Any takers?

A fun little problem

Leave a comment

Lilly is working on a classic math problem:

A hot tub can be filled with one of two water faucets. The first alone would fill the tub in 2 hours and the second one alone would fill the tub in 4 hours. How long does it take to fill the tub with both of them turned on at the same time?

Lilly thinks this problem is a little too easy and so starts to play around with different ways of solving it. Being a big fan of geometry, she draws a right triangle, with one leg being 2 and the other leg being 4 to represent the time for each faucet.

triangle 1

She then inscribes a square in the triangle so that two sides align with the legs and one corner lies on the hypotenuse:


Lilly then notices that the length of the side of the square is actually the solution to the problem!

  1. Is she right?
  2. Does this work for other numbers? (different times for the faucets to fill the tub)
  3. Does this work for all numbers?

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.

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.

Nationella prov

Leave a comment

Testing, especially national testing, in math is a constant problem for teachers and schools in Sweden. The way the national tests are currently set up is an extreme burden on teachers and on the schools and makes it pretty much impossible to be fair.


If the whole point of national testing is contribute to more fair (jämlika) schools, then as far as I can see the only reasonable solution is to have all national tests administered and graded by an independent third party.  Students should go off campus to a special location where the same test is given by the same people under the same conditions to all students. The same group should then correct all tests with the results being sent back to the teachers.


This is the only way to ensure fairness across the board and would take away a huge time sink and source of stress for math teachers.


A natural extension of this idea would be to have all major testing done by a third party. Maybe two tests a year from 7th grade through 9th grade. Independently created and graded. This would be the most fair.


There would be another major advantage of this: currently we teachers have a confusing double role for our students. We are both there to help and to judge. This causes many students to be afraid to share their problems with us since they are afraid if she show they don’t understand it will count against their grade. Taking the testing out of our hands allows us to just be there to help and I feel would go a long way towards improving the cooperation and relationship between teachers and students.

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 …