The problem

On a 2-D coordinate system, draw a line from (n,0) to (0,1-n), for all values of n ranging from 0 to 1. You end up with a solid shape with two straight edges and one curved edge. What is the equation describing the curved edge?

My solution

The key point is that the line corresponding to n and the line corresponding to n+dn (as dn approaches 0) intersect at a point on the curve. This is 'intuitively obvious' (i.e., I don't feel like proving it).
The equation for n is y = (n-1)/n * x + 1-n
The equation for n+dn is y = (n+dn-1)/(n+dn) * x + 1-n-dn
We want the (x,y) point where these two lines intersect. Since the y's are equal, we have
(n-1)/n * x + 1-n = (n+dn-1)/(n+dn) * x + 1-n-dn
Multiply both sides by n(n+dn):
(n-1)(n+dn)x + (1-n)n(n+dn) = n(n+dn-1)x + (1-n-dn)n(n+dn)
After doing a bunch of obvious cancelling, we get:
x = n^2 + n*dn
As dn approaches 0, x = n^2. Plugging back into the original equation,
y = (n-1)/n * n^2 + 1-n = n(n-1) - (n-1) = (n-1)^2.
y = (sqrt(x) - 1) ^ 2
One more way to look at it is
sqrt(x) + sqrt(y) = 1

Sean Barrett's solution

I thought about using the dn approach, but for some reason I wasn't sure it would work.

Instead, I chose to hold (x,y) fixed, and solve for all n that passed through (x,y).

This results in a quadratic equation in n (as at most two lines pass through any given point, which is easy to show--pick any two lines which intersect at some point, and imagine sweeping one of them through other positions--they must always intersect at different spots on the line).

Then, by handwaving (or guessing), assume that the case where only one line passes through the point, that must be on the edge of the curve. This is the point at which the determinant (discrimnant?) of the quadratic equation is 0, so at this point n drops out of the question entirely:

B^2 - 4AC = 0
A = 1
B = (y-x-1)
C = x
which is simply (note that the above form doesn't look like x and y are symmetric)
x^2 + y^2 - 2xy - 2x - 2y + 1
which can be factored as
(x-y)^2 = 2(x+y) - 1
If a = x-y, b = x+y (which is a linear transform of the space, specifically a 45-degree rotation and a little bit of scaling), this is
a^2 = 2b -1
b = 0.5 a^2 + 0.5
which in the reference frame of a,b is just a parabola in 'normal' form, squished down by 0.5 and translated up by 0.5.

Note that because I dropped n out early, this solution is valid for all n, If you want to draw it for n outside the specified range, you have to draw the entire line, not just the line from (n,0)..(0,1-n)--or at least enough of the line to extend into the first quadrant.

Andrew Solberg's solution

For any given n, the equation of the generating line is:
y = -(1-n)*x/n + (1-n)
I said that you could generate the curve by sweeping a line from angle 0 to 90 like a radar screen, and the point that makes the curve, for any given angle, is the point that intersects the above line AND, over the entire set of n, has a maximum distance x^2+y^2 from 0,0. Don't ask me to prove this; it seems intuitive to me that a point on my 'sweeping line' with a smaller x^2+y^2 would be hidden by other lines and would not generate the curve.

To do this, I had to convert to radial coordinates:

Subbing these into the equation of the line, I solved for r and got:
r = [1-n] / [sin(theta) + n^-1*cos(theta) - cos(theta)]
Now, my sweeping line, at any given angle, is just
theta = C
So if I hold theta constant, I can take the derivative of r with respect to n only, set this equal to 0, and thereby get n = f(theta) where distance r from 0,0 is a maximum.

Ugly math ensued. n comes out to be:

n = 1 / [1 + sqrt(tan(theta))]
Subbing this back into my equation for the generating line gives me a nasty f(r,theta) which, when rearranged and transformed into f(x,y), yields the answer.
Last updated 26 October 1998
Go back to Dan's home page