Answer:
They have to be similar because careful inspection will show all of their angles (the two triangles) are equal.
One can start with the fact that the two triangles have a common angle.
CAll it x.
x * 40 + q = 180
x + 50 + r = 180
q and r must equal 50 and 40 to satisfy the sum of the interior angles must sum to 180.