Wave equation piecewise initial condition I have the following homogeneous 1-dimensional wave equation with $c = 1$:
$$u_{tt} - u_{xx} = 0$$
With initial data
$$ u(x,0) = \phi(x) =   \begin{cases} 
      1 & |x| \leq 1 \\
      0 & |x| > 1 \\
   \end{cases}$$
and $$u_{t}(x, 0) = 0$$
I am asked to find the general solution for any $x \in \mathbb{R}, t \geq 0$ in 3 cases: 
$0 < t < 1$, $t = 1$, and $t > 1$. 
So far, I've come up with the general solution using D'Alembert's formula: $$u(x, t) = \frac{1}{2} [\phi(x - t) + \phi(x + t)]$$
However, I'm having trouble evaluating this solution in each of the three cases. Any help would be much appreciated. 
 A: $$u_{tt} - u_{xx} = 0$$
The general solution (without boundary condition) is :
$$u(x,y)=f(x+t)+g(x+t)$$
The functions $f$ and $g$ are not necessarily the same.
The condition $u(x,0) = \phi(x)=f(x)+g(x)$ implies
$\quad\begin{cases}
f(x)=\frac12\phi(x)+h(x) \\
g(x)=\frac12\phi(x)-h(x)
\end{cases}$
$$ u(x,t)=\frac12\phi(x+t)+h(x+t)+\frac12\phi(x-t)-h(x-t)$$
$h(x)$ is an arbitrary function to be determined by the  condition $u_t(x,0)=0$
$$ u_t(x,t)=\frac12\phi'(x+t)+h'(x+t)-\frac12\phi'(x-t)+h'(x-t)$$
$$ u_t(x,0)=\frac12\phi'(x)+h'(x)-\frac12\phi'(x)+h'(x)$$
$$u_t(x,0)=0=2h'(x) \quad\implies\quad h(x)=C$$
Your solution is confirmed :
$$ u(x,t)=\frac12\phi(x+t)+\frac12\phi(x-t)$$
The function $\phi$ is a given piecewise function :
$$\phi(x) =   \begin{cases} 
      1 & |x| \leq 1 \\
      0 & |x| > 1 \\
   \end{cases}$$
$$ u(x,t)=\frac12\begin{cases} 
      1 & x+t \leq 1 \\
      1 & -x-t \leq 1 \\
      0 & x+t > 1 \\
      0 & -x-t > 1 \\
   \end{cases}+
\frac12\begin{cases} 
      1 & x-t \leq 1 \\
      1 & -x+t \leq 1 \\
      0 & x-t > 1 \\
      0 & -x+t > 1 \\
   \end{cases}$$
$$ u(x,t)=\frac12\begin{cases} 
      1 & x \leq 1-t \\
      1 & x \geq -1-t \\
      0 & x > 1-t \\
      0 & x < -1-t \\
   \end{cases}+
\frac12\begin{cases} 
      1 & x \leq 1+t \\
      1 & x \geq -1+t \\
      0 & x > 1+t \\
      0 & x < -1+t \\
   \end{cases}$$
We have to consider several regions limited by 
$x=1-t \quad;\quad x=1+t \quad;\quad x=-1-t \quad;\quad x=-1+t\quad$ 
For $\quad \boxed{0<t<1}$ :
Case $\quad x>1+t \:: \quad u=\frac12(0)+\frac12(0)=0$.
Case $\quad 1-t<x\leq 1+t \: : \quad u=\frac12(0)+\frac12(1)=\frac12$.
Case $\quad -1+t<x\leq 1-t \: : \quad u=\frac12(1)+\frac12(1)=1$.
Case $\quad -1-t\leq x< -1+t \: : \quad u=\frac12(1)+\frac12(0)=\frac12$.
Case $\quad x\leq -1-t \: : \quad u=\frac12(0)+\frac12(0)=0$.
$$u(x,t)=\begin{cases}
0 &&  x>1+t \\
\frac12 && 1-t<x\leq 1+t \\
1 && -1+t<x\leq 1-t\\
\frac12 && -1-t\leq x< -1+t\\
0 && x\leq -1-t
\end{cases}$$ 
The above formulas are not valid for $t>1$ which is outside the domain of study specified in the wording of the question.

IN ADDITION :
For $\quad \boxed{t>1}$ :
$$u(x,t)=\begin{cases}
0 &&  x>1+t \\
\frac12 && -1+t<x\leq 1+t \\
0 && 1-t<x\leq -1+t\\
\frac12 && -1-t\leq x< 1-t\\
0 && x\leq -1-t
\end{cases}$$
