# How to approximate identity function using Fourier sine series

I want to approximate identity function $$g(x) = x$$ for $$x \in [0,x_c]$$ with $$x_c<\pi/2$$ by finite (sum) Fourier sine series $$f(x)$$. $$f(x) is required for $$x \in [0,\pi]$$, $$f(x)$$ is assumed to be a $$2\pi$$-periodic function (that is, we can know everything about $$f(x)$$ by looking at its values for $$x \in [-\pi,\pi]$$), and approximation needs to be close within precision of $$k$$ fractional digits in binary or decimal for $$x\in [0,x_c]$$. $$k$$ is not fixed.

The question is, how many sine terms would be required to satisfy this, in function of $$k$$ (and $$x_c$$)?

• Perhaps infinetely many, if you take Gibbs phenomenon into account ... en.wikipedia.org/wiki/Gibbs_phenomenon – denklo Jan 11 at 9:28
• Is gibbq phenomen relevant? We have a continuouq function here. – Math_QED Jan 11 at 9:50
• I don't know, like this is not about approximating g(x)=x exactly for $x \in [-\pi,\pi]$, which would run into Gibbs phenomenon problems. But it only asks to approximate precisely identity function for $x \in [0,x_c]$ and one is free to do whatever for other values of $x$ as long as $f(x)<x_c$, so that gives some freedom. – Sayako Nama Jan 11 at 9:58
• @SayakoNama Ok, no worries then :) – denklo Jan 11 at 9:59
• Well, one way to re-phrase the question is, is there a better way to approximate a sawtooth function if we can afford to allow for some deviations from the sawtooth function for $x \in [x_c,\pi]$... The Fourier series of sawtooth function tries to exactly become a sawtooth function for $x\in [-\pi,\pi]$, which is rendered impossible unless infinite sums are made. – Sayako Nama Jan 11 at 10:03