# Solution of a partial differential heat equation with derivative and boundary conditions

I want to solve the following partial different equation.

Find $u(x, t)$, satisfying $u_t = u_{xx}$ , $u(x, 0) = x − x^2$ , $u(0, t) = T_0$ , $u_x (1, t) = 0$ and $|u|$ is bounded.

Using separation of variables, and eliminating solutions that diverge with time, one gets

$$u(x,t)~=~e^{ -\lambda^2t}(A \cos(\lambda x)+B\sin(\lambda x)).$$

How do I proceed after this? The condition $u_x (1, t) = 0$ gives $A=-B \tan(\lambda )$ which is giving me a contradiction for the condition $u(0, t) = T_0$ , as you get

$$-e^{ \lambda^2}B\tan(\lambda)~=~T_0.$$

-
Wait, you need an initial condition, $u(x,t=0)$, where is it? It will be the temperature profile at initial time $u(x,t=0)=f(x)$. – DaniH Nov 17 '12 at 19:15
Also there must be an error in your $u(x,t)$ because it diverges as $t \rightarrow \infty$! – DaniH Nov 17 '12 at 19:25

The solution is not as simple as you wrote, it is a sum over discrete $\lambda_n$.
To get the right solution, you first introduce a shifted $u$: $u'=u-T_0$. For $u'$ you will get $B=0$ and an equation for finding the discrete spectrum of $\lambda$. Then you make a superposition with different $A_n$ and make it obey the initial condition. This permits to find the coefficients $A_n$ via the initial temperature profile.