I’m assuming that 9cm is the hypotenuse of the triangle.
By using Pythagorean’s theorem
α²+b²=c²
in this case, c =9
So, (x+5)² + (x-3)² =(x+5)(x+5) + (x-3)(x-3)
=x²+5x+5x+25+x²-3x-3x+9
=2x²+4x+31=81
And by solving the equation, you get two x values, but since you can’t have x as a negative figure, the positive figure being 3.9498, x=3.95 (corrected to 3 significant figures)