Consider the following pde:
$U_{tt}-c^2U_{xx}=0$ with boundary conditions $U_{x}=0$ at $x=0$ and $x=\pi$ For initial conditions, $u(x,0)=1$ if $x<\frac{\pi}{2}$ and $0$ if $x>\frac{\pi}{2}$ and $U_{t}(x,0)$ $=$ $0$
Find the solution $U(x,t)$ for $t>0$
My attempt: After doing all the initial conditions and finding a general solution, I got
$\sum_{n=1}A_ncos(nx)=1$ so I multiply both sides by $cos(mx)$ and get $\sum_{n=1}A_ncos(nx)cos(mx)=cos(mx)$
then I integrate both sides by $x=0$ to $\pi$, the limits of the integral are not correct, may someone please tell me why?