Denote $f(x)$ the analytic continuation of $\sum_{n=0}^\infty \chi(n)x^n$, where $\chi$ denotes the Dirichlet character $\operatorname{mod} k(k>1)$. Show that $$f^2(x)=\ f^2\left(\frac1x\right).$$
Attempt
Knowing that $\chi$ has a period $k$, $$f(x)=\sum_{m=0}^\infty\sum_{n=0}^{k-1}\chi(n)x^{mk+n}\\
=\sum_{n=0}^{k-1}\sum_{m=0}^\infty\chi(n)x^{mk+n}\\
=\sum_{n=0}^{k-1}\chi(n)\frac{x^n}{1-x^k}$$
$$f\left(\frac1x\right)=\sum_{n=0}^{k-1}\chi(n)\frac{x^{-n}}{1-x^{-k}}\\=-\sum_{n=0}^{k-1}\chi(n)\frac{x^{k-n}}{1-x^{k}}$$