By defining a simple system of equations we can see taht x = 4.
How to find the value of x?
Notice that the angle in the left vertex is common for both triangles, let's say that the angle is a.
For the left triangle (smaller one) x is the hypotenuse, so we can use the relation:
cos(a) = 2/x
For the larger triangle, the hypotenuse is (2 + 6) = 8 and x is the adjacent cathetus to the angle a, so we can write:
cos(a) = x/8
The cos(a) is equal in both equations, then we can write:
2/x = x/8
Solving for x:
2/x = x/8
2*8 = x*x
16 = x²
√16 = x
4 = x