# Why does reducing a PDE with non-homogeneous boundary conditions work?

From my lecture notes:

$$\frac{\partial u}{\partial t}(x,t)-K\frac{\partial^2 u}{\partial x^2}(x,t)=f(x,t), \qquad 0 $$u(0,t)=\mu_1(t), \qquad u(L,t)=\mu_2(t), \qquad u(x,0)=u_0(x).$$

One can reduce the problem to an initial boundary problem with homogeneous boundary conditions. To do this, we choose any function $$g(x,t)$$ satisfying the boundary conditions

$$g(0,t)=\mu_1(t), \qquad g(L,t)=\mu_2(t).$$

Now if $$u(x,t) = v(x,t)+g(x,t)$$ and $$u(x,t)$$ is the solution of the PDE, then $$v(x,t)$$ must satisfy the inital boundary value problem

$$\frac{\partial v}{\partial t}(x,t)-K\frac{\partial^2 v}{\partial x^2}(x,t)=\tilde{f}(x,t), \qquad 0 $$v(0,t)=0, \qquad v(L,t)=0, \qquad v(x,0)=v_0(x),$$

where

$$\tilde{f}(x,t)=f(x,t)-\frac{\partial g}{\partial t}(x,t)+K\frac{\partial^2 g}{\partial x^2}(x,t).$$

Question: How does this simplify the PDE? Wouldn't you still have to include the function $$g(x,t)$$ and the non-homogeneous boundary conditions associated to it when performing numerical methods?

Your function $$g(x,t)$$ can be given as

$$g(x,t) = \mu_{1}(t) + \frac{x}{L}\left(\mu_{2}(t) -\mu_{1}(t) \right)$$

then you find the solution to $$v(x,t)$$ through the method of eigenfunction expansion.

$$v(x,t) = \sum_{n=1}^{\infty} a_{n}(t) \phi_{n}(t)$$

You still need $$g(x,t)$$. What you're doing is finding the equilibrium temperature distribution and subtracting it from the function $$u(x,t)$$ i.e

$$u(x,t) = v(x,t) +g(x,t) \implies \\ v(x,t) = u(x,t) - g(x,t)$$

$$g(x,t)$$ is the temperature at the end points so you want to find a function $$g(x,t)$$ from $$u(x,t)$$ you have homogeneous boundaries. If you check

$$u(0,t) = \mu_{1}(t)$$

$$g(0,t) = \mu_{1}(t) + \frac{0}{L} ( \mu_{2}(t) -\mu_{1}(t) ) = \mu_{1}(t)$$

then we have $$u(0,t) - g(0,t) = \mu_{1}(t) - \mu_{1}(t) = 0$$

similarly at the other boundary $$g(L,t) = \mu_{1}(t) + \frac{L}{L}( \mu_{2}(t) - \mu_{1}(t) ) = u_{2}(t)$$

$$u(L,t) - g(L,t) = \mu_{2}(t) - \mu_{2}(t) = 0$$

Finally note that

$$u(x,t) = v(x,t) + g(x,t) \implies \\ u_{t} - \kappa u_{xx} = v_{t} - \kappa v_{xx} + g_{t} - \kappa g_{xx} = (v_{t} + g_{t}) -\kappa( v_{xx} + g_{xx})$$