We have
$$ \begin{cases} u_t = k u_{xx}, x \in (0,l), t > 0 \\ u(0,t) = g_1(t), \\ u(l,t) = g_2(t), t > 0 \\ u(x,0) = u_0(x), x \in [0,l] \end{cases} $$
Show boundary conditions can be transformed into homogeneous boundary conditions.
try
The idea is to introduce some $w(x,t)$ so that $w(0,t)=w(l,t)=0$. We want to have
$$ w(x,t) = u(x,t) - something $$
Actually, we can check that
$$ w(x,t) = u(l-x,t) - \frac{ (g_1(t)-g_2(t)) }{l}(x-l) - g_1(t) $$
Note that $w(0,t) = g_2 + (g_2-g_1)(-1) - g_1 = 0 $ and $w(l,t) = g_1 - g_1 = 0$ so this the condition we want. However, in my solution it says. Take
$$ w(x,t) = u(x,t) - \frac{ (g_1(t)-g_2(t)) }{l}(x-l) - g_1(t) $$
This is wrong since it doesnt give homogeneous bc. Am I wrong or the answer key is wrong?