That formula was given by my teacher after forming the formula for u(x,t)
An= Fourier Coefficient of f
(\frac{n*pi*a}{l})*b2=Fourier Coefficient of g
The u(x,t) formula is
\sum(An*cos\frac{npiat}{l}+Bn*sin\frac{npiat}{l})*sin\frac{npix}{L}
where a infinite series is not needed for this...