Heat equation with initial values $U(0,t)=U_1$, $U(L,t)=U_2$,$\forall t$. My problem is given as
Arbitrary temperatures at ends . If the ends $x=0$
and $x=L$ of the bar in the text are kept at constant
temperatures $U_1$ and $U_2$ respectively, what is the temperature
$u_1(x)$ in the bar after a long time (theoretically,
as $t \to \infty$)? First guess, then calculate.
My guess is that the temperature after a very long time is given as the meadian temperature. Etc 
$$u(x,t) \approx (U_2-U_1)/L, \quad \text{as} \quad t\to \infty$$
Now one does assume that the temperature reaches a limit, which is not
unlikely, then the solution will satisfy the laplacian $\nabla^2u=0$.
Which leads to the heat equation in one variable 
$$ \frac{\mathrm{d}u}{\mathrm{d}t} = c^2 \frac{\mathrm{d}^2u}{\mathrm{d}x^2} $$
The standard way of assuming the solution is on the form $u(x,t)=X(x)T(t)$ fails for me.Begin with assuimg that the differential equation is equal to some arbitary constant $\lambda$ that is not dependant on $x$ nor $t$. Then I end up with the set of equations 
$$\begin{array}{lcr}
T' & = & \lambda c^2 T\\
\ddot{X} & = & \lambda X  
\end{array}$$
If we assume for a minute that $\lambda=0$, we end up with
$$X(x) = Ax + B, \qquad T(t)=C$$
Which does not satifsy the initial values. So, what do I do to solve this bugger?
 A: Let $u(x,t)=X(x)T(t)$ ,
Then $X(x)T'(t)=c^2X''(x)T(t)$
$\dfrac{T'(t)}{c^2T(t)}=\dfrac{X''(x)}{X(x)}=-\dfrac{\pi^2s^2}{L^2}$
$\begin{cases}\dfrac{T'(t)}{T(t)}=-\dfrac{\pi^2c^2s^2}{L^2}\\X''(x)+\dfrac{\pi^2s^2}{L^2}X(x)=0\end{cases}$
$\begin{cases}T(t)=c_3(s)e^{-\frac{\pi^2c^2ts^2}{L^2}}\\X(x)=\begin{cases}c_1(s)\sin\dfrac{\pi xs}{L}+c_2(s)\cos\dfrac{\pi xs}{L}&\text{when}~s\neq0\\c_1x+c_2&\text{when}~s=0\end{cases}\end{cases}$
$\therefore u(x,t)=C_1x+C_2+\sum\limits_{s=0}^\infty C_3(s)e^{-\frac{\pi^2c^2ts^2}{L^2}}\sin\dfrac{\pi xs}{L}+\sum\limits_{s=0}^\infty C_4(s)e^{-\frac{\pi^2c^2ts^2}{L^2}}\cos\dfrac{\pi xs}{L}$
$u(0,t)=U_1$ :
$C_2+\sum\limits_{s=0}^\infty C_4(s)e^{-\frac{\pi^2c^2ts^2}{L^2}}=U_1$
$\sum\limits_{s=0}^\infty C_4(s)e^{-\frac{\pi^2c^2ts^2}{L^2}}=U_1-C_2$
$C_4(s)=\begin{cases}U_1-C_2&\text{when}~s=0\\0&\text{when}~s\neq0\end{cases}$
$\therefore u(x,t)=C_1x+C_2+\sum\limits_{s=0}^\infty C_3(s)e^{-\frac{\pi^2c^2ts^2}{L^2}}\sin\dfrac{\pi xs}{L}+U_1-C_2=C_1x+U_1+\sum\limits_{s=1}^\infty C_3(s)e^{-\frac{\pi^2c^2ts^2}{L^2}}\sin\dfrac{\pi xs}{L}$
$u(L,t)=U_2$ :
$C_1L+U_1=U_2$
$C_1=\dfrac{U_2-U_1}{L}$
$\therefore u(x,t)=\dfrac{(U_2-U_1)x}{L}+U_1+\sum\limits_{s=1}^\infty C_3(s)e^{-\frac{\pi^2c^2ts^2}{L^2}}\sin\dfrac{\pi xs}{L}$
Hence $u(x,\infty)=\dfrac{(U_2-U_1)x}{L}+U_1$
