So you have a single line of length X, and you want to extent the line to height Y such that you produce a golden rectangle. Simple as pi pie!
This problem can be solved with some simple algebra, and it is useful if you wish to draw a golden rectangle given a line of any length. For instance, you may want to incorporate golden rectangles into some artwork you are working on, or you may wish to crop photographs such that they are framed within a golden rectangle.
So, given a line of any length, you can break the line into two parts:
It is easy to see that:
From this, you can calculate that the length (A) of the sides of the square part of the golden rectangle is:
A = (A + B)/1.618
So just extend the line into a rectangle with base=(A+B) and height=(A+B)/1.618
Using this type of reasoning, if you have a square with a side of length A, and wished to extend the length to A+B such that the A+B is the length of the base of a golden rectangle, you can determine the length of B very easily: