# Appendix A - The weird stuff that did not fit

## Money as linear combination

Money works this way too.. You can have many ways to combine the various coin denominations to reach a specific amount. Denominations is just a fancy term for the types of coins that there are in a currency. For example Monopoly money is denominated in**$1, $5, $10, $20, $50, $100, and $500**. Suppose for simplicity that I restrict myself to only use

**$1, $5, $10**banknotes, and I want to reach the amount of

**123**Monopoly dollars. Well then I have many combinations available: 123 = 1+...+1

123 = 1+1+1+5+...+5 → 3+24*5

123 = 1+1+1+10+...+10 → 3+12*10

and many more combinations, that you can get by using a different mix of

**$5**and

**$10**for example. ...

Here we are rewriting

**$123**as a linear combination of the three denominations: 123 = a*10 + b*5 + c*1 only that this linear combination has

**1, 5 and 10**as

*weights*, and they are too close to make the linear combination REVERSIBLE, so it is not, and I can find many values for

**a, b and c**that add up to

**123**. The first solution we explored is

**a=0, b=0, c=123**, which gives

**123 = 0*10 + 0*5 + 123*1**; the second is

**a=0, b=24, c=3**, which rewrites

**123**as

**0*10 + 24*5 + 3*1**, and so on.

## Proper, improper and apparent fractions

Time for some math terminology... Fractions come in many kinds.
Some are just whole numbers in disguise, like ^{7}_{1} or
^{15}_{5}. Those are called "apparent" in math, and they exist because a number divide by **1** remains the same, so you can always look at **5** as **5:1** or
^{5}_{1}; of course not all apparent fractions have **1** as their bottom number (AKA denominator), because they could also have been zoomed: for example,
if I zoom ^{5}_{1} by **3** I get
^{15}_{5}, but the meaning (AKA the value) is still **5**.

Other fractions are *good*, *solid* fractions, like ^{1}_{2} or ^{77}_{100}. These are called "proper" fractions, and are defined by the fact that the numerator (the top number) is smaller than the denominator.

Then there you have your "improper" fractions, where the numerator is larger than the denominator, for example: ^{7}_{3} or
^{17}_{9}.

There is also another concept related to fractions that you might remember from your school math, that of "mixed number". A mixed number is yet another way to write a fraction: you start from an improper fraction, then take away as many whole units as possible, and are left with an addition of a whole number and a proper fraction. An example of this procedure could be:
^{7}_{3} →
^{2*3+1}_{3} →
^{2*3}_{3} + ^{1}_{3} →

2 + ^{1}_{3} →
or even dropping the "+" sign, just *"two and one-third"*:
2 ^{1}_{3}
Interestingly, to write an improper fraction as a mixed number you have to rewrite the numerator as a linear combination of the denominator.

## Sum of numbers from 1 to n

The addition of all the whole numbers from**1**to

**n**is a famous problem in (school) math. It was Gauss how, as a child, discovered of a formula to calculate this sum (see here for an account of the situation in which the discovery occurred).

Say that you want (or have to) add the numbers from

**1**to

**10**; Gauss's key observation was that you can look at the numbers in a different way, than the obvious: 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = ? and instead he looked at them in pairs, the first and the last, and so on: 1 + 10 + 2 + 9 + 3 + 8 + 4 + 7 + 5 + 6 = ? and these are

**5**pairs, and all have the same value

**11**, so the sum will be

**5*11**. Visually that is a folding transformation:

**1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10**

**1**to any (large) number you like!

Let me show you: 1 + 2 + 3 + ... + 98 + 99 + 100 = ? well using Gauss's trick: 1 + 100 + 2 + 99 + 3 + 98 + ... + 50 + 51 = ? so that is

**50**pairs, each with a value of

**101**, and that gives me

**50*101 = 5050**. Now, that was way faster than doing the actual

**100**additions!

But we can do EVEN BETTER. We can make the formula that works not for

**10**or

**100**, but in general for

