I think the figure is causing some confusion. First, you have two pouints both lanbeled 'D', and second it's not clear what the 4 cm length applies to. I believe that a corrected version of this figure is per the attached - note that I renamed the right hand D' as D' and that the 4cm length applies to the distance from D to D'. Finding length AB is now a simple use of Pythagoras: its the hypotenuse given two two legs of a right riangle with height 3+1= 4 cm and width 4 cm. That gives you AB = sqrt(4^2 + 4^2) = 4 sqrt(2).
The error you made are in here:
This should be
How did you get this? It dies not come from the previous equation at all - what happened to the 'x' variable?
BTW, the error in your LaTex expressions is that you have to use [/tex] to close it, not [\tex].