# Contradictory results from using orthogonality when solving an ODE with Fourier series.

I am trying to solve the following ordinary differential equation by assuming that the function $$f(x)$$ is in the form of a Fourier series, in the bounds $$-L < x < L$$.

$$\frac{\mathrm{d}f}{\mathrm{d}x} = f(x) \qquad f(x) = \frac{A_0}{2} + \sum_{n=1}^\infty \left[A_n\cos\left(\frac{n\pi x}{L}\right) + B_n\sin\left(\frac{n\pi x}{L}\right)\right]$$

My solution involves first determining the derivative $$\frac{\mathrm{d}f}{\mathrm{d}x}$$ from the assumed Fourier series form of the solution and then substituting into the original equation.

$$\frac{\pi}{L}\sum_{n=1}^\infty n\left[-A_n\sin\left(\frac{n\pi x}{L}\right) + B_n\cos\left(\frac{n\pi x}{L}\right)\right] = \frac{A_0}{2} + \sum_{n=1}^\infty \left[A_n\cos\left(\frac{n\pi x}{L}\right) + B_n\sin\left(\frac{n\pi x}{L}\right)\right]$$

From here I apply orthogonality with $$\cos\left(\frac{n\pi x}{L}\right)$$ and $$\sin\left(\frac{n\pi x}{L}\right)$$ with weight function $$r(x) = 1$$ between $$-L < x < L$$, the necessary integral solutions shown below.

$$\int_{-L}^L\!\cos\left(\frac{n\pi x}{L}\right)\cos\left(\frac{m\pi x}{L}\right)\,\mathrm{d}x = \delta_{nm}L \qquad \int_{-L}^L\!\sin\left(\frac{n\pi x}{L}\right)\sin\left(\frac{m\pi x}{L}\right)\,\mathrm{d}x = \delta_{nm}L$$ $$\int_{-L}^L\!\sin\left(\frac{n\pi x}{L}\right)\cos\left(\frac{m\pi x}{L}\right)\,\mathrm{d}x = 0 \qquad \int_{-L}^L\!\cos\left(\frac{n\pi x}{L}\right)\sin\left(\frac{m\pi x}{L}\right)\,\mathrm{d}x = 0$$ $$\int_{-L}^L\!\cos\left(\frac{n\pi x}{L}\right)\,\mathrm{d}x = 0 \qquad \int_{-L}^L\!\sin\left(\frac{n\pi x}{L}\right)\,\mathrm{d}x = 0$$ Applying these orthogonality conditions to the original equation $$\text{orthogonality with} \quad \cos\left(\frac{n\pi x}{L}\right), \quad \frac{\pi}{L}\sum_{n=1}^\infty n\left[0 + L\delta_{nm}B_n\right] = 0 + \sum_{n=1}^\infty\left[L\delta_{nm}A_n + 0\right]$$ $$n\pi B_n = LA_n \qquad B_n = \frac{L}{n\pi}A_n$$ $$\text{orthogonality with} \quad \sin\left(\frac{n\pi x}{L}\right), \quad \frac{\pi}{L}\sum_{n=1}^\infty n\left[-L\delta_{nm}A_n + 0\right] = 0 + \sum_{n=1}^\infty\left[0 + L\delta_{nm}B_n\right]$$ $$-n\pi A_n = LB_n \qquad B_n = -\frac{n \pi}{L}A_n$$

These results are contradictory, or to be more specific orthogonality with the cosine seems to give an incorrect result, since derivation of the Fourier series coefficients for the solution to this differential equation, $$f(x) = Ae^x$$, shows that $$B_n = -\frac{n \pi}{L}A_n$$. Have I made a mistake in my working or am I not understanding something about orthogonality?

I may have made some mistakes in typing this up, I have double checked everything but I cannot be sure. I have however done this derivation through many times with pen and paper and always come to these contradictory results.

• Why do you even think that you are allowed to differentiate term-by-term your series? Feb 23, 2022 at 1:35
• I do not understand why that would not be allowed. Feb 23, 2022 at 8:24
• Here is an easy explanation why it would not work. First, you also missed the condition that everything must be orthogonal to a constant. So, integrating your second line from $-L$ to $L$ you will find that $A_0=0$, which is nonsense since for the exponential function on any interval $A_0\neq 0$. The actual reason that you cannot differentiate is that your Fourier series is written not for given function $f$ but for its periodic extension, and any periodic extension of $\exp$ is discontinuous at the points $-L, L$, so you are not allowed differentiate Fourier series. Feb 23, 2022 at 15:13

What you've written is correct, but by assuming a Fourier series expansion you are assuming that your solution is periodic, and that it is differentiable and so will be continuous at the boundaries of your intervals. Hence you are solving $$\frac{df}{dx} = f, f(-L) = f(L)$$ which has the unique solution $$f = 0$$ (notice that you didn't impose any boundary conditions in your working). When you find the Fourier series for $$e^x$$, the derivative series will diverge at the boundaries of the intervals in order to accommodate the discontinuity.