2.6. 1D Wave equation: IBVP

$\renewcommand{\Re}{\operatorname{Re}}$ $\renewcommand{\Im}{\operatorname{Im}}$ $\newcommand{\erf}{\operatorname{erf}}$ $\newcommand{\dag}{\dagger}$ $\newcommand{\const}{\mathrm{const}}$ $\newcommand{\arcsinh}{\operatorname{arcsinh}}$

## 2.6. 1D Wave equation: IBVP

### 1D Wave equation on half-line

Consider wave equation in domain $\{x>0, t>0\}$ and initial conditions \begin{align} &u_{tt}-c^2 u_{xx}=0 \qquad &&x>0,\ t>0\label{eq-2.6.1}\\ &u|_{t=0}=g(x) && x>0,\label{eq-2.6.2}\\ &u_t|_{t=0}=h(x) && x>0.\label{eq-2.6.3} \end{align} Here we take $f(x,t)=0$ for simplicity. Then according to the previous section solution $u(x,t)$ is defined uniquely in the domain $\{t>0, x \ge ct\}$:

where it is given by D'Alembert formula $$u(x,t)= \frac{1}{2}\bigl[ g(x+ct)+g(x-ct)\bigr]+\frac{1}{2c}\int_{x-ct}^{x+ct} h(x')\,dx'. \label{eq-2.6.4}$$ What about domain $\{0 < x < ct\}$? We claim that we need one boundary condition at $x=0, t>0$. Indeed, recall that the general solution of (\ref{eq-2.6.1}) is $$u(x,t)= \phi (x+ct)+\psi (x-ct) \label{eq-2.6.5}$$ where initial conditions (\ref{eq-2.6.2})-(\ref{eq-2.6.3}) imply that \begin{align*} &\phi(x)+\psi(x)= g(x),\\ &\phi (x)-\psi(x)=\frac{1}{c}\int^x_0 h(x')\,dx' \end{align*} for $x>0$ (where we integrated the second equation) and then \begin{align} &\phi(x)= \frac{1}{2}g(x)+\frac{1}{2c}\int^x _0 h(x')\,dx',\qquad &&x>0,\label{eq-2.6.6}\\ &\psi(x)=\frac{1}{2}g(x)-\frac{1}{2c}\int^x _0 h(x')\,dx' \qquad&&x>0. \label{eq-2.6.7} \end{align} Therefore, $\phi(x+ct)$ and $\psi(x-ct)$ are defined respectively as $x+ct>0$ (which is automatic as $x>0,t>0$) and $x-ct>0$ (which is fulfilled only as $x>ct$).

To define $\psi(x-ct)$ as $0< x < ct$ we need to define $\psi(x)$ as $x<0$ and we need a boundary condition as $x=0,t>0$.

