Maximum Size of Square Inscribed in Right Angled Triabgle of Given Base and Height

The diagram shows a square inscribed inside a right angled triangle.

The equation of the line from O to C is  
\[y=x\]
  anf the equation of the line BH is  
\[y= - \frac{h}{b} x + h\]
. From these we can write  
\[c=- \frac{h}{b}c + h\]
,br> Hence  
\[c(1+ \frac{h}{b})=h \rightarrow c= \frac{hb}{h+b}\]
.
The square has side  
\[ \frac{hb}{h+b}\]
.