If a perpendicular is drawn from the vertex of the right angle to the hypotenuse, then the triangles on both sides of the perpendicular are similar to each other and to the whole triangle.
Here, △ABC is right angled triangle at B and BD is the perpendicular drawn to the opposite side
∴ △ABD∼△BCD
⇒ BDCD=ADBD
⇒ BD2=AD×DC
⇒ BD2=5×5
⇒ BD=√25=5 cm