Taylor and Fourier series are the same

A Taylor series is $$f(x)=c_0+c_1x+c_2x^2+c_3x^3+\cdots$$ A Fourier series is $$g(\theta)=c_0+c_1\exp(i\theta)+c_2\exp(2i\theta)+c_3\exp(3i\theta)+\cdots$$ When $x$ and $\theta$ are real numbers, these representations look very different. The Taylor series represents a function as a sum of polynomials, and the Fourier series represents a periodic function as a sum of sinusoidal waves.

However, in complex numbers they are the same thing: $$f(z)=c_0+c_1z+c_2z^2+c_3z^3+\cdots$$ If we restrict the complex variable $z$ to the real axis $z=x$ we obtain the Taylor series of the function $f(x)$. If we restrict the complex variable $z$ to the unit circle $z=e^{i\theta}$ we obtain the Fourier series of the function $g(\theta)=f(e^{i\theta})$. Thus, real Taylor and Fourier series are particular cases of complex Taylor series.

An interesting relationship between the coefficients can be obtained from this observation. Recall that the coefficients of the real Taylor series are computed by differentiating $n$ times the function $f(x)$ at the point $x=0$: $$c_n=\frac{f^{(n)}(0)}{n!}$$ And the coefficients of the Fourier series are computed by integrating the function $g(\theta)$ multiplied by a sinusoidal wave that oscillates $n$ times: $$c_n=\frac{1}{2\pi}\int_0^{2\pi}g(\theta)e^{-ni\theta}\mathrm{d}\theta.$$ Now, they must be equal, so we obtain the following relation: $$\frac{f^{(n)}(0)}{n!}=\frac{1}{2\pi}\int_0^{2\pi}g(\theta)e^{-ni\theta}\mathrm{d}\theta$$ This formula is very interesting; it says that we can compute $n$-th derivatives by integrating!

The formula above is typically written as a complex path integral. For that, do the change of variable $z=e^{i\theta}$: $$z=e^{i\theta}$$ $$\mathrm{d}z=ie^{i\theta}\mathrm{d}\theta$$ $$\frac{1}{iz}\mathrm{d}z=\mathrm{d}\theta$$ $$\frac{1}{2\pi}\int_0^{2\pi}f(e^i\theta)e^{-ni\theta}\mathrm{d}\theta=\frac{1}{2\pi i}\oint\frac{f(z)}{z^{n+1}}\mathrm{d} z$$ thus $$f^{(n)}(0)=\frac{n!}{2\pi i}\oint\frac{f(z)}{z^{n+1}}\mathrm{d} z$$ which is named Cauchy integral formula.

All these correspondences may be surprising. They combine local properties (derivatives) with global properties (integrals over arbitray circles). There is nothing strange going on. The complex functions $f(z)$ for which these relations hold are highly restricted objects: analytic functions. For example, the real and imaginary components and $f$ are harmonic functions which satisfy the maximum principle: the extrema over any domain are attained at the boundaries of that domain.