There is a correction in the question it is actually x + y that we need to find out because if we try to find out x-y the x-y term cancels, it becomes impossible to do the problem
So the actual question to find out should be x + y .
x² + xy + x = 12 ----( 1 )
y² + xy + y = 18 ----( 2 )
add equations ( 1 ) and ( 2 ) , we get
x² + 2xy + y² + x + y = 30
( x + y )² + ( x + y ) - 30 = 0
( x + y )² + 6( x + y ) - 5( x + y ) - 30 = 0
( x + y ) [ x + y + 6 ] - 5 ( x + y + 6 ) = 0
( x + y + 6 ) ( x + y - 5 ) = 0
Therefore ,
x + y + 6 = 0 or x + y - 5 = 0
x + y = -6 or x + y = 5