heat equation with fourier series Original PDE
$$T_t=\alpha T_{xx}$$
I need to solve this equation numerically and analytically and compared them. I've already done the numerical part. But I need to solve it analytically now. 
Given the initial condition
$$T(x,0)=sin(\frac{\pi x}{L})$$
where $$L=1$$
I would like to find the exact solution of the heat equation.
I know what $$T(x,t)=\sum_{n=1}^{\infty}B_n sin(n\pi x)e^{-n^2\pi^2\alpha t}\\where\\B_n=2\int_0^1T(x,0)sin(n\pi x)dx$$
After evaluating this integral, I get the solution as
$$T(x,t)=\sum_{n=1}^{\infty}\frac{2sin(n\pi)}{(1-n^2)\pi} sin(n\pi x)e^{-n^2\pi^2\alpha t}$$
I think I've done something wrong here because $$n=1^{th}$$ term is not defined. Can someone point out my mistake if there is? Thank you!
Corrected
Bn is nonzero only at n=1. Evaluating the case for n=1, Bn=1
So the solution is 
$$T(x,t)=sin(\pi x)e^{-\pi^2\alpha t}$$
Thanks to Leucippus and AlexZorn for the correction.
 A: Two comments.
First, you're integral computation looks something like this:
$$2\int_0^1\sin(\pi x)\sin(n\pi x)\, dx = \int_0^1 \cos((n - 1)\pi x) - \cos((n+1)\pi x)\, dx$$
Now, it's tempting to write:
$$\int \cos((n-1)\pi x)\, dx = \frac{\sin((n-1)\pi x)}{\pi(n-1)} + C$$
But of course this is not true when $n = 1$. Hence your mistake.
The second comment is that you can actually solve for the coefficients "by inspection", without having to compute any integrals. Specifically, we have:
$$T(x,t) = \sum_{n = 1}^{\infty} B_n \sin(n \pi x)e^{-n^2\pi^2 \alpha t}$$
So:
$$T(x,0) = \sum_{n = 1}^{\infty} B_n \sin(n \pi x) = B_1\sin(\pi x) + B_2 \sin(2\pi x) + \cdots$$
And also $T(x,0) = \sin(\pi x)$. It should be clear from this that $B_1 = 1$ and the rest of the $B_n$ are zero.
A: Given the pde $u_{t} = \alpha u_{xx}$, $u(0,t) = u(L,t) = 0$ and $u(x,0) = \sin\left(\frac{\pi x}{L} \right)$ : the equation can be separated by use of $u(x,t) = F(t) G(t)$ and leads to the equations 
\begin{align}
F' + \lambda^{2} \alpha F &= 0 \\
G'' + \lambda^{2} G &= 0
\end{align}
which have solutions
\begin{align}
F(t) &= e^{- \lambda^{2} \alpha t} \\
G(x) &= A \cos(\lambda x) + B \sin(\lambda x).
\end{align}
Now applying the boundary conditions it is seen that the general solution is
\begin{align}
u(x,t) = \sum_{n=1}^{\infty} B_{n} \, \sin\left( \frac{n \pi x}{L} \right) \, e^{- \frac{n^{2} \pi^{2} \alpha t}{L^{2}}}.
\end{align}
Applying the initial condition yields
\begin{align}
\sin\left(\frac{\pi x}{L} \right) = \sum_{n=1}^{\infty} B_{n} \, \sin\left( \frac{n \pi x}{L} \right).
\end{align}
This is a Fourier series for which the coefficients are given by
\begin{align}
B_{n} = \frac{2}{L} \, \int_{0}^{L} \sin\left(\frac{\pi x}{L} \right) \, \sin\left( \frac{n \pi x}{L} \right) \, dx.
\end{align} 
For the case $n= 1$ it is seen that
\begin{align}
B_{1} = \frac{2}{L} \int_{0}^{L} \sin^{2}\left( \frac{\pi x}{L} \right) \, dx = 1
\end{align}
whereas for $n \geq 2$ 
\begin{align}
B_{n} = \frac{1}{2 \pi} \, \frac{\sin(n \pi) }{1 - n^{2}} = 0
\end{align}
since $n$ is an integer. The solution for $u$ is now
\begin{align}
u(x,t) = \sin\left( \frac{\pi x}{L} \right) \, e^{- \frac{\pi^{2} \alpha t}{L}}.
\end{align}
