We have,
x2+ax+b=0......(1)
x2+bx+a=0......(2)
Subtract (1) from (2) and we get,
x(a−b)+(b−a)=0
x(a−b)=−(b−a)
x(a−b)=(a−b)
x=1
Put the value of x in equation (1) and we get,
1+a+b=0
a+b=−1