# Heat equation in 2 dimensions, with constant boundary conditions.

I have to solve the following problem: $$\alpha ( \frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} ) = \frac{\partial u}{\partial t}, \\ u(0,y,t) = T_1 \qquad u(L,y,t) = T_2 \\ u(x,0,t) = T_3 \qquad u(x,L,t) = T_4 \\ u(x,y,0) = x(L-x).$$ This is a heat equation in two dimensions with constant boundary conditions.

My attempt is the following: I propose a solution $u(x,y,t) = v(x,y,t) + w(x,y),$ where $u(x,y,t)$ is the solution for the homogeneous heat equation and $w(x,y)$ is the solution for the equilibrium state, that is, solving the following problem $$\nabla^2 w = 0 \\ w(0,y) = T_1 \qquad w(L,y) = T_2 \\ w(x,0) = T_3 \qquad w(x,L) = T_4 .$$ Using the method of separation of variables I propose the solution $w(x,y) = X(x)Y(y)$ and obtain the following pair of ordinary differential equations $$\frac{1}{X}\frac{d^2 X}{dx^2} = \lambda^2 \qquad \frac{1}{Y}\frac{d^2 Y}{dy^2} = \lambda^2 ,$$ and this is where I'm stuck, because I know that I have to check for every possible case for $\lambda,$ that is, if it is negative, zero or positive, then use the boundary conditions to look for the integration constants.

Is this the right way to achieve the general solution for the original problem or am I taking the long way here?

• You cannot use separation of variables for $w$: the fact that the boundary conditions are piecewise constant would meant that both $X(x)$ and $Y(y)$ are constant functions. // The fact that if the $T_i$ are not all the same you will get discontinuities at the corners should also be another hint that separation of variables won't work. – Willie Wong Oct 26 '17 at 1:32
• But I'm working on a rectangle, where the edges are actually the constant functions so I thought maybe I could work a way using superposition with separation of variables. Besides that, is there a better approach to the solution of the problem then? – lorenzattractor Oct 26 '17 at 1:36
• If you allow also superpositions, then it is doable as an infinite series (when it comes to solving the equation for $w$). Basically you need to take the Fourier (sine) series of the boundary conditions. Section 3.3.1 of this lecture note explains how to implement this. Your answer will have a series expression that looks a little bit like the Fourier series expansion of the square wave. – Willie Wong Oct 26 '17 at 2:52

$$w(x,y) = w_1(x,y) + w_2(x,y) + w_3(x,y) + w_4(x,y)$$
$$\nabla^2 w_1 = 0$$ $$w_1(0,y) = T_1$$ $$w_1(L,y) = w_1(x,0) = w_1(x,L) = 0$$
which can be solved using separation of variables to get $$w_1(x,y) = \sum_{n=1}^{\infty} c_n \sinh\left(\frac{n\pi}{L}(L-x) \right)\sin\left(\frac{n\pi}{L}y\right)$$ with $$c_n = \frac{T_1}{\sinh(n\pi)}\cdot\frac{2}{L}\int_0^L \sin\left(\frac{n\pi}{L}y\right)dy$$ and so on