**n**(assuming for now that

**n**is an

*even*number): 1 + 2 + 3 + ... + (n-2) + (n-1) + n = ? Again using Gauss's trick, I get a number of pairs, all with value

**1+n**; how many pairs? Well in the previous examples it looks like half of the terms that I'm adding up, so here I'm adding up

**n**terms, and I should get

**n/2**pairs. Fine. That gives me a formula for the general case that looks like this: 1 + 2 + 3 + ... + (n-2) + (n-1) + n = (1+n) * (n:2) or if you like a more fancy math notation:

^{(1+n)*n}

_{2}

## Prime and composite numbers

Some whole numbers are primes and some (many) others are not, they are composite instead. Take a number like**12**for example, you can try to divide it by all the numbers smaller than itself:

number | divisors | result |
---|---|---|

12 | 2 | → 6*2 ✔ |

12 | 3 | → 4*3 ✔ |

12 | 4 | → 3*4 ✔ |

12 | 5 | → 1*5+2 |

12 | 6 | → 2*6 ✔ |

12 | 7 | → 1*7+5 |

12 | 8 | → 1*8+4 |

12 | 9 | → 1*9+3 |

12 | 10 | → 1*10+2 |

12 | 11 | → 1*11+1 |

... |

So

**12**has quite a few divisors:

**2, 3, 4, and 6**. A prime number is defined as a number that has only one and itself as divisors... so clearly

**12**is NOT prime! It is

*composite*. A number like

**11**for example is prime instead, and if you try to divide it by

**2, 3, ..., 10**you will see that each time you will get some reminder.

What we did in the table above is finding the factors of a number; however, we can be more subtle and look only for those factors that are PRIME numbers:

number | divisors | result |
---|---|---|

12 | 2 | → 6*2 ✔ |

12 | 3 | → 4*3 ✔ |

12 | 5 | → 1*5+2 |

12 | 7 | → 1*7+5 |

12 | 11 | → 1*11+1 |

... |

I can list all prime factors of

**12**(that are smaller than itself of course):

**2, 3**, and I can rewrite

**12**as a multiplication that uses only those factors, eventually repeated:

**12 = 2*2*3**. In math terminology

**2*2*3**is called

*"the prime factorization of 12"*. Remarkably, it is always possible to rewrite a number in this way, and a very powerful theorem ensures that for every whole number there is ONLY ONE prime factorization!

Let me show you. Take

**147**it can be divided by these primes:

**3, 7**, and its prime factorization is

**147 = 3*7*7**. There are no other ways to express

**147**as a multiplication of primes. But you might say: that cannot be, surely

**7*3*7**is another multiplication but it is also equal to

**147**... And you would be right! So I should add that the order does not count (we are talking about a multiplication after all...).

So if you buy the idea that every whole number is either prime or has a unique prime factorization, I can show you a terrific way to SEE if a number is prime or composite: we can draw a

*factorization diagram*for every whole number. Here are the factorization diagrams for the numbers from

**1**to

**20**:

The factorization diagram for a number has as many dots as the number (so the diagram for

**5**has five dots), but the way the dots are arranges is important too: for a prime number the dots are the corners of a regular polygon (so the five dots for

**5**form a regular pentagon), but for a composite number, the dots are arranged in sub-groups that depend on the numbers of the prime factorization of the composite number. For example the diagram for

**12**shows three groups of four dots, because the prime factorization of

**12**is

**3*4**, and it is unique.

Finally, take

**18**, its factorization is

**2*3*3**and the factorization diagram shows that clearly:

**18**dots, arranged in three groups of six dots. Each group of six dots is a made of three groups of two dots. So three, three, and two. Nice.

## Polynomials as linear combinations of variables and numbers

