Elias is 6 years older than Marcos
This can be interpreted as: e = m + 6
Together they are 42 years old
This can be interpreted as: e + m = 42
The answer is
e = m + 6
e + m = 42
Solving the equations, we have
e = m + 6
e + m = 42
Substitute e = m + 6 into the second equation
m + 6 + m = 42
2m + 6 = 42
2m=42-6
2m = 36
m=36/2
m=18
Substitute m = 18 into the first equation
e = m + 6
e = 18 + 6
e = 24