we have three similar triangles, because each has a right angle and shares an angle. let's write the angles in order: opposite to short leg, long leg, hypotenuse.
cab similar to bad similar to cbd
or as ratios,
ca: ab: cb = ba: ad: bd = cb: bd: cd
we also know
ac = ad + cd
(ad+cd): ab: cb = ba: ad: bd = cb: bd: cd
we have cb=6, ad=5 and seek x=cd.
we reject the negative root and conclude x=4