Base 10 numbers and polynomials are similar. Let me give you an example:
3 * 10^{2} + 2 * 10^{1} + 5 * 10^{0} = 325
Now let's replace **10** with the variable **x**, AKA **x=10**:
3 * x^{2} + 2 * x^{1} + 5 * x^{0} = 325
Fine, nothing special about that substitution. But... wait! Now I have an opportunity to *change* **10** to another number, because now I can put any number I want in **x**, and see what it gets me.
For example, let me try a few values to get the feeling of this polynomial:

x | 3 * x^{2} + 2 * x^{1} + 5 * x^{0} |
---|---|

10 | 325 |

9 | 266 |

8.5 | 238.75 |

... | ... |

5 | 90 |

1 | 10 |

0 | 5 |

-1 | 6 |

-2 | 13 |

-10 | 285 |

... | ... |

100 | 30205 |

1000 | 3002005 |

... | ... |

**x**is larger than

**10**the value of the polynomial grows:

**x=100 → polynomial = 30205**, and

**x=1000 → polynomial = 3002005**. So it looks like the larger

**x**gets the more the digits of the number

**325**SEPARATE!

In a very real sense

**x**CONTROLS the separation between the spikes of the abacus. Try with the playground below, to see what happens as you change

**x**. Try with

**x=5.5**and

**x=1000**.

And finally, another way to see this is to say that:
3 * x^{2} + 2 * x^{1} + 5 * x^{0}
is that it is the linear combination of three simpler expressions in **x**: **x ^{2}**,

**x**, and

**1**. Try in the playground below, to combine these three functions, using different weights, and see what comes out. Be sure to try also with the weights

**3, 2, 5**.

Now try with **1, 0, 3**, then decrease the last number from **3** down to **-3**, reducing it of **1** at each step.

In how many points does the blue line touch the *X axis* in each case, as you change the third number?

Let's see together... when the third number is larger than **0** there are no intersection points between the line and the axis. When the number is exactly **0**, there is one point of intersection; when the number is less than **0** the points are two.

This means that in some cases the polynomial can go negative (or be equal to zero) in some points, and in some others it never does (for example in the case of **x ^{2}+2**). And by combining the three expressions

**x**,

^{2}**x**, and

**1**, with different weights, we can effectively generate all kinds of plots.

## A different definition of addition of Peano numbers

Another way to look at addition is that it looks like the*successor*operation repeated many times. For example, if

**3**is also "

*+1*repeated

**3**times", then

**5 + 3**must also be

**5 + 1 + 1 + 1**. More in general then, if I have two numbers to add, called them

*a*and

*b*, it should be correct to say: a + b = a +1 ... +1

But surely also: a + b = +1 ... +1 + b = +1 ... +1 +1 ... +1

since also

*a*can be seen as Peano number, made of a repetition of

*+1*s. And because

**a + b**is just a bunch of

*+1*s representing

*a*put together with another bunch making up

*b*, then clearly it does not matter in what order I put them together, the result will be the same, so: a + b = +1 ... +1 +1 ... +1 = +1 ... +1 +1 ... +1 = b + a

And this is true for any two numbers!

Really?! What about if

*b*is

**0**? Or

**1**? Let's see. I can try putting

**b = 0**in the formula above, and I get: a + 0 = a +1 ... +1 = a

But what is "+1 repeated 0 times"? It must be nothing, right? So it is true that:

**a + 0 = a**, for any number

*a*. And because

**a + b = b + a**, also

**0 + a = a**, for any number

*a*. Not a big surprise there, but good that now we could SEE where these properties of the addition comes from.

And what about

**b = 1**? What do you think? a + 1 = a +1 ... +1 = a +1 = "the successor of a"

OK, again nothing too suprising here, but at least our intuition of what it means to add two numbers holds when we express it in terms of Peano numbers.

## What is "a" to the power of -1?

Remember that the general rule for calculating **a ^{b} * a^{c}** is:
a

^{b}* a

^{c}= a

^{(b+c)}Here I want to find out what could

**a**be. I don't know at this point how the power operation works on negative numbers, but whatever

^{-1}**a**is, it must work like the rest of the power operations... so the rule

