The length of line segment AB is equal to 4 units.
How to find the missing side of a triangle
In this problem we need to determine the length of side AB in a system of two right triangles, which satisfy the following condition:
. Then, by SAS theorem, triangles ABD and BCD are congruent, which means that sides AB and BC are also congruent:

Then, by definition of congruence we obtain the exact value of x:
AB = BC
2 · x = 5 · x - 6
3 · x = 6
x = 2
And the length of line segment AB:
AB = 2 · 2
AB = 4
Line segment AB has a length of 4 units.