Trying to solve wave equation with initial condition 
Solve the initial value problem:
$$
u_{tt} - u_{xx} = 0 \\
u(x,0) = 0 \\
u_t(x,0) = \begin{cases} \cos \pi (x-1) & \text{if } 1 < x < 2 \\ 0 & \text{otherwise} \end{cases}
$$
Find and draw the solution at $t=3$ for
(a). $x\in (-\infty, \infty)$.
(b). $x\in (0, \infty)$ with $u_x(0,t) = 0$.
(c). $x\in (-\infty, 3)$ with $u(3,t) = 0$.
(d). $x\in (0,3)$ with $u_x(0,t)=u_x(3,t)=0$.

For (a) since we are in the entire real line, we can just use d'Alembert's solution and obtain $u = \sin(\pi(x-3t))-\sin(\pi(x+3t))$, but how do we do it for the other cases that we have semi infinite domain?
For (d) we can use separation of variables, correct?
 A: You should only ask questions about a single problem. This is not the place for a homework dump. 
With that being said, I'm going to solve the first problem. First, define the primitive of $u_t(x,0)=g(x)$ as
$$ G(s) = \int g(s)\ ds = \begin{cases} \dfrac{1}{\pi}\sin\big(\pi(s-1)\big), & 1 < s < 2 \\ 0, & \text{otherwise} \end{cases} $$
Then the solution given by d'Alembert's formula is
$$ u(x,t) = \frac{G(x+t) - G(x-t)}{2} $$
where you have to check case by case for both $x+t$ and $x-t$. Below is a graph ($x$ vs. $t$) of the 4 characteristic lines going through $x=1$ and $x=2$.

The numbered regions are as follows:
\begin{array}{rrr}
\text{I}: && x - t < 1, && x + t < 1 \\
\text{II}: && x - t < 1, && 1 < x + t < 2 \\
\text{III}: && x - 1 < 1, && x + t > 2 \\
\text{IV}: && 1 < x - t < 2, && 1 < x + t < 2 \\
\text{V}: && 1 < x - t < 2, && x + t > 2 \\
\text{VI}: && x - t > 2, && x + t > 2 \\
\end{array}
Then, you can simplify the solution
$$ u(x,t) = \begin{cases} 
0, && (x,t) \in \text{I, III, VI} \\ 
\dfrac{1}{2\pi}\sin\big(\pi(x+t-1)\big), && (x,t) \in \text{II} \\
\dfrac{1}{2\pi}\Big[\sin\big(\pi(x+t-1)\big) - \sin\big(\pi(x-t-1)\big) \Big], && (x,t) \in \text{IV} \\
-\dfrac{1}{2\pi}\sin\big(\pi(x-t-1)\big), && (x,t) \in \text{V}
\end{cases} $$
