Given a square ABCD, let P be such that AP=1, BP=2 and CP=3.

* What is the length of DP?

* What is the angle APB?

There are two possible answers, one with p outside the square and one with p inside the square.

Let A be at (0,0), B at (d,0), C at (d,d) and D at (0,d).

Let P be at (x,y).

Using the distance formula:

(AP)^2 = 1 = x^2 + y^2

(BP)^2 = 4 = (x-d)^2 + y^2

(CP)^2 = 9 = (x-d)^2 + (y-d)^2

(DP)^2 = x^2 + (y-d)^2

From this it is easy to find (DP)^2 = 6, as noted by others.

Using the equations for AP and BP, x can be expressed in terms of d:

((x-d)^2 + y^2) - (x^2 + y^2) = 4 - 1

d^2 - 2dx = 3

x = (d^2 - 3)/(2d)

Similarily, AP and DP can be used express y in terms of d:

y = (d^2 - 5)/(2d)

Substituting the expressions for x and y into x^2 + y^2 = 1 yeilds an equation in d: ((d^2 - 3)/(2d))^2 + ((d^2 - 5)/(2d))^2 = 1

The equation can be reduced to d^4 - 10d^2 + 17 = 0. This gives two positive values for d: sqrt(5 - 2*sqrt(2)) and sqrt(5 + 2*sqrt(2)).

If d = sqrt(5 - 2*sqrt(2)) then P is located at x = (1-sqrt(2))/sqrt(5 - 2*sqrt(2)), y = -sqrt(2)/sqrt(5 - 2*sqrt(2))

P is outside the square in this case.

In this case, using the law of cosines on triangle APB gives:

(sqrt(5 - 2*sqrt(2)))^2 = 1^2 + 2^2 - 2*1*2*cos(angle APB)

The equation reduces to 1/sqrt(2) = cos(angle APB) which means angle APB is 45 degrees.

If d = sqrt(5 + 2*sqrt(2)) then P is located at x = (1+sqrt(2))/sqrt(5 + 2*sqrt(2)), y = sqrt(2)/sqrt(5 + 2*sqrt(2))

P is inside the square in this case.

In this case, using the law of cosines on triangle APB gives:

(sqrt(5 + 2*sqrt(2)))^2 = 1^2 + 2^2 - 2*1*2*cos(angle APB)

The equation reduces to -1/sqrt(2) = cos(angle APB) which means angle APB is 135 degrees.

**Solution summary:** There are two solutions. In both solutions the length of DP is sqrt(6). In the first solution P inside the square and angle APB=135 degrees. In the second solution P is outside the square and anlge APB=45 degrees.

*Edited on ***March 18, 2004, 11:43 am**