1st Method:
Right triangles EGD and FGE are similar:
(∠G =90, ∠F=∠EDG - having their sides respectively perpendicular)
Then we can write:
EG/FG = GD/GE
7/4 = GD/7 , by cross multiplication→ 7² = 4.GD→ 49 = 4.GD and GD=12.5
2nd Method:
The altitude drawn from the vertex of the right angle of a right triangle to its hypotenuse is the geometric mean between the measures of the two segments of the hypotenuse:
Then EG² = DG x GF
7² = 4 x GD and GD = 49/4 = 12.5