AC=2X BC= under the root number (under the root number 2)? -X? = 40-X under the root sign?
CD=BD= 40-X under the root sign? Divide the whole by 2.
CD? +AC=AD?
(40-X under the root sign? Divided by 2)? +(2X)? =5?
You should be able to solve this problem by yourself.
Then bring it in and work out AB by Pythagorean theorem.
I gave you the steps, and you have to pass on other formulas.