Observe that ∏j=1naj=1. Hence by dividing by this product, we may write
f(x)−g(y)=j=1∏nx−αjy+βj.
We observe that
j=1∏n(x−αjy)=xn−yn=j=1∏n(x−wjy),
where w is the primitive d-th root of unity. Hence, after renumbering if necessary, we may write αj=wj, 1≤j≤n. Thus we have
f(x)−g(y)=j=1∏n(x−wjy+βj).
Define
a=w−1β1−wβn,b=w−1β1−βn.
Consider F(x)=f(x+a), G(y)=g(y+b). It is easy to check that
F(x)−G(y)=(x−y)(x−wy)j=2∏n−1(x−wjy+γj),
where γj=βj+a−wjb, 2≤j≤n−1. Putting y=x, we see that F(x)=G(x). Putting x=wy, we also see that F(wy)=G(y)=F(y). Thus whenever α is a root of F(x)=0, so is wα. Thus F(y)=0 has roots α,wα,…,wn−1α. We thus obtain
F(y)=G(y)=(y−α)(y−wα)⋯(y−wn−1α)=yn−αn.
This gives
f(x)=F(x−a)=(x−a)n−αn,g(y)=(y−b)n−αn.