I'm trying to solve the following problem of the heat equation using the method of variables separation

\begin{equation} \begin{aligned} \partial_t u = \alpha^2 \partial_x^2u, t>0, x\in(0,l) \\ u(t,0) = 0 = u(t,l), t \geq 0, \\ u(0,x) = \phi(x), x \in E[0,l] \end{aligned} \end{equation}

I know how to prove that $X(0)=X(l) = 0$ so I don't get trivial solutions and find the solutions for $X(x)$ and $T(t)$

\begin{equation} X(x) = A\cos(\sqrt{\lambda} x) + B \sin(\sqrt{\lambda}x) \end{equation}

\begin{equation} T(t) = C\exp(-\lambda \alpha^2t) \end{equation}

But I'm having troubles showing that:

\begin{equation} u_n(t,x) = \sin \frac{(2n - 1)\pi x}{2l}\exp \left( - \frac{(2n-1)^2 \pi^2 \alpha^2}{4l^2}t\right), n \in Z^+ \end{equation}


\begin{equation} u(t,x) = \sum_{n=1}^\infty c_n u_n(t,x) \end{equation}

By superposition and using the fact that $\lambda = \left(\frac{n \pi}{l}\right)^2$

\begin{equation} u(t,x) = \sum_{n=0}^\infty b_n\sin \left(\frac{n \pi x}{l}\right) \exp\left(\frac{n^2\pi^2 \alpha^2t}{l^2} \right) \end{equation}

My attempt

I have

\begin{align} \phi(x) = u(0,x) = \sum_{n=1}^\infty b_n \sin \left(\frac{n \pi x}{l}\right) \\ \end{align}


\begin{align} (\phi|X_m) = \frac{l}{2}b_m \\ b_k = \frac{2}{l}\int_0^l \phi(x)\sin \frac{n \pi x}{l} dx = 2u_0 \int_0^l \sin \frac{n \pi x}{l} dx \end{align}

So the integral can be solved for $b_n$ as follows

\begin{equation} \begin{aligned} b_n = 2u_0 \int_0^l \sin \frac{n \pi x}{l} dx = 2u_0 \frac{l \cos(\frac{n \pi x}{l})}{\pi n}|_0^l = 2u_0 \frac{l - l\cos(\pi n)}{\pi n} \\ = 2u_0 l \frac{1-\cos(\pi n)}{\pi n} = -\frac{2 u_0 l}{\pi n} ((-1)^n - 1)\\ = \left \{ \begin{matrix} 0 \text{ when n is even} \\ \frac{4u_0 l}{n\pi} \text{ when n is odd} \end{matrix} \right . \end{aligned} \end{equation}

But I cant figure out from here how to get to $u_n(t,x)$ and $u(t,x) = \sum_{n=1}^\infty c_nu_n(t,x)$

  • $\begingroup$ Did you look in some textbook? This is a standard example which is explained in lots of books about PDEs. Anyway, the first thing you need to sort out is for what values of $\lambda$ your separated function $u=XT$ satisfies the boundary conditions. That will explain why $u_n$ is what it is. $\endgroup$ Commented Aug 27, 2021 at 9:07
  • $\begingroup$ $\lambda = (\frac{n \pi}{l})^2$ satisfies the boundary condition and thats why I follow with the integral. I was reading the book fourier analysis and partial differential equations but it doesn't have it. Any suggestions @HansLundmark? $\endgroup$ Commented Aug 27, 2021 at 14:18
  • $\begingroup$ Oh, wait a minute... Are you sure you copied the problem correctly? The given solution doesn't match the boundary conditions that you have written. It looks like the boundary condition at $x=l$ should be $\partial u/\partial x=0$, not $u=0$. $\endgroup$ Commented Aug 27, 2021 at 20:33
  • $\begingroup$ The problem is copied correctly. The solution is what I did. It might be wrong $\endgroup$ Commented Aug 27, 2021 at 22:08
  • $\begingroup$ I was talking about the formula for $u_n$ after “But I'm having troubles showing that”. If that's what you're asked to show, something is wrong somewhere. And that formula for $u_n$ doesn't match the formula for $u$ just above “My attempt” either. $\endgroup$ Commented Aug 28, 2021 at 6:23

1 Answer 1


You want to follow the standard prescription by assuming a separated solutions of the form $X(x)T(x)$ and then separate variables to obtain $$ \frac{1}{\alpha^2}\frac{T'(t)}{T(t)}=\lambda = \frac{X''(x)}{X(x)},\;\;\; X(0)=X(l)=0. $$ where $\lambda$ is a separation constant. The $X$ equation determines the parameters $\lambda$: $$ X''(x)-\lambda X(x)=0,\;\;\; X(0)=X(l)=0. $$ There are no solutions if $\lambda > 0$ because you end up with $\sinh$ or $\cosh$, and these functions do not have two real zeroes. The solutions are $\lambda = -n^2\pi^2/l^2$, leading to solutions $X_n(x)=\sin(n\pi x/l)$ for $n=1,2,3,\cdots$. The equations in $T$ must satisfy $$ T'(t)=-\frac{\alpha^2 n^2\pi^2}{l^2}T(t). $$ So the $T$ solutions are $$ T(t) = \exp\left\{-\frac{\alpha^2n^2\pi^2}{l^2}t\right\} $$ The general separated solution is $$ u(t,x) = \sum_{n=1}^{\infty}C_n \exp\left\{-\frac{\alpha^2 n^2\pi^2}{l^2}t\right\}\sin(n\pi x/l) $$ The constants are determined by Fourier Series techniques and the initial condition $$ \phi(x) = u(0,x) = \sum_{n=1}^{\infty}C_n\sin(n\pi x/l) $$ The coefficients are determined by orthogonality conditions: $$ \int_0^l \phi(x)\sin(n\pi x/l)dx=C_n\int_0^l\sin^2(n\pi x/l)dx \\ C_n = \frac{\int_0^l \phi(x)\sin(n\pi x/l)dx}{\int_0^l\sin^2(n\pi x/l)dx}. $$

  • $\begingroup$ I have all of that in the question. And it does not arrive to the formula of $u_n(t,x)$ $\endgroup$ Commented Aug 29, 2021 at 21:11
  • 1
    $\begingroup$ @AlejandroAndrade You can see that they are missing the half-period sin functions in their answer. I'd say they've overlooked that. $\endgroup$ Commented Aug 30, 2021 at 0:59

You must log in to answer this question.

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