How do I implement boundary conditions using separation of variables

I am learning to use PDEs to solve the heat equation. I am following along with example 1 on this website. I am having trouble implementing the boundary conditions. The problem is:

$$u_{t} = ku_{xx}\\$$

$$u(x,0) = f(x) \\ u(0,t) = u(L,t) = 0$$

I completely understand the derivation and solution up until they implement the boundary conditions. They argue:

image

This is all well and good for $u(0,t) = u(L,t) = 0$, but I am trying to extend this problem. What if $u(0,t) = u(L,t) = T$? Can you still use this argument? Or, is there a better argument to be had?

Implementing boundary conditions is the part that I struggle the most with.

Unfortunately the answer here depends quite strongly on the particular boundary conditions of interest. Sometimes, especially with inhomogeneous boundary conditions, there is no easy answer, other times there is one. In your particular case, you can observe that $u(t,x)=T$ is a solution to the heat equation, so you can introduce $v(t,x)=u(t,x)-T$, then $v(t,x)$ will solve the heat equation with homogeneous boundary conditions instead. But if instead you had time dependent boundary conditions or something like that, this recipe would generally not work.
• It is pretty much always possible to come up with a function $w(x,t)$ such that $v(x,t)=u(x,t)-w(x,t)$ has zero boundary conditions. In general, however, the new equation for $v$ will be non-homogeneous, but still is amenable to the separation of variables. Commented Feb 24, 2016 at 23:19
• Just a question about terminology: are any boundary conditions where $u(0,t) = u(L,t) \neq 0$ called inhomogeneous? eg. in this case where $u(0,t) = u(L,t) = \text{const}$. I initially thought these would be homogeneous BC because they are equal to the same constant. Commented Feb 25, 2016 at 0:27