draw a segment parallel to CD from point B to AC ... let the intersection point with AC be point E.

right triangle ABE ... vertical leg = a-b , horizontal leg = x , hypotenuse = a+b

now use Pythagoras to get the desired result.

... btw, next time start a new problem w/ a new thread.