Let $D=\{z\in\mathbb C:|z|<1\}\subset\mathbb C$. Does there exist an nonconstant analytic function $g:D\to\mathbb C$ satisfying $$g\bigg(\frac1n\bigg)=g^2\bigg(-\frac{1}n\bigg), \,\,\,\,\,\text{for every integer $n$ greater than 1?} $$
Here is what I have done:
I am assuming the answer is no, so suppose, for the sake of contradiction, that such $g$ exists. Consider the sequence $(1/2,1/3,1/4,\dots)$ who's terms are all in $D$. This sequence is convergent to $0$. Define a function $h(z)=g(z)-g^2(-z)$, which is analytic. We see that $$ h(1/2)=h(1/3)=h(1/4)=\dots=0, $$ From the Identity Theorem, $h$ is zero everywhere on $D$. So I conclude that $g(z)=g^2(-z)$ everywhere. What must I do from here? Thanks.
Clearly, constant $g\equiv 0$ or $g\equiv 1$ both satisfy this relation.
Assume $g$ is not constant.
If $g(z)=g^2(-z)$, then $g(0)=g^2(0)$, and hence $g(0)=0$ or $1$.
A. If $g(0)=0$, then $g(z)=z^kf(z)$, for some positive integer $k$ and $f$ analytic in the unit disk, with $f(0)=a\ne 0$. In such case we have $$ n^{-k}f(1/n)=g(1/n)=g^2(-1/n)=n^{-2k}f^2(-1/n) $$ and hence $$ f(1/n)=n^{-k}f^2(-1/n) $$ Impossible, since $f(1/n)\to a\ne 0$, while $n^{-k}f^2(-1/n)\to 0$, as $n\to\infty$.
B. If $g(0)=1$, then $g(z)=1+z^kf(z)$, where $f$ analytic in the unit disk and $f(0)=a\ne 0$, in which case $$ 1+n^{-k}f(1/n)=g(1/n)=g^2(-1/z) =\big(1+(-n)^{-k}f(-1/n)\big)^2=\\=1+2(-n)^{-k}f(-1/n)+n^{-2k}f^2(-1/n) $$ and hence $$ f(1/n)=2(-1)^kf(-1/n)+n^{-k}f^2(-1/n) $$ which, as $n\to\infty$, tends to $$ a=2(-1)^ka. $$ Contradiction.
Hence, only a constant $g\equiv 0$ or $g\equiv 1$ could satisfy $g(1/n)=g^2(-1/n)$, for all $n>1$.