# Side length of square inside a triangle

What is the side length of a square that has a corner in both the right angle and on the hypotenuse of a right triangle with side lengths of three, four and five? Don't use a calculator!

Probably a pretty easy puzzle for some of you, but I thought it was fun to work out.

$a+b=5\\\therefore\frac5x=\frac{a+b}{x}=\frac{a}x+\frac{b}x=\frac54+\frac53\\\text{because the two smaller triangles are similar to the initial triangle}\\\therefore{x}=\frac1{\frac14+\frac13}=\frac{12}7$

This also shows that in a right triangle with legs $m$ and $n$, the square will have a side length of $\frac1{\frac1m+\frac1n}=\frac{mn}{m+n}$.

Place the triangle so that its vertices are at $(0,0), (0,4), (3,0)$. Then the hypotenuse is $y=4(1-x/3)$. The corner of the square which lies on the hypotenuse is $(z,z)$ where $z=4(1-z/3)\Rightarrow 3z=12-4z\Rightarrow 7z=12$ so $z=12/7$ which is therefore the length of a side of the square.

• is it coincidence $\frac{12}{7}=\frac{3\times4}{3+4}$? – JonMark Perry Aug 7 '16 at 6:35
• @JonMarkPerry No -- and well spotted. – Rosie F Aug 7 '16 at 6:42
• @JonMarkPerry Perhaps it would be more obvious if the the hypotenuse was written as $4x+3y=12$. – Neil Aug 8 '16 at 0:29
• @Neil; i don't understand? – JonMark Perry Aug 8 '16 at 2:09
• @Neil Now we're getting into matters of style & opinion. Different people will look at the line & the coordinates of its intercepts on the axes, and they'll think of it in different ways. I saw the "y=mx+c" form; that comes naturally to me. When working on paper I wrote $y=4+\frac43x$ but took the factor 4 out when writing my answer. $4x+3y=12$ is also correct but perhaps doesn't leap so readily to the mind. Yet another way is $\frac{y}4+\frac{x}3=1$ which some might easily see -- it pairs each axis's letter with that same axis's intercept. – Rosie F Aug 8 '16 at 5:32

A slightly different proof (which doesn't start with knowledge of the hypotenuse):

we want the side of the square, call it $x$,
the area of the square is $x^2$,
the non-hypotenuse (two shortest) sides of the original, right-angled triangle are $a,b$
the area of the original triangle is, therefore, $\frac{ab}2$
removing the square leaves two smaller right-angled triangles (angles on a line sum to $180^\circ$)
they also have two shortest sides (meeting at the respective right-angle),
one of these sides of each of those triangles is a side of the square with length $x$,
the other of the sides are $a-x$ and $b-x$

the sum of the areas of those two smaller triangles is\begin{align}&\frac{x(a-x)}2+\frac{x(b-x)}2\\=&\frac{x(a+b)}2-x^2\end{align} the two smaller triangles and the square make up the whole of the original triangle so\begin{align}\frac{ab}2&=\frac{x(a+b)}2-x^2+x^2\\ab&=x(a+b)\\x&=\frac{ab}{a+b}\end{align}

Yielding an answer to the specific question posed of

$\frac{3\times4}{3+4}=1\frac57$ (as already shown by others)

• In what sense does this answer "start with knowledge of the hypotenuse"? – Peregrine Rook Aug 7 '16 at 18:09
• @PeregrineRook typo/B.F. :) doesn't - i.e. it proves the same without starting with and then cancelling out the hypotenuse. – Jonathan Allan Aug 7 '16 at 18:36

Using f'''s picture and Pythagoras, we get:

$$[1]\quad x^2+(3-x)^2=a^2\implies 2x^2-6x+9-a^2=0$$

$$[2]\quad x^2+(4-x)^2=b^2\implies 2x^2-8x+16-b^2=0$$

$$a+b=5$$

Adding $[1]$ and $[2]$ gives:

$$4x^2-14x+25-a^2-b^2=0$$

Using the fact the $x:a=5:4$ and $x:b=5:3$ we get:

$$\dfrac{x^2}{ab}=\dfrac{12}{25}\implies 2ab=\dfrac{25x^2}{6}$$

We know that:

$$25=(a+b)^2=a^2+b^2+\frac{25x^2}{6}$$

So we have:

$$4x^2-14x+\dfrac{25x^2}{6}=0\implies \dfrac{49x}{6}-14=0\implies 7x=12$$

So $x=\dfrac{12}{7}$.

This diagram was inspired by Jonathan Allan's generalization, which shows that the hypotenuse length is coincidental, and by f'' ’s mention that the sides of the smaller triangle are proportional to the sides of the full 3 × 4 triangle. The underlying calculation speaks for itself simply.

(Click within any spoilered/shaded region to show it permanently.)