Hyperbolic system with nonhomogeneous boundary conditions I want to solve this problem but I'm stuck in the last step. I have followed all the steps below, but I don't know how to finish. Any Ideas?

We consider the standard wave equation with nonhomogeneous boundary conditions
  $$
\left\lbrace\begin{aligned}
&u_{tt} - c^2 u_{xx} = 0 \quad\text{in}\quad (0,T)\times (0,1)\\
&u(t,0) = 0,\quad u(t,1) = f(t) \\
&u(0,x) = u_0(x),\quad u_t(0,x) = u_1(x)
\end{aligned}\right.
$$
  which can be reduced to the following system after making the variables substitution $p=u_t - cu_x$, $q = u_t+cu_x$
$$
\begin{aligned}
&\begin{pmatrix} p\\q\end{pmatrix}_t = \begin{pmatrix} {-c} & 0\\0 & c\end{pmatrix} \begin{pmatrix} p\\q\end{pmatrix}_x \quad\text{in}\quad (0,T)\times (0,1)\\
&(p+q)(t,0) = 0,\quad (p+q)(t,1) = f'(t) \\
&p(0,x) = p_0(x),\quad q(0,x) = q_0(x)
\end{aligned}
$$
  As $p$ and $q$ are constant along their characteristics $x_p = ct + C_1$, $x_q = -ct + C_2$ we can write
  $$
\left\lbrace\begin{aligned}
&p(t,x) = p_0(x-ct) \quad\text{for}\quad t\leq\tfrac{x}{c}\\
&q(t,x) = q_0(x+ct) \quad\text{for}\quad t\leq\tfrac{1-x}{c}
\end{aligned}\right.
$$
  so, boundary conditions become $p(t,0) + q_0(ct) = 0$ and $q(t,1) + p_0(1-ct) = f'(t)$.

 A: With $p_0(x) = u_1(x) - c u'_0(x)$ and $q_0(x) = u_1(x) + c u'_0(x)$, the demarche in OP seems correct. For a similar derivation, see e.g. this post. To finish, let us use the method of characteristics and integrate $u_x = (q-p)/(2c)$ w.r.t. $x$ up to $t=1/c$.


*

*For $ct \leq x\leq 1-ct$, we know $q(x,t) = q_0(x+ct)$ and $p(x,t) = p_0(x-ct)$. Integrating $u_x$ with respect to $x$, d'Alembert's formula is obtained:
$$
u(x,t) = \frac{1}{2} \left(u_0(x+ct)+u_0(x-ct)\right) + \frac{1}{2c}\int_{x-ct}^{x+ct} u_1(\xi)\, \text d\xi \, .
$$

*For $0\leq x \leq ct$, we know $q(x,t) = q_0(x+ct)$. The value of $p$ comes from the left boundary. According to the method of characteristics, $p$ is constant along the characteristic curves $t = t_0+x/c$ starting at $x=0$. Therefore, $p(t,x) = p(t-x/c,0) = -q_0(ct-x)$. Integrating with respect to $x$, a variation of d'Alembert's formula is obtained:
$$
u(x,t) = \frac{1}{2} \left(u_0(x+ct)-u_0(ct-x)\right) + \frac{1}{2c}\int_{ct-x}^{x+ct} u_1(\xi)\, \text d\xi \, .
$$

*For $1-ct\leq x\leq 1$, we know $p(x,t) = p_0(x-ct)$. The value of $q$ comes from the right boundary. According to the method of characteristics, $q$ is constant along the lines $t = t_0+(1-x)/c$ starting at $x=1$. Thus, $q(t,x) = f'(t+(x-1)/c)-p_0(2-ct-x)$. Integrating with respect to $x$, a variation of d'Alembert's formula is obtained:
\begin{aligned}
u(x,t) &= \frac{1}{2} \left(u_0(x-ct)-u_0(2-ct-x)\right) + \frac{1}{2c}\int_{x-ct}^{2-ct-x} u_1(\xi)\, \text d\xi\\
&\phantom{ = }\; + f\!\left(t+\frac{x-1}{c}\right) .
\end{aligned}
