Call the point (a,b) Q and the point (b,a) R. Let P be the point (x,y).
PQ^2=(x-a)^2+(y-b)^2=PR^2=(x-b)^2+(y-a)^2 (Pythagoras).
x^2-2ax+a^2+y^2-2by+b^2=x^2-2bx+b^2+y^2-2ay+a^2.
-2ax-2by=-2bx-2ay; ax+by=bx+ay; y(b-a)=x(b-a) so if b does not equal a, y=x is the equation of the locus, a straight line of gradient 1 passing through (0,0). (a,b) is the reflection of (b,a) where y=x is the "mirror". When a=b, Q and R are the same point on the line.