Let x and y be the 2 numbers were looking for.
In the given , we know that
x+y = 18
x^2 + y^2 = 170
First we have to find something to substitute to either x and y to make one variable solvable
lets use x to sub
x= 18 - y
(18 - y)^2 + y^2 = 170
324 - 36y + y^2 + y^2 = 170
162 - 18y + y^2 = 85
y^2 - 18y + 77 = 0
(y - 11)(y - 7) = 0
y = 11
y = 7
then look for values of x with the value you got on y
x + 11 = 18
x= 7
x+ 7 = 18
x= 11 (Just the same as y)
so the answers will be 7 and 11