So I have this periodic signal x(t), $$x(t)=\begin{cases} 5t & \text{ if } x \in [0.2,0.4]\\ -10t & \text{ if } x \in [0.4,0.5] \\ 0 & \text{ if } x \in [0.5, 0.6] \end{cases}$$ and I was trying to calculate the regular Fourier Series coefficients.
One way to do it is by using the regular expression: $$a_n = \frac{1}{(b-a)}\int_{a}^{b}x(t)e^{-i2\pi/(b-a)nt}dt \ (1)$$
But I decided to try something different, namely using the derivative of x(t). So if we consider $$x(t)' = \begin{cases} 5 & \text{ if } x \in ]0.2,0.4[\\ -10 & \text{ if } x \in ]0.4,0.5[ \\ 0 & \text{ if } x \in ]0.5, 0.6[ \end{cases}=\sum_{n} b_ne^{-i2\pi/(b-a)nt}$$ we have:
$$\frac{\mathrm{d} }{\mathrm{d} t}(\sum_{n} a_ne^{-i2\pi/(b-a)nt})=\sum_{n} b_ne^{-i2\pi/(b-a)nt} \\ \Rightarrow b_n = [-i2\pi/(b-a)n]\cdot a_n \ (2)$$
The problem comes when I try to calculate $b_n$ using (1) and then with (2) retrieve $a_n$, as the $a_n$ calculated by this method doesn't coincide with the one directly calculated by (1).
Am I doing any supposition wrong? I'm guessing maybe the fact $x'(t)$ is not defined everywhere could be problematic? Any help is welcomed.