Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Suppose $u(x,t)$ solves \begin{align} u_t&=u_{xx}, \qquad 0 < x < \pi/2,\ t>0,\\ u(0,t)&=e^{-t},\\ u(\pi/2, t)&=t,\\ u(x,0)&=\cos(3x). \end{align}

I was following a method outlined in Boundaries in heat equation and set

$$u(x,t) = v(x,t) + e^{-t} + {2x \over \pi }\left(t - e^{-t}\right),$$


$$v_t - v_{xx} = e^{-t} - {2x \over \pi }\left(1 + e^{-t}\right).$$
with a new boundary condition:

$$v(x,0) = \cos(3x) - 1 + {2x \over \pi}.$$

I then set $v(x,t) = \sum_{n=1}^\infty c(n,t)\sin(2\,x n)$, which I understand now satisfies the new homogeneous boundary conditions. Differentiating $v(x,t)$:

\begin{align} v_t &= \sum_{n=1}^\infty c_t(n,t)\sin(2x n),\\ v_{xx} &= -\sum_{n=1}^\infty c(n,t)4s^2\sin(2x n), \end{align}

and substituting into the new equation gives:

$$\sum_{n=1}^\infty c_t(n,t)\sin(2x n) + \sum_{n=1}^\infty c(n,t)2n^2\sin(2x n) = e^{-t} - {2x \over \pi }\left(1 + e^{-t}\right).$$

How do I find these coefficients $c(n,t)$?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Let's back up a little bit and provide a comprehensive answer to these types of problems.

Suppose $u(x,t)$ solves \begin{align} u_t&=u_{xx}, \qquad 0 < x < \ell,\ t>0,\\ u(0,t)&=f(t),\\ u(\ell, t)&=g(t),\\ u(x,0)&=h(x). \end{align} In the subsequent work, we will impose whatever smoothness conditions on the initial and boundary data we need to get convergence of the involved series.

First, standard separation of variables shows that the solution to the problem with homogeneous BCs is $$u(x,t)=\sum_{n=1}^\infty b_n\sin(\sqrt{\lambda_n}\,x)e^{-\lambda_n t},$$ where $\lambda_n=(n\pi/\ell)^2$, $n=1,2,\dots$ In other words, for each fixed $t>0$, $$u(x,t)=\sum_{n=1}^\infty u_n(t)\sin(\sqrt{\lambda_n}\,x)\quad\text{where}\quad b_n={2\over \ell}\int_0^\ell u(x,t)\sin(\sqrt{\lambda_n}\,x)\,dx.$$ (This is a key observation. I hope the notation isn't confusing: $u_n$ represents the coefficients in the series for $u$, not a partial derivative.)

Then, differentiating the series above, define $v_n(t)$ and $w_n(t)$ as the coefficients in the series for ${\partial u\over \partial t}$ and ${\partial^2 u\over \partial x^2}$, respectively:

\begin{align} {\partial u\over \partial t}&=v_n(t)\sin(\sqrt{\lambda_n}\,x) \quad\text{where}\quad v_n={2\over \ell}\int_0^\ell {\partial u\over \partial t}\sin(\sqrt{\lambda_n}\,x)\,dx={du_n\over dt},\\ {\partial^2 u\over \partial x^2}&=w_n(t)\sin(\sqrt{\lambda_n}\,x) \quad\text{where}\quad w_n={2\over \ell}\int_0^\ell {\partial^2 u\over \partial x^2}\sin(\sqrt{\lambda_n}\,x)\,dx. \end{align}

Integrating the $w_n(t)$ by parts, simplifying the trig terms, and applying the BCs, we get \begin{align} w_n(t)&=-{2\over \ell}\int_0^{\ell} \lambda_n u(x,t)\sin(\sqrt{\lambda_n}\,x)\,dx\\ &\qquad\qquad+{2\over \ell}\left[u_x(x,t)\sin(\sqrt{\lambda_n}\,x)-\sqrt{\lambda_n}\,u(x,t)\cos(\sqrt{\lambda_n}\,x)\right]\Bigg|_{x=0}^{x=\ell}\\ &=-\lambda_nu_n(t)+\underbrace{{2\sqrt{\lambda_n}\over \ell}\left[f(t)+(-1)^{n+1}g(t)\right]}_{F(t)}. \end{align}

From the PDE, $$u_t=u_{xx}\implies v_n(t)=w_n(t)\implies {du_n\over dt}=-\lambda_n u_n(t)+F(t),$$ and thus the coefficients $u_n(t)$ we seek are found by solving the (ODE!) initial-value problem \begin{align} {du_n\over dt}+\lambda_nu_n(t)&=F(t),\\ u_n(0)&={2\over \ell}\int_0^\ell h(x)\sin(\sqrt{\lambda_n}\,x)\,dx, \end{align} by the method of your choice.

This is called the method of eigenfunction expansions. Transform methods are also available, but that is a separate post.

Hope that helps.

share|improve this answer
Thanks for your answer. On your first equation, $h$ is a function of position $x$ I guess, not time $t$. –  FraSchelle Feb 19 at 21:49
Thanks, typo fixed. –  JohnD Feb 20 at 4:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.