The Chinese Proof: Gougu and the Hypotenuse Diagram

A 7-by-7 grid, four red triangles and one yellow square: how Chinese mathematicians showed that gou² + gu² = xian², and how moving pieces "out and in" turns the picture into a proof.

By the PythagoreanTheorem.net teamUpdated 9 min read

The Chinese proof of the Pythagorean theorem uses the xian tu, or hypotenuse diagram: the square on the hypotenuse, made of four right triangles around a small central square. For the 3-4-5 triangle it fits a 7 × 7 grid, and its area is 4 × 6 + 1 = 25 = 32 + 42. The diagram survives in Zhao Shuang's 3rd-century commentary on the Zhoubi Suanjing.

Gou, gu and xian

Chinese mathematics named the sides of a right triangle after a carpenter's square. The shorter leg is the gou (勾, "hook"), the longer leg is the gu (股, "thigh") and the hypotenuse is the xian (弦, "string", as in a bowstring). The theorem itself is known in China as the gougu theorem:

gou2 + gu2 = xian2

On this page the colors follow the rest of the site: gou is side a (blue), gu is side b (orange) and xian is the hypotenuse c (green).

The hypotenuse diagram

gou 3 gu 4 xian 5 6 6 6 6 1 THE HYPOTENUSE DIAGRAM A 7 × 7 grid; the tilted square has side xian = 5. 4 red triangles: 4 × 6 = 24 1 central square: 1 xian² = 24 + 1 = 25
The xian tu for gou 3 and gu 4. The tilted square is the square on the xian.

As it is usually reproduced, the diagram is drawn on a 7 × 7 grid, because 3 + 4 = 7. Inside it sits a tilted square whose corners lie on the grid's edges. Each side of the tilted square is the hypotenuse of a right triangle with legs 3 and 4, so the tilted square is the square on the xian.

Inside the tilted square are four right triangles, traditionally colored red, each with legs 3 and 4 along grid lines and area 1 over 2 × 3 × 4 = 6. In the middle is a single yellow cell. The total is 4 × 6 + 1 = 25, so the xian square has area 25, the same as 32 + 42 = 9 + 16.

Zhao Shuang's commentary explains the figure in general terms, using the words gou and gu rather than the numbers 3 and 4. In paraphrase: multiply the gou by the gu to get two red areas, and double them to get four; multiply the difference between the gu and the gou by itself to get the central yellow area; add the yellow area to the four red areas and you have the area of the xian square. In modern notation, with a the gou and b the gu:

c2 = 2ab + (b − a)2

Expanding (b − a)2 = b2 − 2ab + a2 turns the right side into a2 + b2. Notice that "gou times gu" is a rectangle, which is exactly two of the red triangles: for 3 and 4, 3 × 4 = 12 = 2 × 6.

Reading the grid from the outside

The same grid can be read a second way. Instead of looking inside the tilted square, look at the four corners of the 7 × 7 square that lie outside it.

6 6 6 6 25 READ FROM THE OUTSIDE Whole grid: 7 × 7 = 49 Corner triangles: 4 × 6 = 24 Tilted square = 49 − 24 = 25
The four corner triangles outside the tilted square each have area 6.

The whole grid has 7 × 7 = 49 cells. Each corner triangle has legs 3 and 4 and area 6, so together they cover 24. What remains, the tilted square, has area 49 − 24 = 25. This is the first arrangement of the rearrangement proof. Some historians read a short passage in the main text of the Zhoubi as describing a calculation of this kind for the 3-4-5 triangle; the passage is brief, and its translation is disputed (see the gougu theorem page).

Out and in: the animated dissection

Liu Hui, writing his commentary on The Nine Chapters on the Mathematical Art around 263 CE, explained the gougu rule by moving pieces rather than by calculation. In paraphrase, he calls the square on the gou the red square and the square on the gu the blue-green square, and says that pieces "go out" and "come in", each to its matching place, while the rest stays unmoved, until together they form the square on the xian. Modern historians, following the mathematician Wu Wenjun, call this the out-in complementary principle (出入相补, chū rù xiāng bǔ): if a figure is cut into pieces and the pieces are moved, its area does not change.

1 6 6 6 6 gu 4gou 3 xian 5 GOU SQUARE + GU SQUARE3² + 4² = 9 + 16 TWO PIECES GO OUT AND COME INxian² = 4 × 6 + 1 Same five pieces, same area: 3² + 4² = 25 = 5²
The gou square (3 × 3) and the gu square (4 × 4) side by side. Two triangles are lifted out and moved in, and the same five pieces become the xian square.

Here is what the animation shows, on the same grid:

  1. Start with gou² and gu². Place the 3 × 3 square and the 4 × 4 square side by side on a common base line. Together they cover 9 + 16 = 25 cells.
  2. Cut. From the point 3 units along the base, cut to the top-left corner of the 4 × 4 square and to the top-right corner of the 3 × 3 square. Each cut is the hypotenuse of a 3-4-5 triangle, so each has length 5.
  3. Move out and in. The two triangles at the bottom corners are lifted out and moved in to fill the two notches at the top. Each moves by sliding, without turning.
  4. Read the result. The five pieces now form the tilted square on the xian, with four red triangles around the yellow cell: exactly the hypotenuse diagram. Nothing was added or removed, so 32 + 42 = 52.

Liu Hui's own diagram has not survived, and modern reconstructions of it differ. The cut shown here is one standard way to carry out his description, and it is the same cut that Bhāskara used in India about nine centuries later. It should not be mistaken for a copy of Liu Hui's lost figure.

From 3-4-5 to every right triangle

