As for this problem, it is needed to come up with an equation to represent the situation.
In this case, the simplest one would be this:
x + y = 38
Let us establish that we need to solve for x first to get the y (no matter which you solve first, you get the second one by using the first one)
To do this, we substitute y with this equation:
x + 2 = y
Then, substitute y with the equation. It should look like this:
x + (x + 2) = 38
Now all you have to do is solve.
2x = 36
----------
2
x = 18
Then get they value of y
x + 2 = y
18 +2 = y
20 = y
So the answer for the ages of the daughters would be 18 and 20.
NOTE:
you can also use the equation
x - 2 = y instead of x + 2 = y
This will give you a value of 20 for x instead of 18 and 18 for y instead of 20. Either way, 18 and 20 will be the answer.