I have the following pde and boundary conditions I am trying to solve by separation of variables. I am doing something wrong with my formulation because my boundaries are incorrect when I plot my solution.

The Problem

$u$ is a function of space ($x$) and time ($t$).

$$\frac{\partial u}{\partial t} = k \frac{\partial^2 u}{\partial x^2}$$ $$s.t.$$ $$u(0,t) = f(t)$$ $$\frac{\partial}{\partial x}u(L,t) = 0$$ $$u(x,0) = C = constant$$

My Attempt

Using separation of variables, I arrive at:

$$u(x,t) = Ae^{-\lambda Kt}\cdot(c_1\cos(\sqrt{\lambda}x)+c_2\sin(\sqrt{\lambda}x))$$

Now satisfying the first boundary condition: $$u(0,t) = Ae^{-\lambda Kt}\cdot(c_1\cos(0)+c_2\sin(0))= Ae^{-\lambda Kt}\cdot c_1 = f(t)$$

$$c_1 = \frac{f(t)}{Ae^{-\lambda Kt}}$$

Now the second BC:

$$\frac{\partial}{\partial x}u(L,t) = Ae^{-\lambda Kt}\cdot \sqrt{\lambda}(-c_1\sin(\sqrt{\lambda}L)+c_2\cos(\sqrt{\lambda}L)) = 0$$

This is satisfied only when $$-c_1\sin(\sqrt{\lambda}L)+c_2\cos(\sqrt{\lambda}L) = 0$$

$$c_2 = \frac{f(t)}{Ae^{-\lambda Kt}}\tan(\sqrt{\lambda}L)$$

Final boundary condition:

$$u(x,0) = c_1\cos(\sqrt{\lambda}x)+c_2\sin(\sqrt{\lambda}x) = \frac{f(t)}{Ae^{-\lambda Kt}}\cos(\sqrt{\lambda}x)+\frac{f(t)}{Ae^{-\lambda Kt}}\tan(\sqrt{\lambda}L)\sin(\sqrt{\lambda}x)= C$$

$$\frac{f(t)}{Ae^{-\lambda Kt}}(\cos(\sqrt{\lambda}x)+\tan(\sqrt{\lambda}L)\sin(\sqrt{\lambda}x)) = C$$ $$A = \frac{f(t)}{Ce^{-\lambda Kt}}(\cos(\sqrt{\lambda}x)+\tan(\sqrt{\lambda}L)\sin(\sqrt{\lambda}x))$$

I am pretty stuck up to here. For one, I do not know what the eigenvalue $\lambda$ sould be ($= \frac{n\pi}{L}$?) and I do not know how if I did this right. If so, I would start by computing $A$ because it appears that $c_1$ and $c_2$ depend on $A$. Thanks in advance for any advice.


3 Answers 3


The point is that $u(x,t) = Ae^{-\lambda Kt}\cdot(c_1cos(\sqrt{\lambda}x)+c_2sin(\sqrt{\lambda}x))$ is a solution if and only if $A$, $c_1$ and $c_2$ are constant. When you impose that $u(0,t) = f(t)$ you find a $c_1$ which depends on t and this is not possible. If $c_1$ depends on t,$u(x,t) = Ae^{-\lambda Kt}\cdot(c_1cos(\sqrt{\lambda}x)+c_2sin(\sqrt{\lambda}x))$ is not a solution of your differential equation. You should look at a solution in the form

$u(x,t)=c_1(x) e^{t/k} (c_2(t) e^{x \sqrt{k}}+c_3(t) e^{-x \sqrt{k}})$.


I've noticed two mistakes. First one is that you have three constants, $A$, $c_1$, and $c_2$, plus $\lambda$, and only three boundary conditions. When you multiply two constants (say $Ac_1$) you get a new constant. Let's call this $C_1$. Then your general solution is $$u(x,t) = e^{-\lambda Kt}\cdot(C_1\cos(\sqrt{\lambda}x)+C_2\sin(\sqrt{\lambda}x))$$ Now using the three equations for boundary conditions you can get $C_1$, $C_2$, and $\lambda$.

Also, I've noticed that for the final boundary condition you used $t=0$, but you still have $t$ in your equation. You should not repeat the same mistake after you solved your first issue.


The problem can be partially solved using the method of Laplace transform. Indeed, taking the transform of both sides of the PDE, we obtain the ODE $$ -\underbrace{u(x,0)}_{=\,C}+sU(x,s)=kU_{xx}(x,s) \implies U_{xx}(x,s)-\frac{s}{k}U(x,s)=-\frac{C}{k}, \tag{1} $$ where $U(x,s):=\cal{L}[u]=\int_0^{\infty}e^{-st}u(x,t)\,dt$.

The general solution to $(1)$ is $$ U(x,s)=a\cosh\left(\sqrt{\frac{s}{k}}x\right)+b\sinh\left(\sqrt{\frac{s}{k}}x\right)+\frac{C}{s}. \tag{2} $$ To determine $a$ and $b$, we first need to Laplace transform the boundary conditions: $$ u(0,t)=f(t) \implies U(0,s)={\cal{L}}[f]=:F(s), \tag{3} $$ $$ u_x(L,t)=0 \implies U_x(L,s)=0. \tag{4} $$ Imposing the conditions $(3)$ and $(4)$ to the solution $(2)$ we obtain the system of equations $$ \begin{cases} a+\frac{C}{s}=F(s), \\ \sqrt{\frac{s}{k}}\left[a\sinh\left(\sqrt{\frac{s}{k}}x\right)+b\cosh\left(\sqrt{\frac{s}{k}}x\right)\right]=0, \end{cases} \tag{5} $$ which has as solution $$ a=F(s)-\frac{C}{s},\qquad b=-\left(F(s)-\frac{C}{s}\right)\tanh\left(\sqrt{\frac{s}{k}}x\right). \tag{6} $$ Plugging (6) into $(2)$ we finally obtain, after some simplification, $$ U(x,s)=\left(F(s)-\frac{C}{s}\right)\frac{\cosh\left(\sqrt{\frac{s}{k}}(L-x)\right)}{\cosh\left(\sqrt{\frac{s}{k}}L\right)}+\frac{C}{s}. \tag{7} $$ To complete the solution of the PDE one still has to compute the inverse Laplace transform of $U(x,s)$.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .