So I want to solve the problem:
\begin{align} u_t-u_{xx}&=\cosh(x), \quad 0<x<4, \quad t>0\\u(x,0)&=v(x),\\u(0,t)&=0,\\u(4,t)&=0. \end{align}
The inhomogeneous part is easy. Due to the $t$-inhomogeneity we want to find a function $f(x)$ such that it solves $-f''(x)=\cosh(x)$. Thus a solution is given by
$$f(x)=-\cosh(x)+ax+b.$$
The initial condition $u(0,t)=0\implies f(0)=0$ which gives $b=1$. The other initial condition $u(4,t)=0\implies f(4)=0$ gives $a=\frac{\cosh(4)-1}{4}.$ This means that
$$f(x)=-\cosh(x)+\frac{\cosh(4)-1}{4}x+1.$$
From here, this is what the prof says:
Now we need to solve the homogeneous part. Observe that we have to modify our initial condition, cause when we add the steady state solution, if we don’t modify the IC, then the steady state solution part will screw it up. So, we solve the problem:
\begin{align} u_t-u_{xx}&=0, \quad 0<x<4, \quad t>0\\u(x,0)&=v(x)-f(x),\\u(0,t)&=0,\\u(4,t)&=0. \end{align}
Our full solution will be equal to $u(x,t)+f(x).$
Question: I don't understand why we need to do this modification of the IC on this particular boundary value problem. Can someone shed some light on this?
The given solution was confusing since they used the same symbol for the actual solution and the homogeneous solution. So let's write
$$ u(x,t) = f(x) + \bar u(x,t) $$
where $f(x)$ is the function you just found, and $\bar u$ is the "remainder". Plug this form into the PDE to get
$$ u_t - u_{xx} = \bar u_t - \bar u_{xx} - f''(x) = \cosh(x) $$
But we already have $-f''(x) = \cosh x$, therefore it remains the $\bar u$ must be homogeneous
$$ \bar u_t - \bar u_{xx} = 0 $$
Finding the initial condition works the same way
$$ u(x,0) = f(x) + \bar u(x,0) = v(x) \implies \bar u(x,0) = v(x) - f(x) $$
And we have a new BVP in $\bar u$
\begin{cases} \bar u_t - \bar u_{xx} = 0 \\ \bar u(x,0) = v(x) - f(x) \\ \bar u(0,t) = \bar u(4,t) = 0 \end{cases}
Is this clear?