Wave Equation with One Non-Homogeneous Boundary Condition Consider the following wave equation:
$$\begin{align}
u_{tt}&=u_{xx},\quad x\in(0,\pi),\quad t>0,\\
u(x,0)&=0,\quad u_t(x,0)=0,\\
\color{red}{u(0,t)}&\color{red}{=\phi(t)},\quad u_x(\pi,t)=0.
\end{align}$$
Since the highlighted boundary condition is non-homogeneous, I cannot apply the method of separation of variables. What can I do to solve this?
I am given a hint to use $u(x,t)=v(x,t)+\phi(t)$, but I have no idea how. Any other hint would be greatly appreciated.

Edit: Performing the hinted substitution, I managed to come up with
$$\begin{align}
v_{tt}+\phi''&=v_{xx},\quad x\in(0,\pi),\quad t>0,\\
v(x,0)&=-\phi(0),\quad v_t(x,0)=-\phi'(0),\\
v(0,t)&=0,\quad v_x(\pi,t)=0.
\end{align}$$
I now have homogeneous boundary conditions, but the PDE is non-homogeneous! I suppose it can be solved using Fourier transforms?
 A: Using Laplace Transform you have
$$
s^2 \hat{u} - \hat{u}_{xx} = 0
$$
with boundary conditions
$$
\hat{u}(0,s) = \hat{\phi}(s), \quad \hat{u}_x(\pi,s) = 0
$$
wich leads to the solution
$$
\hat{u}(x,s) = \hat{\phi}(s) \frac{\cosh s(\pi-x)}{\cosh \pi s}
$$This is fantastic modulo inverting the Laplace transform, which I think it can be done, but I'm still not clear on the details.
Another way would be taking $v(x,t) = u(x,t) - \phi(t)$ and using separation of variables. This is the battle horse and it's kind of fool proof, but it involves a lot of work.
The most intuitive and, in my opinion, beautiful way to solve the equation is using the fact that for any parallelogram $ABCD$ in the $xt$-plane bounded by four characteristic lines, the sums of the values of u at opposite vertices are equal, that is
$$
u(A) + u(C) = u(B) + u(D) \tag{1}
$$
If we divide the $xt$-plane in regions delimited by the characteristis as shown in the figure
 $\hskip1in$
