We have 2 numbers. We can call them x and y, being x the smaller one.
The sum of this two numbers is 40, so we can write:

We know that if 2 is added to the larger number (that we name as y), the result is twice the smaller number, that would be 2x. Then, we can express this as:

We can express y in function of x from the second equation and then replace it in the first equation to solve for x:


Now, we can calculate y as:

Answer: the two numbers are 14 and 26.