Label the common vertical height of all three triangles as $h$ and the distance from the right angle to angle $x$ as $b$.

The large triangle is a 30-60-90 triangle. As such, $h\sqrt{3} = b+2 \implies h = \dfrac{b+2}{\sqrt{3}}$

For the medium triangle, $h=(b+1)\tan(40)$

Using these two equations, one can solve for $b$, and then determine a value for $h$.

Finally, using the small triangle, $\tan{x} = \dfrac{h}{b} \implies x = \arctan\left(\dfrac{b}{h}\right)$