diffusion equation, inhomogenous boundary conditions (the subtraction method) Recently I am reading a textbook on P.D.E. Most of the time textbooks mainly deal with homogenous equations and boundary conditions.
I am curious how would one solve say, the heat equation with inhomogenous boundary conditions?
$u_t=u_{xx}$
$u(0,t)=b(t)$ (Dirichlet BC)
or $u_x(0,t)=b(t)$ (Neumann BC) 
I read somewhere about a "subtraction method",
where one lets $v(x,t)=u(x,t) - ...$ , but don't really understand it.
Sincere thanks for any help.
 A: The idea is essentially the same as the idea behind solving inhomogeneous ODEs by finding a particular integral and a complementary function. The way I know to do it is, I think, what you are calling the subtraction method.
I notice that you have only given one boundary condition for each type of condition, generally you would need two boundary conditions to get a unique solution to your problem, just thought I'd mention that. I will refer to boundary conditions plural, since this gives a unique solutions but I imagine the same method works for just one boundary condition, you will just have a series of non-unique solutions.
You first find a function $u'$ called the particular solution which solves the equation and satisfies your inhomogeneous BCs. You then solve the same equation for a new function $\hat u := u - u' $ with the now homogeneous BCs. (Bear in mind that when you do this your initial conditions for $\hat u$ will be different to those of the original $u$)
Finding a particular solution $u'$ is not always easy, depending on the form of $b(t)$, and in fact I'm not sure that there is a way to do it for general BCs. However, one good way to do it (when your boundary conditions $b(t)$ are independent of time, i.e. there are points with a fixed amount of the quantity that is diffusing) is to find a "steady state solution" which doesn't vary with time, and can be thought of as the long term behaviour of the general solution, where all short-term behaviour has faded away (in terms of diffusion, this would be the limiting behaviour when the quantity in question has diffused to be spread over the space in an equilibrium determined by our boundary conditions). 
A: Here is a different approach, called the method of eigenfunction expansions.
