A Short Python Script About The Distance Between Two Points

For this blog entry I wanted to do something different. During the past few weeks I’ve been working on a program that allows you to enter two points on an XY plane and find the distance between them. The formula to do this is pretty straightforward and can be calculated as follows:


So here is my little program, or a screen shot of it, at least. Christmas comes early this year! Woohoo :-p.

Continue reading “A Short Python Script About The Distance Between Two Points”

Determining whether a number is prime (or “The Benefits of Square-Rooting a Number, Part I”)

Something that comes up now and again in various contexts during lessons is how to tell whether a number is prime. My usual advice has been to use divisibility rules*, and if none work, then it’s likely that the tested number is prime. Likely is not the same thing as certain, however, and, as the numbers get bigger, the divisibility rules will tend to be less and less helpful. For example, it’s easy to rule out that 51 is a composite number, i.e. not prime (and not ‘1’), but what about 1591? None of the common divisibility rules work, but that doesn’t mean 1591 is necessarily prime.

Ponte di Rialto over the Canal Grande, Venice, Italy. Completed in 1591. Photo of bridge by Saffron Blaze, http://www.mackenzie.co.

Knowing that there had to be some better way to determine whether a number is prime, I did a web search and found the following method:

To determine whether a number n is prime, square-root the number and let the result be r. Next, try to divide n by all the prime numbers that are less than r.

Let’s see how this method works with a composite and a prime number, 539 and 113 respectively.

Continue reading “Determining whether a number is prime (or “The Benefits of Square-Rooting a Number, Part I”)”

Solving tracing problems using graph theory

A couple of weeks ago, I was looking at a standardized test and came across the following “tracing” problem:

Which of the drawings below can you completely trace without lifting your pencil or retracing a previously traced part? 


When I was a teenager, I had seen similar questions to this one, but was always frustrated that I couldn’t figure out a way to solve them except by trial and error. Twenty years later, thanks to being exposed to different areas of mathematics as a tutor, I instantly saw a systematic way to answer them. Try solving the test question on your own first before reading my approach below.
Continue reading “Solving tracing problems using graph theory”

Donkeys, Logs, Snakes, Oh My!

For the last several years in the United States and the UK, there has been a strong push to teach primary and secondary-school students how to code. Whether this is a good idea or not, I personally have enjoyed learning about programming. One of my current hopes is to do more programming using the Python programming language.

python-logo-master-v3-tm-flattenedNow, I won’t get too much into coding—my intention for this blog is to focus on math—but I just can’t resist to somehow meld these personal and professional interests. Namely, how can I use my basic Python programming skills to explore math concepts and solve math problems?

As a starter, I thought that I would introduce readers to the Python interpreter. Basically, this is a program that accepts commands written in Python and executes them immediately. If you’re using Mac OS X or some other Linux\Unix operating system, then the chances are very strong you can just open “Terminal” or your favourite shell and type “python” to get the interpreter running. If you’re on Windows or just have no clue what I meant in the last sentence, then I recommend downloading Python and using IDLE, which you can click on to launch like any other app. I’ll be using IDLE to talk about Python in this entry and probably future ones too.

Suppose you are asked to solve the following:

Currently, there are six donkeys on Nick’s farm. The donkey population grows at a rate of 2.5 times per year. When will Nick have 18 donkeys on his farm? Round your answer to the nearest tenth of a year.*

Typically, we would solve the problem by first modelling the situation as an exponential equation and then rewrite the equation in its equivalent logarithmic form:


Continue reading “Donkeys, Logs, Snakes, Oh My!”

Two (perhaps) quick(ish) ways to multiply two digit numbers in your head


While tutoring students who are in the process of multiplying two numbers, I sometimes challenge myself by trying to do the multiplication in my head instead of using a calculator. I don’t know where I learned it, but I usually take a divide-and-conquer approach to multiplying large numbers, a large number for me being anything greater than 12, save for a few exceptions.* In general, my strategy has been to break the original multiplication problem into simpler parts that I can then solve easily and combine for the answer. I’ve noticed that I usually either “round down” a multiplying number to the nearest ten, break it apart and add up the resulting products or I “round up” a multiplying number, break it apart and subtract the resulting products.

That last sentence is probably impossible to parse without an example, so let’s look at 42 x 8, first using the round-down strategy.

Method 1: Round 42 down to nearest ten and add


Here, the implied first step is to round 42 to 40, but that doesn’t mean we forget about the 2. Instead, we recognize that 40 + 2 = 42 and rewrite the equation with 42 broken up. Then it’s a question of solving 40 x 8 and 2 x 8, both of which should be easy enough to do mentally. The final step is to add the products, 320 and 16 together.

Continue reading “Two (perhaps) quick(ish) ways to multiply two digit numbers in your head”

Ebook Mystery Word Problem!


I have recently been reading an ebook* that is quite long and has endnotes. Because my ebook reader only tells me my current positions in the actual body of the book and the endnotes, I have been wondering how much of the book I have actually read. Right now, my reader tells me I’m on block 8577 in the book’s body and block 22884 in the endnotes section. Note that a “block” can be thought of as a segment of the book’s text, be it a group of words or characters. For example, each block could be 120 characters, including blank spaces.

To solve this mystery, I gathered the following extra information from the book’s table of contents.

Total number of blocks in book: 24506

Starting block of endnotes: 21434

Can you figure out, to the nearest percent, how much of the book I’ve read?

Continue reading “Ebook Mystery Word Problem!”

To cross multiply or not cross multiply

When I was in Grade 7 our homeroom/math teacher told the class in a hushed voice, “Don’t cross multiply.” At the time I didn’t understand what he meant, nor did I likely understand what cross multiplication was. Ever since I have occasionally wondered why he would admonish students from using such a useful tool. Cross-multiplication can tell you whether two proportions are equivalent and get you out of some tricky algebraic situations involving fractions.

Showing that two proportions are equivalent


Continue reading “To cross multiply or not cross multiply”