The grid makes the 3-4-5 case easy to count, but nothing in the argument depends on those numbers. For any right triangle with gou a and gu b (take b ≥ a), four copies fit inside the square on the hypotenuse in the same pinwheel pattern, leaving a central square of side b − a.

½ab ½ab ½ab ½ab (b − a)² a b c
The hypotenuse diagram for any gou a and gu b. The dashed square has side a + b.
c2= 4 · 1 over 2ab + (b − a)2= 2ab + b2 − 2ab + a2= a2 + b2

The out-in cut also works for any a and b: start from the side-by-side squares, cut from the point at distance a along the base to the two outer top corners, and move the two corner triangles up. This general version is what makes the diagram a proof rather than a single worked example. The same algebra, with a careful check that the central hole is a square, is on the algebraic proof page.

A complete modern proof

Theorem (gougu). If a right triangle has legs a ≤ b and hypotenuse c, then a2 + b2 = c2.

Proof. Let α and β be the acute angles opposite a and b, so α + β = 90°.

  1. Draw a square WXYZ of side c. On each side, inside the square, draw a copy of the triangle with that side as hypotenuse, placed so that the long leg b starts at the first corner of the side as you go round (W for side WX, X for side XY, and so on).
  2. At corner X, the triangle on WX has angle β and the triangle on XY has angle α. Since α + β = 90° = ∠WXY, their legs from X lie along the same ray: the short leg a of the first lies along the long leg b of the second. The same holds at every corner.
  3. So the four triangles do not overlap, and the region they leave uncovered is bounded by four segments of length b − a. Each corner of that region lies on a straight leg next to a triangle's right angle, so it measures 180° − 90° = 90°. The region is a square of side b − a.
  4. Adding areas: c2 = 4 · 1 over 2ab + (b − a)2 = 2ab + a2 − 2ab + b2 = a2 + b2. ∎

When a = b the central square disappears and c2 = 2a2, which is still correct.

What the sources say, and what they don't

The history of this proof is often told with more confidence than the evidence supports, so here is what is reasonably well established.

  • The Zhoubi Suanjing, roughly "the mathematical classic of the Zhou gnomon", is a text on astronomy and mathematics. It took its present form roughly between 100 BCE and 100 CE, from older material. It opens with a dialogue between the Duke of Zhou, a ruler of about the 11th century BCE, and an adviser named Shang Gao, who mentions a right triangle with sides 3, 4 and 5. The text itself is much later than the people in it, so it is not evidence that the rule was known in the 11th century BCE.
  • The diagram and its general explanation belong to the commentary of Zhao Shuang, written in the 3rd century CE. Historians disagree about how much of a proof the main text contains. Christopher Cullen, whose book includes a full English translation of the Zhoubi, argues that some older claims of a proof rest on a mistranslation.
  • Liu Hui wrote his commentary on The Nine Chapters on the Mathematical Art, whose ninth chapter is devoted to gougu problems, around 263 CE. His out-in explanation is general, but his diagrams are lost.
  • Links with other traditions. There is no evidence that the Chinese diagram was borrowed from Greek mathematics, or the other way round. Euclid's proof, from around 300 BCE, is older than Zhao Shuang's commentary; the same four-triangle figure appears again in 12th-century India in Bhāskara's proof.

For the gougu problems of the Nine Chapters, such as the broken bamboo and the reed in the pond, see the gougu theorem page. The history overview places the Chinese work alongside Babylon, India and Greece, and the guide to all the proofs lists other ways to prove the theorem.

Frequently asked questions

What is the Chinese name for the Pythagorean theorem?

It is called the gougu theorem (勾股定理), after the gou and the gu, the two legs of a right triangle. It is also sometimes called the Shang Gao theorem, after the adviser who discusses the 3-4-5 triangle in the Zhoubi Suanjing.

What is the xian tu?

The xian tu, or hypotenuse diagram, is the figure in Zhao Shuang's commentary on the Zhoubi Suanjing: the square on the hypotenuse divided into four red right triangles and a central yellow square. For the 3-4-5 triangle it is drawn on a 7 × 7 grid and shows 4 × 6 + 1 = 25.

Did the Chinese prove the theorem before Pythagoras?

Not on the surviving evidence. The 3-4-5 rule was known in China early, but the texts that survive were compiled after Pythagoras's lifetime (c. 570–c. 495 BCE), and the diagram with a general explanation dates from the 3rd century CE. The rule itself was in use in Babylon long before any of them; see who was Pythagoras?

What is the out-in complementary principle?

It is the idea, used by Liu Hui and other Chinese mathematicians, that a figure cut into pieces and reassembled keeps its area. Pieces "go out" of one place and "come in" to another. The modern name is associated with the mathematician Wu Wenjun, who wrote about the principle in his studies of Chinese mathematics.

Is the Chinese proof the same as Bhāskara's proof?

The figure is essentially the same. The Chinese version appears in Zhao Shuang's 3rd-century commentary, about nine centuries before Bhāskara II. Whether Bhāskara knew of it is not known.

Sources and further reading

  1. Christopher Cullen, Astronomy and Mathematics in Ancient China: The Zhou bi suan jing (Cambridge University Press, 1996), including an appendix on Zhao Shuang and the gougu theorem.
  2. Kangshen Shen, John N. Crossley and Anthony W.-C. Lun, The Nine Chapters on the Mathematical Art: Companion and Commentary (Oxford University Press, 1999), with Liu Hui's commentary.
  3. J. J. O'Connor and E. F. Robertson, Overview of Chinese mathematics, MacTutor History of Mathematics.
  4. Zhoubi Suanjing, Wikipedia.
  5. Xuan tu, Wikipedia, on the hypotenuse diagram.

Keep exploring