A Conundrum: When is Equal, Not Equal? Or, Not Equal, Equal?

This is an optional section. It can be skipped without any loss of continuity. If you want to see a real-life example of the importance of significant digits, keep reading!

There are no exercises in this section—just a puzzling story with a happy ending.

The Story Leading to the Conundrum

In July 2016 I discovered that a couple timed exercises were missing from Algebra Pinball. When I added the entries to the table, I wanted to put in my own sample times.

So—you're about to learn a little secret. On many of my timed exercises (but not all), you don't need to put in the simplest form of the answer . Instead, you can put in a correct calculation that leads to the answer. If you do it this way, there's absolutely no ‘cheating’ involved. Why not? If you can give a thought process leading to a correct answer, then you understand the concept.

Here's a typical problem from Solving Linear Equations Involving Fractions :

Solve: $\,3x+5 = -\frac 89$

The answer I type in:   (-8/9-5)/3

Computer response: Correct!

For those of you who already know how to solve linear equations, there's no surprise here: $$\begin{gather} 3x+5 = -\frac 89\cr\cr 3x = -\frac89 - 5\cr\cr x = \frac{-\frac 89 - 5}{3} \end{gather}$$

Every now and then, though, this would happen:

Solve: $\,6x+\frac89 = 5$

The answer I type in:   (5-8/9)/6

Computer response: Sorry. Please try again.

I checked my answer—yep, it's correct. I clicked to see the reported answer: $\frac{37}{54}\,$, which is indeed the simplified version of $\,\frac{5 - \frac{8}{9}}{6}\,$ (phew—no coding error).

I went back to my code, to see if some cases were handled differently than others—nope. I knew I wasn't making an order of operations error in the way I was typing it in. I was stumped.

So, I waited for my genius husband to arrive home. Within seconds, he knew precisely what was going on, and gave a simple clarifying example. With his permission, I share it with you here.

There are Numbers that Computers Can't Render Exactly

Computers represent numbers in base two, using sequences of zeros and ones. For example, the number twelve is represented as ‘$\,1100\,$’ in base two. Most people, however, are more familiar and comfortable with base ten. So, this discussion illustrates the ideas in base ten.

Computers have limited space to store numbers. If they can't represent a number exactly within their space limitations, then they do the best they can.

Consider, for example, this infinite-repeating decimal: $$\frac 13 = 0.33333\ldots\,$$ Here's the best my computer language can do:

• it knows that ‘$\frac 13 = 0.3\,$’ is false
• it knows that ‘$\frac 13 = 0.33\,$’ is false
• it knows that ‘$\frac 13 = 0.333\,$’ is false
• keep going ... (I wrote a little test program to do this)
• it knows that ‘$\frac 13 = 0.333333333333333\,$’ is false ($15$ threes)
• but, it reports ‘$\frac 13 = 0.3333333333333333\,$’ as TRUE ($16$ threes)

My computer renders $\,\frac 13\,$ as $\,0.3333333333333333\,$ (sixteen ‘3’ digits). My computer is limited to about* sixteen significant digits.

All arithmetic is done within this significant digit limitation.

*The translation from binary to decimal doesn't give exactly sixteen, but it's pretty close. This switch from being not equal to being equal can occur at either sixteen or seventeen digits, depending on the calculation.

All Arithmetic is Done Within a Certain Significant Digit Limitation

Pretend, for the moment, that a computer has a $\,4\,$ significant digit limitation. The discussion is easier to follow with fewer digits to digest.

We know that   (10/3-3)/3   and   1/9   are truly equal: $$\frac{\frac{10}{3} - 3}{3} \ \ =\ \ \frac{\frac{10}3 - \frac{9}{3}}{3} \ \ =\ \ \frac{\frac 13}{3} \ \ =\ \ \frac 19$$

But, look what happens with a four significant digit limitation:

Computation of $$\frac 19$$ Computation of $$\frac{\frac{10}{3} - 3}{3}$$
$$\frac 19 = 0.111111\ldots \,$$ With four significant digits,it is: $$\color{red}{0.1111}$$
• $\frac{10}3 = 3.3333\ldots\,$

With four significant digits, it is: $$3.333$$
• $\frac{10}3-3\,$ is rendered as: $$\,3.333 - 3$$ With four significant digits, the result is: $$0.3330$$
• $\frac{\frac{10}3-3}{3}\,$ is rendered as: $$\frac{0.3330}{3}\,$$ With four significant digits, the result is: $$\color{blue}{0.1110}$$
PUNCHLINE: $$\color{red}{0.1111} \ne \color{blue}{0.1110}$$
This is precisely what is going on in my web exercises.

Conundrum resolved!