The Appolonius/Pappus m+n lines locus problem :
Given m+n distinct lines and a point not on any of them, determine the locus of all points such that the product of the distances from [x,y] to each of the first m lines and the distances from to each of the last n lines is the same as the product of the distances from to each of the first m lines and the distances from [x,y] to each of the last n lines.
Supposedly, Descartes invented analytic geometry to solve this problem. Let's tackle it with Maple.
Sample case : take 5 lines: y = 0, x =0, x+y =10 , x= -5, y = -5 , m = 3 and n = 2, [x0,y0]=[1,1]
The distance from [1,1] to each of the lines is easy to compute, except to the line x+y =10. Here we can use the fact that the distance from to is .
> eqn := x^2*y^2*(10-x-y)^2/2*6^2*6^2 = 1*1*8^2/2*(x+5)^2*(y+5)^2;
> lins := {x,y,x+5,y+5,x+y-10};
>
plots[display]([plots[implicitplot](lins,x=-17 .. 17,y=-17..17,
color=black),plots[implicitplot]({eqn},x=-17 .. 17,y=-17..17,
grid=[100,100],color=red)]);
What kind of graph is this?
It is the union of two graphs, each of a cubic equation in x and y. Below we have factored the equation and graphed each factor separately.
>
> eqn2 :=factor(lhs(eqn) -rhs(eqn));
> op(2,eqn2);
>
plots[display]([plots[implicitplot](lins,x=-17 .. 17,y=-17..17,
color=black),plots[implicitplot]({op(2,eqn2)},x=-17 .. 17,y=-17..17,
grid=[100,100],color=red)]);
>
plots[display]([plots[implicitplot](lins,x=-17 .. 17,y=-17..17,
color=black),plots[implicitplot]({op(3,eqn2)},x=-17 .. 17,y=-17..17,
grid=[100,100],color=red)]);
What about the general case? Is the 3+2 line locus always a union of the graphs of two cubics in x and y?
To resolve this, we need some tools. Using the formula for the distance from a point to a line, we define a word dptl which returns the square of this distance.
>
>
dptl := proc(lin,pt)
local a,b;
b := coeff(lin,y,1);
a := coeff(lin,x,1);
subs({x=pt[1],y=pt[2]},lin)^2/(a^2+b^2) end:
> dptl(a*x+b*y+c,[x[0],y[0]]);
Next we want a word to return the equation describing the m+n locus for a given list of m+n lines and point.
>
appmn := proc(lins,pt,m,n)
local i,j;
convert([seq(dptl(lins[i],[x,y]),i=1..m),seq(dptl(lins[j],pt) ,j=m+1..m+n)],`*`)=
convert([seq(dptl(lins[i],pt),i=1..m),seq(dptl(lins[j],[x,y]) ,j=m+1..m+n)],`*`);
end:
Testing this on the case we just did:
> eqn:= appmn([x,y,x+y-10,x+5,y+5],[1,1],3,2);
Now make a word to draw the m+n line locus.
>
drawit := proc(lins,pt )
local gr,eqn,plt1,plt2,plt0,urc,llc,n,m;
if nargs < 3 then m := 2: n := nops(lins)-2: else m := args[3]: n := args[4]: fi;
if nargs < 5 then llc := [-10,-10]: urc:=[10,10]: else
llc := args[5]: urc:= args[6]: fi;
if nargs<7 then gr := 49 else gr:= args[7]: fi:
eqn := appmn(lins,pt,m,n,llc,urc):
plt0 := plot([pt],color=black,style=point,symbol=circle):
plt1 := plots[implicitplot]({op(lins)},x=llc[1]..urc[1],
y=llc[2]..urc[2] ,color=black):
plt2 := plots[implicitplot](eqn,x=llc[1]..urc[1],
y=llc[2]..urc[2],color=red,grid=[gr,gr]):
plots[display]([plt1,plt2,plt0],title=convert(eqn,string));
end:
> drawit([x,y,x+y-10,x+5,y+5],[1,1],3,2,[-10,-10],[11,11],100);
To work on the general 3+2 locus problem, form the equation describing the locus.
> eqn:= appmn([seq(a[i]*x+b[i]*y-c[i],i=1..5)],[x[0],y[0]],3,2);
Notice that the denominator of each side is the same, so we can cancel it to form eqn2.
> eqn2 := numer(rhs(eqn))-numer(lhs(eqn));
Now notice that we have the difference of two squares here, so we can factor this. If you just tell maple to factor it, be prepared to wait forever, it simply cannot do it. We can construct the u and v factors by hand however.
> u:=convert([seq(map(op,[op(op(1,eqn2))])[1+2*i],i=0..4)],`*`);
> v:=convert([seq(map(op,[op(op(2,eqn2))])[ 2*i],i=1..5)],`*`);
> eqn3:= u-v;
> eqn4:= u+v;
By inspection, we can see that these two equations are both cubics in x and y. In fact, the method here works for any m+n locus problem and we can state the following theorem.
Theorem: The graph of an m+n line locus equation is the union of two graphs, each of which is the graph of an equation in x and y of degree max(m,n).
>