# Solving 2D heat equation with separation of variables

Solve:

$$\begin{cases} u_t = Ku_{xx}\\ u(0,y,t) = u(\pi,y,t) = 0\\ u_y(x,0,t) = u_y(x,\pi,t) = 0\\ u(x,y,0) = 1 \end{cases}$$

for $0 < x < \pi$, $0 < y < \pi$, $t>0$:

This was the problem given to me, but I don't believe it has a nontrivial solution (correct me if I'm wrong). Instead, I think the problem was meant to say: $$u_t = K(u_{xx} + u_{yy})$$ In this case,

Let $u(x,y,t) = f(x)g(y)h(t)$: $$\frac{h'(t)}{h(t)} = \frac{f"(x)}{f(x)} + \frac{g"(y)}{g(y)}$$ Let: $$\frac{f"(x)}{f(x)} = -n^2$$ $$\frac{g"(y)}{g(y)} = -m^2$$ $$\frac{h'(t)}{h(t)} = -(m^2 + n^2)$$ This leads to the seaparted solutions: $$f(x) = A\cos(nx) + B\sin(mx)$$ $$g(y) = C\cos(my) + D\sin(my)$$ $$h(t) = Ee^{-(n^2 + m^2)t}$$

$$u(o,y,t) = u(\pi,y,t) = 0 \space\text{ implies } \space A = 0$$ $$u_y(x,0,t) = u_y(x,\pi,t) = 0 \space\text{ implies } \space D = 0$$ Thus, $$u(x,y,t) = B\sin(nx)\cos(my)e^{-(n^2 + m^2)t}$$ To satisfy the initial value, we can exploit the superposition principle:

$$u(x,y,t) = \sum_{m=0}^\infty \sum_{n=0}^\infty B_{nm}\sin(nx)\cos(my)e^{-(n^2 + m^2)t}$$ $$u(x,y,0) = \sum_{m=0}^\infty \sum_{n=0}^\infty B_{nm}\sin(nx)\cos(my) = 1$$

This was as far as I was able to get. I'm unsure how to satisfy the initial condition given this double sum. Some help would be appreciated!

You can find $$m$$ and $$n$$ using boundary conditions. Instead of calling your constant $$n$$ or $$m$$, call them $$k$$ or $$\lambda$$. $$m$$ and $$n$$ are used frequently for natural numbers.

$$u(x=\pi) = 0 \Rightarrow B\sin(\lambda\pi) = 0$$

And we want a non trivial solution, so $$B\ne 0$$. Therefore $$\sin(\lambda \pi)=0$$

$$\lambda \pi = \pi n \Rightarrow \lambda = n$$

I didn't see you use the BVs so I'm not sure if you did. that step.

Now all that's left is to find the coefficient $$B_{nm}$$ using the orthogonality properties of your eigenfunctions.

$$B_{nm} = \frac{4}{\pi^2}\int_0^\pi\int_0^\pi f(x,y)\sin(n'x)\sin(m'y)dxdy$$

where $$f(x)=1$$ in this case.

You don't even have to memorize the integral above to find the coefficient in the future.

You can simply multiply both sides by $$\sin(n'x)\sin(m'y)$$ and integrate on the domain. Using properties of Kronecker delta, only when $$m' = m$$ and $$n'=n$$ will get something that isn't zero. The left hand side will simply always be:

$$\\B_{nm}\int_0^\pi \sin^2(nx)dx\int_0^\pi \sin^2(my)dy =B_{nm}\frac{\pi}{2}\frac{\pi}{2} = B_{nm}\frac{\pi^2}{4}$$

Now we have:

$$B_{nm}\frac{\pi^2}{4} = \int_0^\pi\int_0^\pi 1\sin(nx)\sin(my)dxdy$$

• I got fooled by my own choice of notation in assuming that $n$ and $m$ were integers, but still, it makes no difference for my final result. I'm unsure how to use the orthogonality condition in 2D to obtain $B_{nm}$ Commented Feb 24, 2017 at 23:40
• multiply both sides by sin(nx)sin(my) and integrate Commented Feb 24, 2017 at 23:43
• wouldn't you want to multiply by $\sin(nx)\cos(my)$ instead? Otherwise multiplying through by $\sin(nx)\sin(my)$ and integrating would result in 0, as $\cos(my)$ and $\sin(my)$ are orthogonal for all $n,m$ Commented Feb 25, 2017 at 0:06