设x^2+px+q=0的两根为x1,x2,
x^2+qx+p=0的两根为x3,x4,
由韦达定理:x1+x2=-p, x1*x2=q
x3+x4=-q,x3*x4=p
又∵x1-x2=x3-x4
(x1-x2)2=(x3-x4)2
(x1+x2)2-4x1*x2=(x3+x4)2-4x3*x4
p2-4q=q2-4p
(p-q)(p+q+4)=0
p+q=0或p+q= -4
设x^2+px+q=0的两根为x1,x2,
x^2+qx+p=0的两根为x3,x4,
由韦达定理:x1+x2=-p, x1*x2=q
x3+x4=-q,x3*x4=p
又∵x1-x2=x3-x4
(x1-x2)2=(x3-x4)2
(x1+x2)2-4x1*x2=(x3+x4)2-4x3*x4
p2-4q=q2-4p
(p-q)(p+q+4)=0
p+q=0或p+q= -4