# Free-Style Math: Simple Calculator

The posts in the Free-Style Mathematics collection aim to discuss less orthodox (but functional) ways of doing good old math. The rule in this case is, there is no right way (although there are wrong ways). To be a little clearer on what we’re talking about, let’s stop rambling and start the discussion on how to do Free-Style Math with a simple calculator.

By simple calculator, let’s understand that it has a screen capable of displaying 8 digits, it has a keyboard with the options:

- Integers from 0 to 9
- The 4 Basic Operations of Mathematics
- =
- ,

At first glance it may not seem like it has a limitation. But let’s remember exactly how it operates.

- We enter a number (Integer or decimal)
- We select an operation (addition, subtraction, multiplication, division)
- We enter another number (Integer or decimal)
- If another operation is selected, then it performs the first operation (step 2) on step 1 and step 3 numbers, and returns to step 3.
- If the = sign is selected, it performs the math operation with the number of step 1 and step 3.

An example to make it easier for this calculator to work:

Let’s perform the operation 4 + 9 – 12 + 21

- Insert 4
- Select +
- Insert 9
- Select – (calculator gives me the result of 4 + 9)
- Insert 12
- Select + (calculator gives me the result of 13 – 12)
- Insert 21
- Press = (calculator returns the result of 1 + 21)

It really seems like there isn’t a serious problem with this kind of tool.

But now let’s see what happens with the following operation 9 + 1*0

- Insert 9
- Select +
- Insert 1
- Select * (calculator gives me the result of 9 + 1)
- Insert 0
- Press = (calculator returns the result of 10*0)

Oops, but there’s something weird about that. We learned that some operations are performed before others. In this case, we perform multiplication and division first, before addition and subtraction (the result of 9 + 1*0 should be 9).

One way to fix this problem is to understand how the calculator will “compute” the values. That is, rearranging the entries so that it does not conflict.

With that in mind, we can rewrite this operation as 1*0 + 9, and see what happens.

- Insert 1
- Select *
- Insert 0
- Select + (calculator returns the result of 1*0)
- Insert 9
- Press = (calculator returns the result of 0 + 9)

Sound simple? But let’s see a uglier case: ((20/5) + (4*5))/6. Algebraically, we know how to solve this calculation, operating first the inner parentheses we have (4 + 20)/6, then operating the outer parenthesis we get 24/6, now performing this operation, we have 24/6 = 6. However, how to rewrite this account so that our simple calculator can solve?

**Think for a moment before proceeding with this text.**

Well, let’s go. I need to think first about the way I solved this calculation algebraically and come up with a way for it to occur calculatingly.

4*5 * 5 + 20 / 5 / 6

Let’s see if it works:

- Insert 4
- Select *
- Insert 5
- Select * (calculator returns the result of 4
*5) Insert 5 Select + (calculator returns the result of 20*5) - Insert 20
- Select / (calculator gives me the result of 100 + 20)
- Insert 5
- Select / (calculator gives me the result of 120/5)
- Insert 6
- Press = (calculator returns result of 24/6)

Wow, it worked 🙂

But is this trick really functional? To answer that, let’s see what happened…

I performed the 4*5 operation (so far without anything else)

As I would add 20/5, so I put the result (4*5) with the same denominator as 20, so I multiplied (4*5) by 5.

Now that (4*5) has the same denominator as 20 (because our 4*5 has become 100), I can add directly to 20.

So I divided the result 120 by 5, which is nothing more than writing (4*5 + 20/5) as 120/5.

Finally, I divided by 6 and got the result…

Liked? Kind of sadistic to do that? Anyway, it can be painful compared to solving it on paper, but it’s certainly more exciting (this is Free-Style Math)

I would like to take this opportunity to thank Leonardo Barichello, a professor at the IFSP in Jundiaí (Brazil) who is teaching a course on Computational Thinking, and brought up this topic of how to perform more sophisticated operations with a simple calculator and motivated the preparation of this post :3