Example 1. Consider Dirichlet boundary condition $$u|_{x=0}= p(t), \qquad t>0. \label{eq-2.6.8}$$ Plugging (\ref{eq-2.6.5}) we see that $\phi(ct)+\psi(-ct)=p(t)$ as $t>0$ or equivalently $\phi(-x)+\psi(x)=p(-x/c)$ for $x<0$ (and $-x>0$) where we plugged $t:=-x/c$. Plugging (\ref{eq-2.6.6}) we have \begin{multline} \psi(x)=p(-x/c)-\phi(-x)=\\ p(-x/c)-\frac{1}{2}g(-x) -\frac{1}{2c}\int_0^{-x} h(x')\,dx'. \qquad \label{eq-2.6.9} \end{multline} Then plugging $x:=x+ct$ into (\ref{eq-2.6.6}) and $x:=x-ct$ into (\ref{eq-2.6.9}) and adding we get from (\ref{eq-2.6.4}) that \begin{align} u(x,t)= &\underbracket{\frac{1}{2}g(x+ct)+ \frac{1}{2c}\int_0^{x+ct}h(x')\,dx'}_{=\phi(x+ct)}\notag \\ +&\underbracket{p(t-x/c)-\frac{1}{2}g(ct-x) -\frac{1}{2c}\int_0^{ct-x} h(x')\,dx'}_{=\psi(x-ct)}. \qquad \label{eq-2.6.10} \end{align} This formula defines $u(x,t)$ for $0< x< ct$. Recall that for $x>ct$ solution is given by (\ref{eq-2.6.4}).

1. For $g=h=0$ (wave is generated by the perturbation at the (left) end) u(x,t)= \left\{\begin{aligned} & 0\qquad && 0 < ct < x,\\ & p(t-x/c) \qquad && 0 < x < ct. \end{aligned}\right. \label{eq-2.6.11}
2. For $g(x)=\phi(x)$, $h(x)=c\phi'(x)$ , $p=0$ (wave initially running to the left and then reflected from the (left) end) u(x,t)=\left\{ \begin{aligned} & \phi(x+ct)\qquad && 0 < ct < x,\\ & \phi(x+ct)-\phi(ct-x) && 0 < x < ct. \end{aligned}\right. \label{eq-2.6.12}

Example 2. Alternatively, consider Neumann boundary condition $$u_x|_{x=0}= q(t), \qquad t>0. \label{eq-2.6.13}$$

Plugging (\ref{eq-2.6.5}) we see that $\phi'(ct)+\psi'(-ct)=q(t)$ as $t>0$ or equivalently $\phi(-x)-\psi(x)=c\int_0^{-x/c}q(t')\,dt'$ for $x< 0$ (and $-x>0$), where we integrated first and then plugged $t:=-x/c$. (see also Remark 1).

Plugging (\ref{eq-2.6.6}) we have \begin{multline} \psi(x)=-c\int_0^{-x/c}q(t')\,dt'+\phi(x)=\\ -c\int_0^{-x/c}q(t')\,dt'+\frac{1}{2}g(-x) + \frac{1}{2c}\int_0^{-x} h(x')\,dx'. \qquad \label{eq-2.6.14} \end{multline} Then plugging $x:=x+ct$ into (\ref{eq-2.6.6}) and $x:=x-ct$ into (\ref{eq-2.6.14}) and adding we get from (\ref{eq-2.6.4}) that \begin{align} u(x,t)&= \underbracket{\frac{1}{2}g(x+ct)+ \frac{1}{2c}\int_0^{x+ct}h(x')\,dx'}_{=\phi(x+ct)}\notag \\ &\underbracket{-c\int _0^{t-x/c}q(t')\,dt'+\frac{1}{2}g(ct-x) +\frac{1}{2c}\int_0^{ct-x} h(x')\,dx'}_{=\psi(x-ct)}. \qquad\label{eq-2.6.15} \end{align} This formula defines $u(x,t)$ as $0< x< ct$. Recall that for $x> ct$ solution is given by (\ref{eq-2.6.4}).

In particular

1. For $g=h=0$ (wave is generated by the perturbation at the (left) end) u(x,t)= \left\{\begin{aligned} & 0\qquad && 0< ct < x,\\ & -c\int_0^{t-x/c} q(t')\,dt'&& 0 < x < ct. \end{aligned}\right. \label{eq-2.6.16}
2. For $g(x)=\phi(x)$, $h(x)=c\phi'(x)$, $q=0$ (wave initially running to the left and then reflected from the (left) end) u(x,t)= \left\{ \begin{aligned} & \phi(x+ct)\qquad && 0 < ct < x,\\ & \phi(x+ct)+\phi(ct-x) && 0 < x < ct. \end{aligned}\right. \label{eq-2.6.17}

Remark 1. One can ask in Example 2, why we took $C=0$ in $\phi(-x)-\psi(x)=c\int_0^{-x/c}q(t')\,dt'+C$. The short answer is that this choice provides continuity of the solution $u(x,t)$ in $(0,0)$. But then why we care about this here but not in Example 1? Again the short answer is that now without this extra restriction we do not have uniqueness of the solution.

The proper answer is more complicated: the discontinuous solutions could be properly understood only in the framework of weak solutions (see Section 11.4); then, if there are several solutions but only one of them is continuous, it is the only correct one. The same reasoning applies in Example 3 and Example 4 below.

Example 3. Alternatively, consider boundary condition $$(\alpha u_x+\beta u_t)|_{x=0}= q(t), \qquad t>0. \label{eq-2.6.18}$$ Again we get equation to $\psi(-ct)$: $(\alpha -c \beta)\psi'(-ct)+ (\alpha +c \beta) \phi' (ct)=q(t)$ and everything works well as long as $\alpha\ne c\beta$.

Exercise. Explain why we need $\alpha\ne c\beta$.

Example 4. Alternatively, consider Robin boundary condition $$(u_x+\sigma u)|_{x=0}= q(t), \qquad t>0. \label{eq-2.6.19}$$ and we get $\psi'(-ct)+\sigma \psi (-ct) + \phi'(ct)+\sigma \phi (ct)=q(t)$ or, equivalently, $$\psi'(x)+\sigma \psi (x)=q(-x/c)- \phi'(-x)+\sigma \phi (-x) \label{eq-2.6.20}$$ where the right-hand expression is known.

In this case we define $\psi(x)$ at $x<0$ solving ODE (\ref{eq-2.6.20}) as we know $\psi(0)=\frac{1}{2}g(0)$ from (\ref{eq-2.6.7}).

Visual examples (animation): Dirichldet, Neumann, Robin

Example 5. Consider two wave equations \begin{align*} &u_{tt}-c_1^2u_{xx}=0 && \text{as } x>0,\\[3pt] &u_{tt}-c_2^2u_{xx}=0 && \text{as } x<0, \end{align*} intertwined through boundary conditions \begin{align*} u|_{x=0^+}&=u|_{x=0^-}\\[3pt] u_x|_{x=0^+}&=k u_x|_{x=0^-} \end{align*} with $k>0$. Again we are looking for continuous $u(x,t)$.

Assume that $u(x,0)=0$ for $x<0$. In this case

1. $u(x,t)= \phi (t+c_1^{-1} x) +\psi (t-c_1^{-1} x)$ for $x >0$ and
2. $u(x,t)=\chi(t + c_2^{-1} x)$ for $x< 0$

with $\psi(t) =-\beta \phi(t)$, $\chi(t)=\alpha \phi(t)$, $\alpha = 2c_2(kc_1+c_2)^{-1}$, $\beta=(kc_1-c_2)(kc_1+c_2)^{-1}$.

Then we have two outgoing waves: reflected wave $\psi (t-c_1^{-1} x)$ and refracted wave $\chi(t+c_2^{-1} x)$.

Visual example (animation)

Example 6. Find continuous solution to \begin{align} &u_{tt}-9u_{xx}=0, && -\infty< t<\infty,\ x>-t,\label{eq-2.6.21}\\ &u|_{t=0}= 4\cos (x), && x>0,\label{eq-2.6.22}\\ &u_t|_{t=0}=18\sin(x), && x>0,\label{eq-2.6.23}\\ &u_x|_{x=-t}= 0, &&-\infty <t <\infty.\label{eq-2.6.24} \end{align}

Solution The general solution to (\ref{eq-2.6.21}) is $$u(x,t) = \phi (x+3t) + \psi (x-3t). \label{eq-2.6.25}$$

Plugging into (\ref{eq-2.6.22}) and (\ref{eq-2.6.23}) we get \begin{align*} &\phi (x)+\psi(x)= 4\cos(x)&& x>0,\\ &\phi(x)-\psi(x)=- 6\cos(x) \end{align*} (the second equation after division by $3$ and integration). Therefore \begin{align} &\phi (x)= - \cos(x)&& \psi(x)= 5\cos(x), && x>0, \label{eq-2.6.26} \end{align} which defines solution \begin{gather*} u= -\cos(x+3t) +5\cos (x-3t) \end{gather*} in the zone ${(x,t)\colon x> 3|t|}$.

Plugging (\ref{eq-2.6.25}) into (\ref{eq-2.6.24}) we get $$\phi '(2t) +\psi '(-4t) =0, \label{eq-2.6.-27}$$ which for $t>0$ (we know $\phi$) becomes \begin{multline*} \sin(2t) + \psi'(-4t) =0\implies \psi'(x) = -\sin (-x/2)=\sin (x/2) \implies\\ \psi(x) = -2\cos(x/2)+C \end{multline*} and since $\psi$ must be continuous at $0$ we get $C=7$, $\psi(x) = -2\cos(x/2) +7$ and we get solution \begin{gather*} u= -\cos(x+3t) - 2\cos ((x-3t)/2) +7 \end{gather*} in the zone ${(x,t)\colon t>0, -t<x<3t}$.

For $t<0$ we know $\psi$ and (\ref{eq-2.6.-27}) becomes \begin{multline*} \phi'(2t) -5 \sin(-4t) =0\implies \phi'(x) = 5\sin (-2x)=-5\sin(x) \implies \\ \phi(x) = \frac{5}{2}\cos(2x)+D \end{multline*} and since $\phi$ must be continuous at $0$ we get $D=-\frac{7}{2}$, $\phi(x) = \frac{5}{2}\cos(2x+6)-\frac{7}{2}$ and we get solution \begin{gather*} u= \frac{5}{2}\cos(2x)-\frac{7}{2} + 5\cos(x-3t) \end{gather*} in the zone ${(x,t)\colon t<0, -t<x<-3t}$.

Example 7.

Find continuous solution to \begin{align} &9u_{tt}-u_{xx}=0, && -\infty< t<\infty,\ x>-t,\label{eq-2.6.x}\\ &u|_{t=0}= 4\sin (3x), && x>0,\label{eq-2.6.y}\\ &u_t|_{t=0}=-2\cos(3x), && x>0,\label{eq-2.6.z}\\ &u|_{x=-t}=u_x|_{x=-t}=0,&&0<t <\infty.\label{eq-2.6.w} \end{align}

Solution. The general solution to (\ref{eq-2.6.x}) is $$u(x,t) = \phi (x+\frac{t}{3}) + \psi (x-\frac{t}{3}). \label{eq-2.6.a}$$

Plugging into (\ref{eq-2.6.y}) and (\ref{eq-2.6.z}) we get \begin{align*} &\phi (x)+\psi(x)= 4\sin(3x)&& x>0,\\ &\phi(x)-\psi(x)=- 2\sin(3x) \end{align*} (the second equation after division by $\frac{1}{3}$ and integration). Therefore \begin{align} &\phi (x)= \sin(3x),&& \psi(x)= 3\sin(3x), && x>0, \label{eq-2.6.b} \end{align} which defines solution \begin{gather*} u=\sin(3x+t) +3\sin (3x-t) \end{gather*} in the zone $\{(x,t)\colon x> \frac{|t|}{3}\}$.

Plugging (\ref{eq-2.6.a}) into (\ref{eq-2.6.w}) we get $$\phi(-\frac{2}{3}t)+ \psi(-\frac{4}{3}t) =0,\qquad \phi'(-\frac{2}{3}t)+ \psi'(-\frac{4}{3}t) =0, \qquad t>0; \label{eq-2.6.-c}$$

Integrating the last equation we get $2\phi(-\frac{2}{3}t)+ \psi(-\frac{4}{3}t) =C$ for $t>0$, then $\phi (x) =C$, $\psi (x) =-C$ for $x<0$ and since $\phi$ and $\psi$ must be continuous at $0$ we get $C=0$, and we get solution

\begin{gather*} u(x,t)= \left\{ \begin{aligned} &0 && x < -\frac{t}{3},\ t >0,\\ &\sin(3x+t) &&-\frac{t}{3}<x<\frac{t}{3},\ t >0. \end{aligned}\right. \end{gather*}

Example 8. Find continuous solution to \begin{align} &u_{tt}-4u_{xx}=0, && -\infty< t<\infty,\ x> 0,\label{B-3-1}\\ &u|_{t=0}= 4\cos (x), && x>0,\label{B-3-2}\\ &u_t|_{t=0}=16\sin(x), && x>0,\label{B-3-3}\\ &(u_x+u)|_{x=0}= 0, &&-\infty <t <\infty.\label{B-3-4} \end{align}

Solution. The general solution to (\ref{B-3-1}) is $$u(x,t) = \phi (x+3t) + \psi (x-3t). \label{B-3-5}$$

Plugging into (\ref{B-3-2}) and (\ref{B-3-3}) we get \begin{align*} &\phi (x)+\psi(x)= 18e^{-x}&& x>0,\\ &\phi(x)-\psi(x)=- 16 e^{-x} \end{align*} (the second equation after division by $6$ and integration). \pause Therefore \begin{align} &\phi (x)= e^{-x},&& \psi(x)= 17 e^{-x}, && x>0, \label{B-3-6} \end{align} which defines solution $u= e^{-x-3t}+ 17 e^{-x+3t}$ in the zone $\{(x,t)\colon x> 3|t|\}$.

Plugging (\ref{B-3-5}) into (\ref{B-3-4}) we get $$7\phi'(3t) -5\psi'(-3t)=0, \label{B-3-7}$$ which for $t>0$ (we know $\phi$) becomes \begin{gather*} \psi'(-3t)=- \frac{7}{5} e^{-3t}\implies \psi'(x)= - \frac{7}{5} e^{x} \implies \psi(x)= - \frac{7}{5} e^{x} +C \end{gather*} and since $\psi$ must be continuous at $0$ we get $C=\frac{92}{5}$, $\psi(x) = - \frac{7}{5} e^{x} + \frac{92}{5}$ and we get solution in the zone $u= e^{-x-3t} - \frac{7}{5} e^{x-3t} + \frac{92}{5}$ in the zone $\{(x,t)\colon t>0, 0<x<3t\}$.

For $t<0$ we know $\psi$ and (\ref{B-3-7}) becomes \begin{gather*} \phi'(3t) = -\frac{85}{7} e^{3t} \implies \phi'(x) = -\frac{85}{7} e^{x}\implies \phi(x)=-\frac{85}{7} e^{x} +D \end{gather*} and since $\phi$ must be continuous at $0$ we get $D=\frac{92}{7}$, $\phi(x) = -\frac{85}{7} e^{x} + \frac{92}{7}$ and we get solution in the zone $u= -\frac{85}{7} e^{x+3t} + \frac{92}{7} + 17 e^{-x+3t}$ in the zone $\{(x,t)\colon t<0, 0<x<-3t\}$.

### 1D Wave equation on the finite interval

Consider wave equation in domain $\{a< x< b, t>0\}$ and initial conditions \begin{align} &u_{tt}-c^2 u_{xx}=0 \qquad &&a<x<b,\ t>0\label{eqn-2.6.21}\\ &u|_{t=0}=g(x) && a< x< b, \label{eqn-2.6.22}\\ &u_t|_{t=0}=h(x) && a< x< b.\label{eqn-2.6.23} \end{align} Here we take $f(x,t)=0$ for simplicity. Then according to the previous section solution $u(x,t)$ is defined uniquely in the characteristic triangle $ABC$.

1. However $\phi (x)$, $\psi(x)$ are defined for $a< x< b$.
2. Now the boundary condition on the left end (f. e. $u|_{x=a}=p_l(t)$, or $u_x|_{x=a}=q_l(t)$, or more general condition) allows us to find $\psi (a-ct)$ for $0< t< (b-a)/c$ and then $\psi(x-ct)$ is defined in $ABB''A'$. Similarly the boundary condition on the right end (f. e. $u|_{x=b}=p_r(t)$, or $u_x|_{x=b}=q_r(t)$, or more general condition) allows us to find $\phi (b+ct)$ for $0< t< (b-a)/c$ and then $\phi(x+ct)$ is defined in $ABB'A''$. So, $u$ is defined in the intersection of those two domains which is $AA'C'B'B$.
3. Continuing this process in steps we define $\phi (x+ct)$, $\psi (x-ct)$ and $u(x,t)$ in expanding "up" set of domains.

### Half-line: method of continuation

Consider wave equation in domain $\{x>0, t>0\}$, initial conditions, and Dirichlet boundary condition \begin{align} &u_{tt}-c^2 u_{xx}=f(x,t) \qquad &&x>0, \label{eqn-2.6.24}\\ &u|_{t=0}=g(x) && x>0,\label{eqn-2.6.25}\\ &u_t|_{t=0}=h(x) && x>0,\label{eqn-2.6.26} \\ &u|_{x=0}=0. \label{eqn-2.6.27} \end{align} Alternatively, instead of (\ref{eqn-2.6.27}) we consider Neumann boundary condition \begin{align} & u_x |_{x=0}=0.\qquad&&\qquad\quad \tag*{$(48)'$}\label{eqn-2.6.27-'} \end{align}

Remark 1. It is crucial that we consider either Dirichlet or Neumann homogeneous boundary conditions.

To deal with this problem consider first IVP on the whole line: \begin{align} &U_{tt}-c^2 U_{xx}=F(x,t) \qquad &&x>0,\label{eqn-2.6.28}\\ &U|_{t=0}=G(x) && x>0,\label{eqn-2.6.29}\\ &U_t|_{t=0}=H(x) && x>0,\label{eqn-2.6.30} \end{align} and consider $V(x,t)= \varsigma U(-x,t)$ with $\varsigma =\pm 1$.

Proposition 1. If $U$ satisfies (\ref{eqn-2.6.28})-(\ref{eqn-2.6.30}) then $V$ satisfies similar problem albeit with right-hand expression $\varsigma F(-x,t)$, and initial functions $\varsigma G(-x)$ and $\varsigma H(-x)$.

Proof. Plugging $V$ into equation we use the fact that $V_t(x,t)=\varsigma U_t (-x,t)$, $V_x(x,t)=-\varsigma U_x (-x,t)$, $V_{tt}(x,t)=\varsigma U_{tt} (-x,t)$, $V_{tx}(x,t)=-\varsigma U_{tx} (-x,t)$, $V_{xx}(x,t)=\varsigma U_{xx} (-x,t)$ etc and exploit the fact that wave equation contains only even-order derivatives with respect to $x$.

Note that if $F,G,H$ are even functions with respect to $x$, and $\varsigma=1$ then $V(x,t)$ satisfies the same IVP as $U(x,t)$. Similarly, if $F,G,H$ are odd functions with respect to $x$, and $\varsigma=-1$ then $V(x,t)$ satisfies the same IVP as $U(x,t)$.

However we know that solution of (\ref{eqn-2.6.28})-(\ref{eqn-2.6.30}) is unique and therefore $U(x,t)=V(x,t)=\varsigma U(-x,t)$.

Therefore

Corollary 1.

1. If $\varsigma=-1$ and $F,G,H$ are odd functions with respect to $x$ then $U(x,t)$ is also an odd function with respect to $x$.
2. If $\varsigma=1$ and $F,G,H$ are even functions with respect to $x$ then $U(x,t)$ is also an even function with respect to $x$.

However we know that

1. odd function with respect to $x$ vanishes as $x=0$;
2. derivative of the even function with respect to $x$ vanishes as $x=0$

and we arrive to

Corollary 2.

1. In the framework of Proposition 1[1] $U$ satisfies Dirichlet boundary condition;
2. In the framework of Proposition 1[2] $U$ satisfies Neumann boundary condition.

Therefore

Corollary 3.

1. To solve (\ref{eqn-2.6.24})-(\ref{eqn-2.6.26}), (\ref{eqn-2.6.27}) we need to take an odd continuation of $f,g,h$ to $x<0$ and solve the corresponding IVP;
2. To solve (\ref{eqn-2.6.24})-(\ref{eqn-2.6.26}), \ref{eqn-2.6.27-'} we need to take an even continuation of $f,g,h$ to $x<0$ and solve the corresponding IVP.

So far we have not used much that we have exactly wave equation (similar arguments with minor modification work for heat equation as well etc). Now we apply D'Alembert formula (2.5.4): \begin{multline*} u(x,t)= \frac{1}{2}\bigl( G(x+ct)+G(x-ct) \bigr) + \frac{1}{2c}\int_{x-ct} ^{x+ct} H(x')\,dx' +\\ \frac{1}{2c} \int_0^t \int _{x-c(t-t')} ^{x+c(t-t')} F(x',t')\, dx' dt' \end{multline*} and we need to take $0< x< ct$, resulting for $f=0\implies F=0$ $$u(x,t)= \frac{1}{2}\bigl( g(ct+x)- g(ct-x) \bigr) + \frac{1}{2c}\int_{ct-x} ^{ct+x} h(x')\,dx' ,\qquad \label{eqn-2.6.31}$$ and \begin{multline} u(x,t)= \frac{1}{2}\bigl( g(ct+x)+ g(ct-x) \bigr) +\\ \frac{1}{2c}\int_0 ^{ct-x} h(x')\,dx' + \frac{1}{2c}\int_0 ^{ct+x} h(x')\,dx'\qquad \tag*{(55)'}\label{eqn-2.6.31-'} \end{multline} for boundary condition (\ref{eqn-2.6.27}) and \ref{eqn-2.6.27-'} respectively.

Example 9. Consider wave equation with $c=1$ and let $f=0$,

1. $g= \sin (x)$, $h=0$ and Dirichlet boundary condition. Obviously $G(x)=\sin (x)$ (since we take odd continuation and $\sin(x)$ is an odd function). Then $$u(x,t)=\frac{1}{2}\bigl( \sin (x+t)+\sin (x-t)\bigr)= \sin (x)\cos (t). \label{eqn-2.6.32}$$
2. $g= \sin (x)$, $h=0$ and Neumann boundary condition. Obviously $G(x)=-\sin (x)$ as $x<0$ (since we take even continuation and $\sin(x)$ is an odd function). Then $u$ is given by (\ref{eqn-2.6.32}) for $x\ >t\ >0$ and $$u(x,t)=\frac{1}{2}\bigl( \sin (x+t)-\sin (x-t)\bigr)= \sin (t)\cos(x) \label{eqn-2.6.33}$$ as $0< x< t$.
3. $g= \cos (x)$, $h=0$ and Neumann boundary condition. Obviously $G(x)=\cos (x)$. Then $$u(x,t)=\frac{1}{2}\bigl( \cos (x+t)+\cos (x-t)\bigr)= \cos (x)\cos (t). \label{eqn-2.6.34}$$
4. $g= \cos (x)$, $h=0$ and Dirichlet boundary condition. Obviously $G(x)=-\cos (x)$ as $x<0$. Then $u$ is given by (\ref{eqn-2.6.35}) for $x>t>0$ and $$u(x,t)=\frac{1}{2}\bigl( \cos (x+t)-\cos (x-t)\bigr)= -\sin (t)\sin (x) \label{eqn-2.6.35}$$ as $0< x< t$.

### Finite interval: method of continuation

Consider the same problem albeit on interval $0< x< l$ with either Dirichlet or Neumann condition on each end. Then we need to take odd continuation through "Dirichlet end" and even continuation through "Neumann end". On figures below we have respectively Dirichlet conditions on each end (indicated by red), Neumann conditions on each end (indicated by green), and Dirichlet condition on one end (indicated by red) and Neumann conditions on another end (indicated by green). Resulting continuations are $2l$, $2l$ and $4l$ periodic respectively.

2.6.A. Physical examples of boundary conditions