Setting y=0 in the condition (f(x−y)−f(0))f(x)f(y)=0,
we get (f(x)−f(0))f(x)=0, for all x..... (since f(0)≠0).
Thus either f(x)=0 or f(x)=f(0), for all x∈Z.
Now taking x=y=0 in f(xy)+f(x)f(y)=f(x)+f(y), we see that f(0)+f(0)2=2f(0). This shows that f(0)=0 or f(0)=1. Since f(0)≠0, we must have f(0)=1. We conclude that either f(x)=0 or f(x)=1 for each x∈Z.
This shows that the set of all possible value of f(x) is {0,1}. This completes (a).
Let S={n∈Z|f(n)≠0}. Hence we must have S={n∈Z|f(n)=1} by (a). Since f(1)=0, 1 is not in S.
And f(0)=1 implies that 0∈S.
Take any x∈Z and y∈S. Using (f(x−y)−f(0))f(x)f(y)=0.
We get, f(xy)+f(x)=f(x)+1.
This shows that xy∈S. If x∈Z and y∈Z are such that xy∈S,
then (f(x−y)−f(0))f(x)f(y)=0 gives 1+f(x)f(y)=f(x)+f(y).
Thus (f(x)−1)(f(y)−1)=0.
It follows that f(x)=1 or f(y)=1; i.e., either x∈S or y∈S.
We also observe from (f(x−y)−f(0))f(x)f(y)=0 that x∈Sandy∈S implies that f(x−y)=1 so that x−y∈S.
Thus S has the properties:
(A) x∈Zandy∈S implies xy∈S;
(B) x,y∈Zandxy∈S implies x∈S or y∈S;
(C) x,y,∈S implies x−y∈S.
Now we know that f(10)≠0andf(2)=0.
∴f(10)=1 and 10∈S; and 2∉S.
Writing 10=2×5 and using (B),
We get 5∈S and f(5)=1. Hence f(5k)=1 for all k∈Z by (A).
Suppose f(5k+1)=1 for some l,1≤l≤4. Then 5k+l∈S. Choose u∈Z such that lu≡1 (mod 5). We have (5k+l)u∈S by (A).
Moreover, lu=1+5m for some m∈Z and
(5k+l)u=5ku+lu=5ku+5m+1=5(ku+m)+1.
This shows that 5(ku+m)+1∈S. However, we know that 5(ku+m)∈S.
By (C), 1∈S which is a contradiction. We conclude that 5k+l∉S for any l,1≤l≤4.
Thus S={5k|k∈Z}.