# Variable Dirichlet Boundary condition in permanent solution for Heat Equation

I have the PDE for the homogeneous heat equation (partial derivative of u with respect to time equals the second partial derivative of u with respect to x) with the following Dirichlet boundary and initial conditions:

$$\\ u(0,t) = t\\ u(1,t) = 0 \\ u(x,0) = x(1-x)$$

I have non-homogeneous boundary conditions, so we propose $u(x,t) = w(x,t) + U(x)$, with $U(x)$ the stationary solution (as time approaches infinity, the solution $u(x,t)$ approaches $U(x)$, so $w(x,t)$ is the transient part of my solution.

Separating the problem in two others, for $U(x)$ and $w(x,t)$, I get quite confused as in what should be the boundary condition for $U(0)$, since $u(0,t) = t$ is time-dependent.

If I solve for $U(x)$ with conditions $U(0) = t$ and $U(1) = 0$, I get $U(x) = Ax+B$, so we conclude that $U(x) = -tx + t$; and then, solving for $w(x,t)$, we have from $u(x,t) = w(x,t) + U(x)$: $$w(x,0) = x(1-x) - (-tx+t) = (x-t)(1-x)$$

The problem is that when I find the transient solution (for $w(x,t)$), to determine the coefficients for its series representation, I need to apply our initial condition $w(x,0) = (x-t)(1-x)$ to find the Fourier series and find the complete solution for the problem.

Note: I am not sure if that initial condition makes sense, since it is time dependent, even though $t=0$. Apart from that, I have no idea how to construct the periodic extension to find a Fourier series that matches my condition, since it's multivariable.

Your initial form of the solution is incorrect: since the boundary conditions depend on $t$, the long-time behaviour does not tend to a stationary solution.
Instead, notice that the function $t(1-x)$ satisfies the boundary conditions, and is zero at $t=0$. Therefore, we can change the problem to have homogeneous boundary conditions by writing $u(x,t)=t(1-x)+v(x,t)$, and now $v(x,t)$ has homogeneous boundary conditions $v(0,t)=v(1,t)=0$. But $v(x,t)$ doesn't satisfy the heat equation any more; instead we have $$v_t-v_{xx} = (u-t(1-x))_t-(u-t(1-x))_{xx} = x-1. \tag{1}$$ But again, the heat equation is linear, so we can write $v(x,t)=w(x,t)+U(x,t)$, where both functions have homogeneous boundary conditions, but $U(x,t)$ solves the heat equation, $w(x,t)$ the modified equation (1), and $w(x,0)+U(x,0)=x(1-x)$. Admittedly at this point this doesn't look very useful, but note the boundaries are curves of constant $x$. Let's pretend for a moment that $w(x,t)=w(x)$ alone, then $w$ satisfies $$w''=1-x, w(0)=w(1)=1,$$ which is easy to solve, and gives $w=-\frac{1}{6}x(1-x)(2-x)$. So we can choose this $w$ to return to something that satisfies the heat equation, at the expense of modifying the initial condition satisfied by $U$. In other words, we have $$u(x,t) = (1-x)(t-\tfrac{1}{6}x(2-x))+U(x,t),$$ and so $U$ must satisfy the heat equation, $U_t-U_{xx}=0$, and the initial condition $$U(x,0) = x(1-x)+\tfrac{1}{6}x(1-x)(2-x).$$ And then you can go on to separate variables and solve for $U$ in the usual way.