Posted April 2, 2017 By Presh Talwalkar. Read about me , or email me .

ABCD is a rectangle. Point P is 11 units from A, 13 units from B, and 7 units from C.

What is the distance from P to D?

Note: the point P could be inside or outside the rectangle.

A version of this problem has been asked as a Microsoft interview question. Can you figure it out?

Watch the video for a solution.

Can You Solve The British Flag Riddle? (Interview Question)

Or keep reading.

.

.

"All will be well if you use your mind for your decisions, and mind only your decisions." Since 2007, I have devoted my life to sharing the joy of game theory and mathematics. MindYourDecisions now has over 1,000 free articles with no ads thanks to community support! Help out and get early access to posts with a pledge on Patreon. .

.



.

.

.

.

M

I

N

D

.

Y

O

U

R

.

D

E

C

I

S

I

O

N

S

.

P

U

Z

Z

L

E

.

.

.

.

Answer To The British Flag Riddle

We all learn the Pythagorean Theorem in school, but this extension is rarely taught. If P is a point and ABCD is a rectangle, then the sum of the squared distances to opposite corners is equal:

AP2 + CP2 = BP2 + DP2

In our problem, we have the distances:

AP = 11

BP = 13

CP = 7

Substituting into the formula, we get:

AP2 + CP2 = BP2 + DP2

112 + 72 = 132 + DB2

121 + 49 = 169 + DP2

1 = DP2

1 = DP

The distance from D to P is equal to 1.

It is somewhat amazing we can solve for the distance to the last corner! We did not know whether P is inside or outside the rectangle, and we did not know the length or width of the rectangle.

Geometrically, the formula means the total area of the red squares in the following diagram is equal to the total area of the blue squares. The shape is reminiscent of the Union Jack, and hence the name the British Flag Theorem.

The formula can be proven by the Pythagorean Theorem. Place the rectangle ABCD in a coordinate system so that AB runs east-west and AD runs north-south (for example, let AB be parallel to the x-axis and AD be parallel to the y-axis.) Let w be the horizontal distance from A and D to point P, x be the horizontal distance from B and C to P, y be the vertical distance from A and B to P, and let z be the vertical distance from C and D to P.

By the Pythagorean Theorem, the squared distance from P to a point is the sum of the squared horizontal distance and the squared vertical distance.

AP2 = w2 + y2

BP2 = x2 + y2

CP2 = x2 + z2

DP2 = w2 + z2

Thus we have:

AP2 + CP2 = BP2 + DP2 = w2 + x2 + y2 + z2

The point P can be anywhere in the plane, inside or outside the rectangle. Furthermore, the result applies if P is anywhere in space and ABCD is an embedded rectangle (this result follows by the distance formula, which is the coordinate version of the Pythagorean Theorem). For example, imagine point P is the apex of a pyramid with a rectangular base ABCD; the result still holds.

Sources

Alok Goyal’s Puzzles – a nice collection of problems

https://alokgoyal1971.com/2017/02/12/puzzle-170-rectangle-and-the-oil-well/

Wikipedia British Flag Theorem

https://en.wikipedia.org/wiki/British_flag_theorem

Geogebra Interactive Worksheet

https://www.geogebra.org/m/K4tBAjc4

The Art Of Problem Solving

https://artofproblemsolving.com/wiki/index.php/British_Flag_Theorem

Thanks to all patrons! Special thanks to:

Kyle

Shrihari Puranik

Marlon Forbes

You can support me and this site on Patreon.