^{-1}**a**must still apply. This means that I can try to use the rule and look at: a

^{b}* a^{c}^{-1}* a

^{c}where

**b=-1**. By definition, that gives me: a

^{-1}* a

^{c}→ a

^{(-1+c)}or, written in a

*nicer*way:

**a**. OK, so what if

^{(c-1)}*c*is one, AKA

**c=1**? Well, in that case I get:

**a**; but I know that

^{-1}* a^{1}→ a^{0}**a**. So: a

^{0}= 1^{-1}* a

^{1}→ 1 and I did not assume anything special about

*a*, so it can be ANY number. Interesting. How does that look, substituting

*a*with a few numbers (to get the feeling of that equivalence there)?

a | a^{-1} * a^{1} = 1 |
a^{-1} |
---|---|---|

1 | ? * 1 = 1 → | 1 |

2 | ? * 2 = 1 → | ^{1}_{2} = 0.5 |

3 | ? * 3 = 1 → | ^{1}_{3} = 0.333 |

... | ||

10 | ? * 10 = 1 → | ^{1}_{10} = 0.1 |

... |

So it looks like any number

*a*to the power of

**-1**is simply

^{1}

_{a}. In math they call

^{1}

_{a}

*the inverse*of

*a*, and the property of inverses is that when you multiply a number by its inverse you always get

**1**.

*This stuff does not work with zero, because zero is special and has no inverse.*

Anways. Not only

**a**is

^{-1}**, a**

^{1}_{a}*negative power*of a number is just the inverse of the corresponding

*positive power*. Or if you prefer a formula: a

^{-n}=

^{1}

_{an}where

*a*can be any number, and

*n*is any positive number.

## Positive and negative Peano numbers

In math the usual way to show negative numbers together with positive ones (AKA integers), is to draw the *number line*:

Usually Peano numbers (see chapter 2) are not used to work also with negative numbers, but we could invent an extension of Peano's notation, where 3 is still SSSZ and -3 is ZSSS. Of course the normal form here is that no number should have Ss on both sides of Z: SSZS cannot be a

*correct*number. Given this new notation, I can try to add 3+(-4): SSSZ + ZSSSS, and the rule might be:

- merge the two numbers, so they have the Z character in common: SSSZSSSS
- then simply be to remove one S from each side, until no Ss are left on one of the two sides (AKA until the number is in normal form)

And since you can see that Z is used to separate two unary numbers, we have precisely the two boxes that the commerce interpretation required. Finally, addition and subtraction can be both seen as repetition of "adding 1" or "subtracting 1", and they can somehow be mixed: if numbers remember their

*sign*I can just write all my plus and minus operations as additions (where some terms are negative numbers).

## Multiply and divide with broken numbers

In chapter 3 we used this box-within-box notation to represent any positive and negative, whole and broken number. Here I want to redefine multiplication and division to work with the box-within-box notation, AKA all of the so called *rational* numbers (a *subset* of real numbers).
Here I would like to simplify the way box-within-box works, then show how addition, subtraction, multiplication and division become when written for this notation, extended to work with any rational number.

Let me start by defining a *slimmer* version of the box-within-box notation. Take the rational number
**-12.3**, in chapter 3 we represented it as:
012.3
But I suggest that we avoid the dot (or comma if you prefer), and look at **-12.3** as the **fraction** ^{-123}_{10}. Any rational number can be written as a (positive or negative) fraction, by definition (a rational number is a number that is generated by a division). This suggests that the bare minimum to represent one rational numbers is: a whole number, positive or negative, as numerator and a whole number, always positive, as denominator.
Using this idea I can make up a slimmer box notation for rational numbers:
012310
as a triplet (AKA a 3-tuple)! In the triplet, the first two boxes constitute the numerator (so I can write a positive or a negative number there), and the last box is for the denominator
This compact (and frankly a bit weird) way to write a rational number might be confusing... so let's write a few numbers in this notation, to get familiar with it:
3 →
301