and take $A = (x,t) \in \mbox{II}$, $B = (0,t_B) \in \mbox{II}$, $C = (x_C,0) \in \mbox{I}$, $D=(x_D,t_D) \in \mbox{I}$, D'Alambert solution implies that 
$$
u(x,t) = 0, \quad (x,t) \in \mbox{I}
$$
and using $(1)$, we have that
$$
u(x,t) = \phi(t-x), \quad (x,t) \in \mbox{II}
$$
For III, no wave can reach the region, hence
$$
u(x,t) = 0, \quad (x,t) \in \mbox{III}
$$
For region IV, take $A = (x,t) \in \mbox{IV}$, $B = (0,t_B) \in \mbox{II}$, $C = (x_C,t_C) \in \mbox{I}$ and $D = (x_D,t_D) \in \mbox{III}$ and equation $(1)$ implies that
$$
u(x,t) = \phi(t-x), \quad (x,t) \in \mbox{IV}
$$
For Region V we take $A = (x,t) \in \mbox{V}$, $B = (0,t_B) \in \mbox{V}$, $C = (x_C,t_C) \in \mbox{III}$ and $D = (x_D,t_D) \in \mbox{III}$ we have that
$$
u(x,t) = \phi(t-x), \quad (x,t) \in \mbox{V}
$$
Region VI is more interesting: taking $A = (x,t) \in \mbox{VI}$, $B = (0,t_B) \in \mbox{II}$, $C = (x_C,t_C) \in \mbox{II}$ and $D = (\pi,t_D) \in \mbox{VI}$, equation $(1)$ implies that
$$
u(x,t) + u(x_C,t_C) = u(0,t_B) + u(\pi,t_D) \, \Longrightarrow
$$
$$
u(x,t) = \phi(t_B) - \phi(t_C - x_C) + u(\pi, t_D)
$$
but
\begin{align}
t_B &= t - x \\
t_D &= t + x - \pi\\
x_C &= \pi - x\\
t_C &= t - \pi
\end{align}
and then
$$
u(x,t) = \phi(t-x) - \phi(t + x -2\pi) + u(\pi,t + x - \pi)
$$
Now, using $u_x(\pi,t) = 0 = -2 \phi'(t - \pi) + u_t(\pi,t)$
we have
$$
u(x,t) = \phi(t-x) + \phi(t + x - 2\pi), \quad (x,t) \in \mbox{VI}
$$
In region VII, taking $A = (x,t) \in \mbox{VII}$, $B = (0,t_B) \in \mbox{V}$, $C = (x_C,t_C) \in \mbox{IV}$ and $D = (\pi,t_D) \in \mbox{VI}$, equation $(1)$ implies that
$$
u(x,t) = \phi(t-x) + \phi(t + x - 2\pi), \quad (x,t) \in \mbox{VII}
$$
So far, it's easy to understand the results of all regions. For I and III, there is no wave, for II, IV and V, there is only the wave originating from the boundary $x = 0$. In VI there are two waves, the one originated at II plus the reflection on the boundary $x = \pi$. In VII, there is the wave from $x=0$ and region VI. This logic tells us that in VIII there will be three waves: the one from the boundary $x = 0$, the one coming from VI and it's reflection. To see this, we take $A = (x,t) \in \mbox{VIII}$, $B = (0,t_B) \in \mbox{VIII}$, $C = (x_C,t_C) \in \mbox{VI}$ and $D = (\pi,t_D) \in \mbox{VI}$,
\begin{align}
u(x,t) &= \phi(t_B) - \phi(t_C - x_C) - \phi(t_C + x_C -2\pi) + 2\phi(t_D - \pi)\\
&= \phi(t-x) + \phi(t + x - 2\pi) - \phi(t - x - 2\pi), \quad (x,t) \in \mbox{VIII}
\end{align}
Why the change of sign on the reflecting wave? one might ask. The answers is simple: the boundary $x = 0$ is hard (Dirichlet), while the boundary in $x = \pi$ is soft (Neumann).
For region IX, we take $A = (x,t) \in \mbox{IX}$, $B = (0,t_B) \in \mbox{V}$, $C = (x_C,t_C) \in \mbox{V}$ and $D = (\pi,t_D) \in \mbox{IX}$,
\begin{align}
u(x,t) &= \phi(t_B) - \phi(t_C-x_C) + u(\pi,t_D)\\
&= \phi(t-x) - \phi(t + x - 2\pi) + u(\pi, t + x - \pi)
\end{align}
Again, using the boundary condition in $x = \pi$ we have $u(\pi,t) = 2\phi(t - \pi)$ for $(x,t) \in \mbox{IX}$ and
$$
u(x,t) = \phi(t-x) + \phi(t + x - 2\pi), \quad (x,t) \in \mbox{IX}
$$
There is clearly a pattern arising in the triangular regions. In the parallelograms, a little more work must be performed, but all in all, the table is set to propose a general solution by induction.
Can you finish it off?
A: The function $v$ satisfies an inhomogeneous wave equation $v_{tt} = v_{xx} - \phi_{tt}$ with homogeneous boundary conditions and initial value $v(x,0) = -\phi(0)$. Can you solve such an equation?  
A: I have a better approach.
Since this problem also contains the conditions $u(x,0)=0$ and $u_t(x,0)=0$ , we do not necessarily have to consider the issues about the conditions $u(0,t)=\phi(t)$ and $u_x(\pi,t)=0$ .
Because the PDE is an overdetermining problem and with the conditions $u(x,0)=0$ and $u_t(x,0)=0$ , So it is better to take Laplace transform on $t$ :
$\mathcal{L}_{t\to s}\{u_{tt}\}=\mathcal{L}_{t\to s}\{u_{xx}\}$
$s^2U(x,s)-su(x,0)-u_t(x,0)=U_{xx}(x,s)$
$U_{xx}(x,s)-s^2U(x,s)=0$
$U(x,s)=F(s)e^{xs}+G(s)e^{-xs}$
$u(x,t)=f(t+x)H(t+x)+g(t-x)H(t-x)$
$u(0,t)=\phi(t)$ :
$f(t)H(t)+g(t)H(t)=\phi(t)$
$\because t>0$
$\therefore f(t)+g(t)=\phi(t)$
$g(t)=\phi(t)-f(t)$
$\therefore u(x,t)=f(t+x)H(t+x)+(\phi(t-x)-f(t-x))H(t-x)$
$u_x(x,t)=f_x(t+x)H(t+x)+(f_x(t-x)-\phi_x(t-x))H(t-x)$
$u_x(\pi,t)=0$ :
$f_x(t+\pi)H(t+\pi)+(f_x(t-\pi)-\phi_x(t-\pi))H(t-\pi)=0$
$t\to t+\pi$ :
$f_x(t+2\pi)H(t+2\pi)+(f_x(t)-\phi_x(t))H(t)=0$
$\because t>0$
$\therefore f_x(t+2\pi)+f_x(t)-\phi_x(t)=0$
$f_x(t+2\pi)+f_x(t)=\phi_x(t)$
$\therefore u(x,t)=f(t+x)H(t+x)+(\phi(t-x)-f(t-x))H(t-x)$ , where $f(t)$ is the general solution of $f_x(t+2\pi)+f_x(t)=\phi_x(t)$
