Inhomogeneous Diffusion Equation - Maximum Principle Let $u$ be a solution of the inhomogeneous diffusion equation $u_{t} = ku_{xx} + f$ on the rectangle
{${0 < x < l, 0 < t < T}$} with initial data $\phi$ and boundary data $g$. Prove that
$$|u(x, t)| ≤ max |\phi| + max |g| +\frac{l^2}{2k}max |f|.$$
I've know the general solution to the homogeneous diffusion equation homogeneous:
$$\int_{-\infty }^{\infty }\frac{1}{\sqrt{4\pi kt}} e^{\frac{-(x-y)^{2}}{4kt}}\phi(y)dy $$
ButI'm unsure about how to approach a inhomogeneous equation
 A: The solution you wrote is for the heat equation on the entire real line, and does not apply on a bounded domain. The idea here is to use the maximum principle to obtain the bound. 
If the PDE was $v_t\leq kv_{xx}$, then you know by the maximum principle that $v$ attains its maximum on the base or sides of the rectangle. The idea is to add or subtract something from $u$ so that the result satisfies $v_t \leq kv_{xx}$. A common quantity to add or subtract is $ct$ or $cx^2$.
To get your desired bound, define
$$v(x,t) := u(x,t) + cx^2 - cl^2,$$
where $c$ is a constant that we will select shortly. Note we subtracted $cl^2$ so that $v \leq u$ on the boundary of the cylinder. Then we can compute
$$v_t = u_t = ku_{xx} + f = kv_{xx} - 2kc + f.$$
If we select $c=\frac{\max|f|}{2k}$, then $v_t\leq kv_{xx}$ throughout the cylinder. The maximum principle implies that $v$ attains its maximum on the sides $x=0$ or $x=l$, or on the base $t=0$. Therefore
$v \leq \max|\phi| + \max|g|$.
By the definition of $v$
$u \leq v+cl^2 \leq \max|\phi| + \max|g| + \frac{l^2}{2k}\max|f|$.
You can obtain a corresponding lower bound on $u$ in a similar way.
