# Prime Eval, Part 14 – Approximations

Back some weeks ago, I’d made a reference to rectangles as having a possible component that would look like you have a square of side a, and a smaller rectangle attached to it that is a x b, giving you an overall size of”a * a+b”. If you took the area of this rectangle, you’d get a^2 + ab.

This leads into a rather interesting question: What value would you need for a, so that a*a is equal to a+1.
a^2 = a+1
Or, a^2 – a – 1 = 0

The quadratic equation gives:
= (-(-1) +/- sqrt((-1)^2 – 4*(1*(-1))) / 2*1
= (1 +/- sqrt(1 + 4))/2
= (1 +/- sqrt(5)/2

When I was in high school, my math teacher proposed this problem in the form of “what number times itself is equal to that number plus 1?” His purpose in making this a word problem was to teach the concept of iteration. In this process, you start with what you think is close enough. Say, 1.0. Then you plug this value in to both sides:

1^1 = 1
1+1 = 2

Then subtract to get the difference, divide by 2, and add that to the original “a” to get the new value, and repeat until the difference is too small to matter.

(2 – 1)/2 = 0.5
a0 = 1; a1 = a0 + 0.5 = 1.5

1.5^2 = 2.25
1.5 + 1 = 2.5
2.5 – 2.25 = 0.25
a2 = 1.5 + 0.25/2 = 1.625

Pretty quickly, you’ll get to 1.618
However, if you flip the difference operation, so that you use
(1 – 2)/2 = -0.5
a0 = 1; a1 = a0 – 0.5 = 0.5
0.5^2 = 0.25
0.5 + 1 = 1.5
(0.25 – 1.5)/2 = -0.625
Pretty quickly you’ll get to the second answer of -0.618

Which is the same as if you used the quadratic equation. The thing is, I never understood what that “close enough”, or in his words “a reasonable guess” was. To me, it seemed that you already had to know the answer in order to get the answer. Or rather, that you put in enough work on the problem to have a good feel for what the answer should already be, before trying to find it. It turns out, though, that the approximation method works for any value between +/- (1 + 1.618), or +/- 2.618. So, simply picking 0 or 1 is going to get you to the answer within 5 to 6 iterations. Making an excel spreadsheet for this is pretty trivial, but I still like to do it. The answer converges very fast. If you pick a value outside this range, the result goes to infinity just as fast.

This number, 1 : 1.618, is called the Golden Ratio, and a rectangle with this dimension (1 x 1.618) is called a Golden Rectangle. So, for a * (a + b), a=1 and b = 0.618. The Golden Rectangle has been used for centuries in determining magazine dimensions and building design. The ratio shows up in nature, in branch and leaf spacing, and within the Golden Spiral. There are some arguments that the Great Pyramid of Giza is designed based on the Golden Pyramid, with a slope very close to the golden pyramid slope of 51 degrees and 50 seconds.

The really interesting thing is that there’s more than one way to represent the math. One choice is as continuing fractions (which incorporates the Fibonacci numbers):

Or continued square roots:

My favorite has always been the representation as a resistor ladder.

Why mention this? Because I think this kind of math is fun, extremely powerful, and shows up in unexpected places.

Now, Fibonacci. Leonardo Bonacci (c. 1170 – c. 1250) was an amazing guy, and you should read the wiki article on him. The Fibonacci sequence starts either with 0, 1 or 1, 1. To get the next number in the sequence, just add the current two most recent numbers together. I.e. –
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, …

This sequence shows up in nature, such as with bee ancestry codes, and seeds on a sunflower. The Fibonacci spiral approximates the Golden Spiral.

It’s all just stuff to think about.

Previous Post