If f(x) has period p then f(x+p)-g(x+p)=0 for all x+p>x>N.
Now, f(x)-g(x)=0=f(x+p)-g(x+p) for all x+p>x>N.
Hence f(x)-f(x+p)-g(x)=-g(x+p) for all x+p>x>N.
But f(x)=f(x+p) as p is a period of f(x); therefore, -g(x)=-g(x+p) i.e. g(x)=g(x+p) for all x+p>x>N.
All x+p>x>N includes all (x+(m/q)b)+p>x>N where (m/q) is any rational number and b is the base period of g(x).Therefore, p must be a period of the periodic function g(x).
Now, for any integer k such that (x-kp)<N i.e. k>((x-N)/p), f(x)=f(x-kp) and g(x)=g(x-kp) [as p is a period of both f(x) and g(x)].
Therefore, 0=f(x)-g(x)=f(x-kp)-g(x-kp) for all x>N, i.e. for all (x-kp)<N.
Therefore, f(x-kp)-g(x-kp)=0 for all x>N, i.e. for all (x-kp)<N; and f(x)-g(x)=0 for all x>N.
Note that the same logic follows if k is replaced by some integer z such that (x-z)<<N i.e. z>>((x-N)/p) [just to reaffirm that this proof holds for x approaching -infinity aswell].
Therefore, f(x)=g(x) for all x.
Finally, as f(x) and g(x) have the same domain, -infinity<x<+infinity, and as f(x) and g(x) also have the same values at each x in their domain, i.e. f(x)=g(x) for all x in -infinity<x<+infinity, it must be true that f(x):=g(x). /QED
Is my proof faulty because I didn't prove f(N)=g(N) so I didn't really prove f(x)=g(x) for ALL x? Could I fix this by defining k as any integer such that k>or=((x-N)/p)?
Thanks for reading