Disclaimer 1

### Defintion

The relation of two things is, such that the ratio of A plus B to A is the same as A to B.

function isGoldenRatio (a, b) {
var x = (a + b) / a;
var y = a / b;

// check if 'almost' equal, avoids floating point errors
return (x - y) < Number.EPSILON;
}


### Where to begin?

Well, if I were to construct a rectangle, such that its length is 1, which height value would be necessary to result in a golden ration?

Let's start by solving the equation describing the golden ration for b.

In order to get rid of a, I assume it to be equal to 1.

// when assuming a = 1
((1 + b) / 1) == (1 / b)

// we're able to simplify this to
(1 + b) == (1 / b)


To find a value for b, I try to rearrange the equation so it can be solved as a quadratic equation.

Because b is in the denominator, I have to assume it is never 0.

// assume b != 0
b * (1 + b) == 1

// expanded
b + (b * b) == 1

// and subtracted by 1
b + (b * b) - 1 == 0

// and flipped
0 == (b * b) + b - 1


Now I determine the p and q values of the equation.

0 == p * (b * b) + q * b - 1


This gives me p = 1 and q = -1

Now I can start solving the equation to find its root.2

// base equation
x1 = -1 * (p / 2) + sqrt(pow((p / 2), 2) + 1)

// with my values I get
x1 = -1 * (1 / 2) + sqrt(pow((1 / 2), 2) + 1)

x1 = -1 * (1 / 2) + sqrt((1 / 4) + (4 / 4))

x1 = -1 * (1 / 2) + sqrt(5 / 4)

x1 = -1 * (1 / 2) + sqrt(5) / 2

x1 = (sqrt(5) - 1) / 2


So b turns out to be defined as:

b = (sqrt(5) - 1) / 2


Assuming a = 1 and b ~ 0.618, I now have a valid set of values to meet the rules of the golden ration.
But what is the actual ration between a and b in this case?

Let's have a look.

### Calculating the Ratio

Assuming my values are:

a = 1
b = (sqrt(5) - 1) / 2


I now search for the ratio phi, between a and b.

phi = 1 / ((sqrt(5) - 1) / 2)


I could now try to simplify this. But let's have a look again with what I actually started.

Because of my inital assumption of a = 1 I got:

(1 + b) == (1 / b)


So I could write phi like that.

phi = 1 + ((sqrt(5) - 1) / 2)


Which is much nicer in my opinion.

If I now try to simplify this, I get:

phi = (2 / 2) + ((sqrt(5) - 1) / 2)

phi = (sqrt(5) - 1 + 2) / 2

phi = (sqrt(5) + 1) / 2


And there I have it.

The golden ratio is (sqrt(5) + 1) / 2 or roughly 1.618

So this yields an interesting relation.
If I subtract the one I just added I get the same value described by the inverse of phi, which is the same value we calculated for b.

This means the inverse of phi is the same as phi minus 1.

phi - 1 == 1 / phi


If you plot those two graphs you get this wonderful graph.

If I now start with this relation, I can deduce other very interesting relations.

### Relations

Phi minus the inverse of phi is 1.

phi - 1 == 1 / phi

1 == phi - (1 / phi)


The square of phi minus phi is 1.

phi - 1 == 1 / phi

1 == (phi * phi) - phi


Or in turn, phi squared minus one, is again phi.

1 == phi * (phi - 1)

phi == (phi * phi) - 1


From here I can show that the square of phi is equal to phi plus 1.

(phi * phi) == phi + 1


It is also possible to show that the square root of phi plus 1 is actually just phi. Amazing ;)

phi == sqrt(phi + 1)


It it also possible to build a 3rd degree polynomial[^3] in a rather pleasing way.

1 == (phi * phi) - phi

phi == phi * ((phi * phi) - phi)

phi == (phi * phi * phi) - (phi * phi)

0 == (phi * phi * phi) - (phi * phi) - phi


Another nice form would be

(phi * phi * phi) == (phi * phi) + phi


Which when plotted, looks like this.

### Whats next

I the next post in this series, I will take a closer look at functions which can be build from the rule set of the golden ration and what possible applications there are.

In the mean time, you might want to check out the silver ratio or read about recreational mathematics.

1. These are just some random thoughts on the golden ration. Why? Just for fun, and because of my strange fondness for this particular number. So please bear with me if my mathematical approaches are not as sophisticated as they possibly could be ;)

2. Null, or zero point

3. Also known as cubic equation