# Getting zero as solution to the 1D wave equation

I was solving an example of 1D wave equation with given BC and IC by separation of variables and Fourier series. $$\frac{\partial^2u}{\partial t^2}=c^2\frac{\partial^2u}{\partial x^2}$$ $$BC: u(0,t)=u(l,t)=0$$ $$IC:u(x,0)=\sin\left(\frac{\pi}{l} x\right)$$$$\partial_tu(x,0)=0$$ By separating the variables and solving the eigenvalue problem with the BC and solving the time ODE I get the general solution for u(x,t). $$u(x,t)=\sum_{n=1}^\infty\left[A_n \cos(\omega_nt)\sin\left(\frac{n\pi}{l}x\right)+B_n\sin(\omega_nt)\sin\left(\frac{n\pi}{l}x\right)\right]$$ Taking the derivative $$\frac{\partial u} {\partial t}=\sum_{n=1}^\infty\left[-\omega_nA_n \sin\left(\omega_nt\right)\sin\left(\frac{n\pi}{l}x\right)+\omega_nB_n\cos(\omega_nt)\sin\left(\frac{n\pi}{l}x\right)\right]$$ and applying the IC I got $$\partial_tu(x,0)=0=\sum_{n=1}^\infty\omega_nB_n\sin\left(\frac{n\pi}{l}x\right) \longrightarrow B_n=0$$ since the integral is 0. Applying the other IC: $$u(x,0)=\sin\left(\frac{\pi}{l} x\right)=\sum_{n=1}^\infty A_n \sin\left(\frac{n\pi}{l}x\right)$$ Finding the Fourier coefficient(used wolframalpha to solve the integral) I get: $$A_n=\frac{2\sin(n\pi)}{\pi(n^2-1)}$$ And since $$\sin(n\pi)=0$$ for every integer $$n$$ my solution becomes $$u(x,t)=0$$ Am I missing something? Or what does the answer physically mean? There are no modes?

• I've removed a number of comments that were attempting to answer the question and/or responses to them. Please keep in mind that comments should be used for suggesting improvements and requesting clarification on the question, not for answering. – David Z Jul 2 at 20:46

Wolframalpha is likely the source of confusion here: the initial condition is the term with $$n=1$$, i.e. $$A_1 = 1$$, whereas all others are $$A_n=0$$. The equation for the initial condition is one equation with the infinite number of unknowns in the rhs - no surprise that an automatic routine gives an irrelevant answer there.
• Ooh! I don't have to expand for the coefficient since the IC is already expanded in the basis I am using for expansion. So I don't need to solve the integral at all. Since all coefficients are 0 except for n=1 my solution is $$u(x,t)=cos(\omega_1t)sin(\frac {\pi x}{l})$$. Is this correct? Meaning I have one mode. – Ognyan Petkov Jul 2 at 11:04
Your solution $$A_n$$ isn't zero for every $$n$$. Looking at your initial conditions you might expect there to be only one non-zero coefficient since the IC already have the form of a sine wave. When $$n=1$$ you get $$\frac 0 0$$ so you have to be extra careful. Evaluating your solution for $$A_n$$ as a limit: $$\lim_{n\rightarrow 1}\frac{2\sin n\pi}{\pi(n^2-1)}=-1$$ I suspect there is an error in the integral because the answer should be +1. Alternatively you could immediately see from $$\sin\left(\frac \pi l x\right)=\sum_{n=1}^\infty A_n \sin\left(\frac {n\pi} l x\right)$$ that $$A_n=\cases{1&n=1\\0 &n\neq 1}$$