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.



Back to teaching

1 Comment

Well, seems like I couldn’t stay away from teaching after all. Starting this fall I will be teaching at the local university – I will be teaching student teachers how to teach math.

It’s only fitting that I start blogging about teaching math again. Right now it is only an ambition, so we’ll have to see what happens.

My last post


I just quit my job and will not be going to back to teaching. So this will probably be my last post on this blog.

One last math problem

Leave a comment

This will be my last post about teaching math. In a day or two I will explain why.

For now, here is one last problem that I made up that I like. It is to help highlight the difference between percent change and percentage points:


Alfred and Anna have savings accounts at The Bank of Hubert’s Left Toe (a very respectable bank). They notice that the interest rates have gone up this year.

Alfred says, “That was lame, we are only earning 1,5% more money now.”

Anna responds, “No, you are mixing up percentage points and percent change. We are actually earning 24% more money now. That’s a big change!”

Assuming Anna is right, what percent is the interest now after it has gone up?

Bad math in society

Leave a comment

I have always had a low tolerance for bad math out in society – if you can’t do your (often simple) job then let someone else do it. Since becoming a math teacher I find I have even less tolerance. So to the student whine of “why do I need to know this?” I would really like to answer “so you don’t look like a total moron doing the low-skilled job you thought didn’t require even basic math skills to do“.

True story number one:

A few years ago my wife was shopping at a jewelry store. They were having a necklace sale: buy 3 and get the cheapest one for free. The woman in line in front of my wife bought 6 necklaces. The cashier tried to give her the cheapest two for free. The customer argued and said that she should get a more expensive one for free. The cashier didn’t understand. The customer was quite frustrated at the stupidity and incompetence of the cashier who clearly could not do her job because she could handle the incredibly simple logical thinking required in this situation.

To illustrate for those having trouble picturing this, imaging the following size prices (in Swedish kronor):

2000, 1800, 1600, 1400, 1200, 1000

The cashier wanted to give her the 1000 SEK and the 1200 SEK necklace for free. The woman wanted the 1000 SEK and the 1600 SEK necklace for free instead. I’ll let you figure it out if you haven’t already (I even arranged the numbers nicely for you).

True story number two:

The following picture is from our local supermarket.


In case you are having trouble reading the blurry text. These are 50g packages of yeast. They cost 7.90 SEK each. The price in yellow is what is the called the “comparison price”, which is given in cost per kg. Listed in this case as 15.80 SEK. Seeing the problem yet?

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.



It seemed easy to me – 3D geometry problem solving

Leave a comment

I find it interesting (and a bit depressing) that I still sometimes am surprised but which problems my students find hard. I recently made up a 3D geometry problems solving exercise that I thought was kind of interesting and not too challenging. I mean, I knew some students would have trouble with it, but I fully expected the majority of the class to get it, especially since it was group work. Boy was I wrong.

To be fair, the actual math content of the problem was not difficult for them. It was being organized enough to find a way to see the pattern that they had trouble with. The ones who did solve it made a table starting with smaller numbers and quickly saw the pattern.

Here is the problem. I would be interested in any comments any readers might have about it:

You have a large number of small identical cubes in front of you. The surface area of all of these cubes together is 23328 cm2. You start playing with the small cubes and realize you can put them together to build one giant cube with no small cubes left over. The surface area of the big cube is 1944 cm2.

  1. How many small cubes do you have?

  2. What is the area of one face of one of the small cubes?

  3. How long are the edges of each small cube?

  4. What is the volume of the big cube?

  5. What is the volume of each small cube?

Older Entries