I want to solve the 2 dimensional heat equation on a square $\Omega = \{ (x,y) : 0 < x < \pi, 0 < y < 2\pi \}$ with the Fourier Method \begin{align*} \partial_t u - \Delta u & = 0 & \quad \mbox{ on } \Omega \times (0,T) \\ u(x,y, t) & = 0 & \quad \mbox{for } (x,y) \in \partial \Omega, t \in [0,T], \\ u(x,y, 0) & = x(\pi - x)(\pi - |y - \pi|) & \quad \mbox{for } (x,y) \in \Omega. \end{align*} With separation of variables I found $$ u(x,y,t) = \psi(x,y) \varphi(t) $$ with $$ \psi(x,y) = \left( \sum_k A_k \sin(k x) \right) \cdot \left( \sum_l B_l \sin(l/2 y) \right) $$ and $$ \varphi(t) = C e^{-2t}. $$ But I have no idea how to incorporate the initial condition $$ u(x,y,0) = x(\pi - x)(\pi - |y - \pi|). $$ So how to handle such an initial conditions?

  • $\begingroup$ The solution should be $\psi(x,y) = \left( \sum_k A_k \sin(2 k x) \right) \cdot \left( \sum_l B_l \sin( l y) \right)$. Can you double check? $\endgroup$ – mike Jun 19 '14 at 23:21
  • $\begingroup$ thanks for noticing, the $\pi$-factor is not necessary here, but your is not correct either; I think, it should be $\psi(x,y) = (\sum_k A_k \sin(kx)) \cdot (\sum_l B_l \sin(l/2y) )$. $\endgroup$ – StefanH Jun 19 '14 at 23:41
  • $\begingroup$ Just FYI, that's an initial condition, not a boundary condition. $\endgroup$ – JohnD Jun 20 '14 at 13:25
  • $\begingroup$ @JohnD: Yes, I corrected it. $\endgroup$ – StefanH Jun 20 '14 at 13:30
  • $\begingroup$ Maybe the title too (for future users)? $\endgroup$ – JohnD Jun 20 '14 at 13:32

The separation of variables solution for this equation has the general form $$ u(x,y,t)=\sum_{m=1}^{\infty}\sum_{n=1}^{\infty}C_{n,m}e^{-t(n^{2}+m^{2}/4)}\sin(nx)\sin(my/2). $$ It's easy to verify that each term in the sum is a solution of the heat equation, and each term vanishes on $\partial\Omega$ for $t \ge 0$. The only question is how to choose $C_{n,m}$, which is done using orthogonality relations. You want to choose $C_{n,m}$ such that $$ u(x,y,0)=\sum_{n,m}C_{n,m}\sin(nx)\sin(my/2). $$ So, $$ \int_{0}^{2\pi}\int_{0}^{\pi}u(x,y,0)\sin(n'x)\sin(m'y/2)\,dx\,dy \\ = C_{n',m'}\int_{0}^{\pi}\sin^{2}(n'x)\,dx\int_{0}^{2\pi}\sin^{2}(m'y)\,dy = C_{n',m'}\frac{\pi^{2}}{2}. $$ That gives $$ C_{n',m'} = \frac{2}{\pi^{2}}\int_{0}^{2\pi}\int_{0}^{\pi}x(\pi-x)(\pi-|y-\pi|)\sin(n'x)\sin(m'y/2)\,dx\,dy \\ = \frac{2}{\pi^{2}}\int_{0}^{2\pi}(\pi-|y-\pi|)\sin(m'y/2)\,dy \int_{0}^{\pi}x(\pi-x)\sin(n'x)\,dx. $$

  • $\begingroup$ guess you made a typo because you wrote $\cos(my/2)$ instead of $\sin(my/2)$ everywhere. $\endgroup$ – StefanH Jun 20 '14 at 13:19
  • $\begingroup$ Thank you. I fixed that now. How in the world do things like that make it into the brain? Funny. $\endgroup$ – DisintegratingByParts Jun 20 '14 at 13:22
  • $\begingroup$ :) guess your second line in your first derivation should be $$C_{n',m'} \int_0^{\pi} \sin^2(n'x) dx \int_0^{2\pi} \sin^2(m'y/2) dy$$but the end result is the same, as both evaluate to $\pi/2$. $\endgroup$ – StefanH Jun 20 '14 at 13:31
  • $\begingroup$ The factor 4 in front of $m^2$ should be (1/4) as in $u(x,y,t)=\sum_{m=1}^{\infty}\sum_{n=1}^{\infty}C_{n,m}e^{-t(n^{2}+m^{2}/4)}\sin(nx)\sin(my/2)$. please double check! $\endgroup$ – mike Jun 20 '14 at 14:05
  • $\begingroup$ @mike : yes, you are correct, and I fixed that. $\endgroup$ – DisintegratingByParts Jun 20 '14 at 15:30

We start with a new solution:

$$u(x,y,t)=C e^{-2t}\left( \sum_k A_k \sin^2(k x) \right) \cdot \left( \sum_l B_l \sin^2( l y/2) \right)$$

They satisfy the boundary conditions for $(x,y) \in \partial \Omega$.

Now we need to determine $A_k$ and $B_l$ from the initial condition:

$$x(\pi-x)(\pi-|\pi-y|)=C \left( \sum_k A_k \sin^2(k x) \right) \cdot \left( \sum_l B_l \sin^2( l y/2) \right)$$

We can multiply both sides by $\sin^2(m x)\sin^2(n y/2)$ and integrate the result over $\int_0^\pi dx \int_0^{2\pi} dy$, obtaining (set $C=1$):


Therefore we can set:



Define matrix $U_{k,m}=(1/2)+\delta_{k,m}$, then $A_k$ and $B_l$ are given by:

$$A_k=\sum_m \left(U^{-1}\right)_{k,m}\frac{1}{6}\left(\pi^2+\frac{3}{m^2}\right)$$

$$B_l=\sum_n \left(U^{-1}\right)_{l,n}\frac{1}{\pi}\left(\frac{1+(-1)^{n+1}}{n^2}+\frac{\pi^2}{2}\right)$$


Here we just give the explicit formulas for coefficients $C_{n',m'}$ in T.A.E's solution:

$$C_{n,m} = \frac{2}{\pi^{2}}A_{m}B_{n}$$

$$A_{2m+1}=\int_{0}^{2\pi}(\pi-|y-\pi|)\sin((2m+1)y/2)\,dy=\frac{8(-1)^m}{(1+2m)^2}. A_{2m}=0$$


The reason we have $B_{2n}=0$ is because the initial condition $x(\pi-x)$ is symmetric if we swap $x$ with $\pi-x$, so is function $\sin((2n+1)x)$, while as the function $\sin(2nx)$ is not.

Similarly initial condition $\pi-|y-\pi|$ is symmetric if we swap $y$ with $2\pi-y$, so is function $\sin((2m+1)y/2)$, while as the function $\sin(2my/2)$ is not.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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