# Haidao Suanjing/Examples/Example 1

## Example of Problem from Haidao Suanjing by Liu Hui

What is the size of a square inscribed in the corner of a right-angled triangle to touch the hypotenuse?

## Solution

Let the lengths of the legs of the given right-angled triangle be $a$ and $b$.

Then the length of the side of the inscribed square is $\dfrac {a b} {a + b}$.

## Proof

Let $x$ be the length of the side of the inscribed square be $x$.

Without loss of generality, let $a < b$.

Let the right-angled triangle be half of a rectangle whose sides are of length $a$ and $b$.

Let the rectangle be dissected along the straight lines shown.

Let the pieces of the dissection be assembled into a rectangle whose sides are of length $a + b$ and $x$.

Then we have:

$a b = x \paren {a + b}$

and the result follows.

$\blacksquare$