An ant, located in a square field, is 13 meters from one of the corner posts of the field, 17 meters from the corner post diagonally opposite that one, and 20 meters from a third corner post. Find the area of the field. Assume the land is flat.

Label the vertices of the square A, B, C, D. The ant is at point P, with PB = 13, PC = 20, PD = 17.

Rotate CDP 90° counterclockwise about C, so that D goes to B, and P goes to Q.

By definition, QCP = 90°. Hence, by Pythagoras' Theorem, PQ = 20.

Also, since PQC is isosceles, CPQ = 45°.

Applying the law of cosines (also known as the cosine rule) to BQP

17^{2} = 13^{2} + (20)^{2} − 2 · 13 · 20 · cos QPB.

Simplifying, we find cos QPB = 17 / 26.

Then sin^{2 }QPB = 1 − cos^{2 }QPB = 49/338.

Hence sin QPB = 7 / 26. (We will need this result below.)

We have CPB = QPB + CPQ = QPB + 45°.

Hence cos CPB | = cos (QPB + 45°) |

= cos QPB · cos 45° − sin QPB · sin 45°, by trigonometric identity cos(a + b) = cos a · cos b − sin a · sin b | |

= (cos QPB − sin QPB) / | |

= (10 / 26) / | |

= 5/13 |

Applying the law of cosines to CPB

BC^{2} = 20^{2} + 13^{2} − 2 · 20 · 13 · (5/13) = 369.

Therefore the area of the field is 369 m^{2}.

The above method may be used to solve the general case, where PB = a, PD = b, PC = c. Letting BC = s, we obtain

s^{2} = ½ [a^{2} + b^{2} + (4c^{2}(a^{2} + b^{2} − c^{2}) − (a^{2} − b^{2})^{2})].

Note that the formula is symmetric in a and b, as we would expect.

Letting PA = d, it is not difficult to show that a^{2} + b^{2} = c^{2} + d^{2}. This affords a shortcut to the above solution, in certain cases. For example, if (a, b, c) = (1, 7, 5), then d = 5, implying by symmetry that the distances of length 1 and 7 (PB and PD) are collinear. Hence the diagonal of the square is 8, and its area is 32.

Madhukar Daftary sent the following solution which does not require extra construction.

Let x denote the length of a side of the square. Applying the law of cosines to:

BCP, 40x · cos BCP = x^{2} + 20^{2} − 13^{2} = x^{2} + 231,(1)

PCD, 40x · cos PCD = x^{2} + 20^{2} − 17^{2} = x^{2} + 111.(2)

Note that cos PCD = cos(90° − BCP) = sin BCP.

Hence, squaring and adding (1) and (2), we obtain 1600x^{2} = (x^{2} + 231)^{2} + (x^{2} + 111)^{2}.

Expanding, and collecting terms, x^{4} − 458x^{2} + 32841 = (x^{2} − 369)(x^{2} − 89) = 0.

We reject x^{2} = 89, as the diagonal of the square would then be less than 14 meters, and the ant could not be both inside the square and, for example, 20 meters from one of the corners. (In fact, x = is a solution where P lies *outside* the square (below AB.))

Therefore the area of the field is 369 m^{2}.

Source: Traditional