# Solution to puzzle 113: Ant in a field

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
172 = 132 + (20)2 − 2 · 13 · 20 · cos QPB.
Simplifying, we find cos QPB = 17 / 26.
Then sin2 QPB = 1 − cos2 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
BC2 = 202 + 132 − 2 · 20 · 13 · (5/13) = 369.

Therefore the area of the field is 369 m2.

## Remarks

The above method may be used to solve the general case, where PB = a, PD = b, PC = c.  Letting BC = s, we obtain
s2 = ½ [a2 + b2 + (4c2(a2 + b2 − c2) − (a2 − b2)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 a2 + b2 = c2 + d2.  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.

## Alternative proof

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 = x2 + 202 − 132 = x2 + 231,(1)
PCD,  40x · cos PCD = x2 + 202 − 172 = x2 + 111.(2)

Note that cos PCD = cos(90° − BCP) = sin BCP.
Hence, squaring and adding (1) and (2), we obtain 1600x2 = (x2 + 231)2 + (x2 + 111)2.
Expanding, and collecting terms, x4 − 458x2 + 32841 = (x2 − 369)(x2 − 89) = 0.

We reject x2 = 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 m2.