For x=y=z=0, we get f(0,0)=(f(0,0))2 and because of f(0,0)=0, we get that f(0,0)=1. For x=y=0 we get f(0,0)=(f(0,z))2, from where f(0,z)=±1, for every real number z. For x=0, we get ±1=±f(y,z), so f(y,z)=±1, for every real numbers y and z.
Let f(t,t)=−1, for some real number t, then for x=y=z=t we get that
f(−t,−t)=(−1)2=1, and this implies that for every real number t either
f(t,t)=1 or f(−t,−t)=1. Let t an arbitrary real number and let s be a real
number such that f(s,s)=1 and ∣s∣=t (such a number exists, because if
f(t,t)=−1, then for s=−t, f(s,s)=1). For x=z=t and y=−t we get
f(s,−sf(−s,s))=f(−s,s). If f(−s,s)=−1, then we get f(s,s)=−1, which is a
contradiction, so from here f(−s,s)=1 and f(s,−s)=f(−s,s)=1. If
f(−s,−s)=−1, for x=s and y=z=−s we get
f(s,s)=f(s,−s)f(−s,−s)=−1,
which is not possible (f(s,s)=1). This implies that for every real number t it
holds f(t,±t)=1.
If for some real numbers u and v, it holds f(u,v)=−1. For x=u and y=z=v, we get f(−u,v)=−1. For x=z=v и y=u we get f(v,−u)=−1. For x=z=−u and y=v, we get f(−u,−v)=−1. For x=−u and y=z=−v, we get f(u,−v)=−1. For x=v and y=z=−u we get f(−v,−u)=−1. For x=z=−v and y=−u we get f(−v,u)=−1 and for x=z=v and y=−u, we get f(v,u)=−1. This implies that for every real numbers u and v for which f(u,v)=−1, the following relationships hold
f(u,±v)=f(±u,v)=f(v,±u)=f(±v,u)=−1,
and if f(u,v)=1, the following relationships hold
f(u,±v)=f(±u,v)=f(v,±u)=f(±v,u)=1
(if one is −1, than from the first case it follows that all are −1). From here we have
f(xf(x,z),yf(y,z))=f(x,y), for every real numbers x,y and z, so
f(x,y)=f(x,z)f(y,z).
If f(a,b)=−1, then for an arbitrary real number z and x=a,y=b, we get
−1=f(a,z)f(b,z), so either f(a,z)=1 and f(b,z)=−1 or f(a,z)=−1 and
f(b,z)=1. If for some real numbers c and d, the equalities f(a,c)=−1 and
f(a,d)=1 hold for x=c,y=d and z=a we get
f(c,d)=f(c,a)f(d,a)=−1.
If f(a,c)=f(a,d)=1, for x=c,y=d and z=a we get
f(c,d)=f(c,a)f(d,a)=1 and if f(a,c)=f(a,d)=−1, then for x=c,y=d
and z=a we get f(c,d)=f(c,a)f(d,a)=1, i.e if f(a,c) and f(a,d) have the same sign, then f(c,d)=1, and if they have the opposite sign, then f(c,d)=−1.
Let for M⊆R+∪{0} hold M={x∣f(a,x)=1} and for N⊆R+∪{0}, hold N={x∣f(a,x)=−1}, then M∪N=R+∪{0} and f(x,y)=1 if and only if ∣x∣ and ∣y∣ belong to the same set, and f(x,y)=−1 if and only if ∣x∣ and ∣y∣ belong to different sets (if real numbers a and b such that f(a,b)=−1 don't exist, then the set N is empty and f(x,y)=1, for all real numbers).
Let M be an arbitrary subset of R+∪{0} and N=R+∪{0}∖M. We define a function f:R2→R, for which f(x,y)=1 if and only if ∣x∣ and ∣y∣ belong to the same set, and f(x,y)=−1 if and only if ∣x∣ and ∣y∣ belong to different sets. For the function f, holds f(xf(x,z),yf(y,z))=f(x,y) (the function does not depend on the sign before x and before y). If ∣x∣ and ∣y∣ are in the same set, then f(x,y)=1 and f(x,z)=f(y,z) (or ∣z∣ is in the same set with ∣x∣ and ∣y∣, or in the other), so the product f(x,z)f(y,z)=1=f(x,y). If ∣x∣ and ∣y∣ belong to different sets, then f(x,y)=−1, and ∣z∣ is either in the same set with ∣x∣ or with ∣y∣, so f(x,z)=−f(y,z), i.e. f(x,z)f(y,z)=−1=f(x,y). This implies that, the functions defined in this way satisfy the given functional equation and from the discussion above, they are unique.