-3 →
031

-3.5 →
03510

^{1}_{-3.5} →
^{-10}_{35} →
01035

^{1}_{2} →
102

Armed with this new slimmer notation, I can try to redefine the basic operations... using mostly the rules for fractions.
For example: **0.5 + ^{-3}_{2}**
this translates to:
5010 +
032
→
132 +
032
→
132

132 -

*remove1FromBoth*→ 022

022 =

^{2}

_{2}= 1 and

**1**is the correct result. Good. Let's try a multiplication then:

**3 * (-4)**, which translates to: 301 * 041 → 041 + 041 + 041 →

03*41 → 0121 = -12 OK, fine. So when I multiply a positive and a negative number, the sign of the result is negative. You might remember this from your school math as the

*rule of the signs*. More in general it says that when I multiply two numbers, every

*minus*sign FLIPS the sign of the result once; so

**(-3) * (-4)**is

**12**, a positive number!

Good, and now let's multiply a broken and a whole number, to see how that looks here... I suggest

**12.3 * 5**, and I want to see both as fractions, like:

^{123}

_{10}*

^{5}

_{1}and the rule for multiplying fractions is simple: you get a new fraction that has the multiplication of the numerators on top, and the multiplication of the denominators at the bottom. What I get with my boxes is: 123010 * 501 → 123 * 5010 * 1 =

^{615}

_{10}= 61.5 and the result is correct (double check it with a calculator!).

Now let's calculate

**3.5 * (-4)**, which by the rule of signs I know should be negative. Again I have to LOOK at the two numbers as fractions:

^{35}

_{10}*

^{-4}

_{1}And I get: 35010 * 041 → 035 * 410 * 1 =

^{-140}

_{10}= -14 correct again! Good.

So, now let's do

**12.3 * (-5.5)**: 123010 * 05510 by the rule of signs I know the result will be negative, so I can work with that in mind: 0123 * 5510 * 10 =

^{-6765}

_{100}= -67.65 And that is enough to be sure that multiplication has been properly extended to rational numbers, using our slimmer box notation.

But what about division? Well, since we are treating every number as a fraction, we don't really need to have a rule specific for division. A division between two fractions is just a multiplication between the first fraction and the inverse of the second. As an example consider

**which becomes**

^{1}_{3}:^{1}_{2}**. And that means that in our slimmer notation that becomes: 103 : 102 → 103 * 201 → 1 * 203 * 1 =**

^{1}_{3}*^{2}_{1}=^{2}_{3}^{2}

_{3}Done! All operations can be defined for rational numbers using the slimmer box notation.

*Wait... what about the power operation with broken numbers? Well, that's for homework...*

## Cheat: look at the solution!

Consider this formula (that we encountered in chapter 7):
(n+m)^{2} = n^{2} + 2*n*m + m^{2}
Say that you want to *prove* that the rule is true for any values of *n* and *m*...
We could simply show that the left part is the same as the right part, by calculating a multiplication between expressions. I would get this:
(n+m)^{2} = n^{2} + 2*n*m + m^{2} →

(n+m)*(n+m) = n^{2} + 2*n*m + m^{2} →

n*n + n*m + n*m + m*m = n^{2} + 2*n*m + m^{2} →

n^{2} + 2*n*m + m^{2} = n^{2} + 2*n*m + m^{2} →

true
So surprisingly, this equation is true for any values of *n* and *m*, including when one or both are negative!

If you don't trust me, try with **n=-2** and **m=-3**... Substituting:
(n+m)^{2} = n^{2} + 2*n*m + m^{2}
becomes:
( (-2) + (-3) )^{2} = (-2)^{2} + 2*(-2)*(-3) + (-3)^{2}

⇓ ⇓

( -5 )^{2} = 4 + 2*(6) + 9

⇓ ⇓

25 = 4 + 12 + 9

⇓ ⇓

25 = 25
which does not prove anything in general, but shows how it can be that the formula works even when both variables are negative.