$\renewcommand{\Re}{\operatorname{Re}}$ $\renewcommand{\Im}{\operatorname{Im}}$ $\newcommand{\erf}{\operatorname{erf}}$ $\newcommand{\dag}{\dagger}$ $\newcommand{\const}{\mathrm{const}}$ $\newcommand{\arcsinh}{\operatorname{arcsinh}}$
We solved IVP with homogeneous ($=0$) initial data for inhomogeneous wave equation. Before this we solved IVP with inhomogeneous initial data for homogeneous wave equation. Now consider both inhomogeneous data and equation. So we consider problem (2.4.6)-(2.4.8): \begin{align} &u_{tt}-c^2u_{xx}=f(x,t),\label{eq-2.5.1} \\[3pt] &u|_{t=0}=g(x),\label{eq-2.5.2}\\[3pt] &u_t|_{t=0}=h(x) \label{eq-2.5.3} \end{align} when neither $f$, nor $g,h$ are necessarily equal to $0$.
The good news is that our equation is linear and therefore $u=u_2+u_1$ where $u_1$ satisfies problem with right-hand function $f(x,t)$ but with $g$ and $h$ replaced by $0$ and $u_2$ satisfies the same problem albeit with $f$ replaced by $0$ and original $g,h$: \begin{align*} &u_{1tt}-c^2u_{1xx}=f(x,t), \qquad &&u_{2tt}-c^2u_{2xx}=0, \\[3pt] &u_1|_{t=0}=0, && u_2|_{t=0}=g(x),\\[3pt] &u_{1t}|_{t=0}=0 &&u_{2t}|_{t=0}=h(x). \end{align*}
Exercise 1. Prove it.
Then $u_1$ is given by (2.4.11), and $u_2$ is given by (2.3.14) (with $(f,g)\mapsto (g,h)$) and adding them we arrive to the final \begin{multline} u(x,t)= \underbracket{ \frac{1}{2}\bigl[g(x+ct)+g(x-ct)\bigr]+\frac{1}{2c}\int_{x-ct}^{x+ct} h(y)\,dy}_{=u_2}+\\[3pt] \underbracket{\frac{1}{2c} \iint_{\Delta (x,t)} f(x',t' )\,dx\,d t' }_{=u_1}. \label{eq-2.5.4} \end{multline} where recall that $\Delta(x,t)$ is a characteristic triangle:
This formula is also called D'Alembert formula.
Remark 1. Note that integral of $h$ in $u_2$ is taken over base of the characteristic triangle $\Delta(x,t)$ and $g$ is taken in the ends of this base.
We discuss formula (\ref{eq-2.5.4}) in details in the next lecture and now let us derive it by a completely different method. Again, in virtue of (2.3.14) we need to consider only the case when $g=h=0$.
Let us define an auxilary function $U(x,t,\tau)$ ($0< \tau < t $) as a solution of an auxilary problem \begin{align} &U_{tt}-c^2U_{xx}=0,\label{eq-2.5.5} \\[3pt] &U|_{t=\tau}=0,\label{eq-2.5.6}\\[3pt] &U_t|_{t=\tau}=f(x,\tau). \label{eq-2.5.7} \end{align} We claim that
Proposition 1. \begin{equation} u(x,t)=\int_0^t U(x,t,\tau)\,d\tau \label{eq-2.5.8} \end{equation} is a required solution.
Proof. Note first that we can differentiate (\ref{eq-2.5.8}) by $x$ easily: \begin{equation} u_x=\int_0^t U_x (x,t,\tau)\,d\tau,\qquad u_{xx}=\int_0^t U_{xx} (x,t,\tau)\,d\tau \label{eq-2.5.9} \end{equation} and so on. Let us find $u_t$. Note that $u$ depends on $t$ through its upper limit and through integrand. We apply formula \begin{multline} \frac{d\ }{dt}\Bigl(\int_{\alpha(t)}^{\beta(t)} F (t,\tau)\,d\tau\Bigr)=\\ -F(t,\alpha(t))\alpha'(t)+F(t,\beta(t))\beta'(t)+ \int_{\alpha(t)}^{\beta(t)} \frac{\partial F}{\partial t} (t,\tau)\,d\tau\qquad \label{eq-2.5.10} \end{multline} which you should know but we will prove it anyway.
As $\alpha=0$, $\beta=t$ we have $\alpha'=0$, $\beta'=1$ and \begin{equation*} u_t=U(x,t,t)+\int_0^t U_t (x,t,\tau)\,d\tau. \end{equation*} But $U(x,t,t)=0$ due to (\ref{eq-2.5.6}) and therefore \begin{equation} u_t=\int_0^t U_t (x,t,\tau)\,d\tau. \label{eq-2.5.11} \end{equation} We can differentiate this with respect to $x$ as in (\ref{eq-2.5.9}). Let us differentiate by $t$. Applying the same (\ref{eq-2.5.10}) we get \begin{equation*} u_{tt}=U_t(x,t,t)+\int_0^t U_{tt} (x,t,\tau)\,d\tau. \end{equation*} Due to (\ref{eq-2.5.7}) $U_t(x,t,t)=f(x,t)$: \begin{equation*} u_{tt}=f(x,t)+\int_0^t U_{tt} (x,t,\tau)\,d\tau. \end{equation*} Therefore \begin{equation*} u_{tt}-c^2u_{xx}=f(x,t)+\int_0^t \underbracket{\bigl(U_{tt}-c^2U_{xx}\bigr)}_{=0} (x,t,\tau)\,d\tau =f(x,t) \end{equation*} where integrand vanishes due to (\ref{eq-2.5.5}). So, $u$ really satisfies (\ref{eq-2.5.1}). Due to (\ref{eq-2.5.8}) and (\ref{eq-2.5.11}) $u|_{t=0}=u_t|_{t=0}=0$. QED.
Formula (\ref{eq-2.5.8}) is Duhamel integral formula.
Remark 2.
Now we claim that \begin{equation} U(x,t,\tau)= \frac{1}{2c} \int _{x-c(t-\tau)} ^{x+c(t-\tau)} f(x',\tau)\,dx'. \label{eq-2.5.12} \end{equation} Really, changing variable $t'=t-\tau$ we get the same problem albeit with $t'$ instead of $t$ and with initial data at $t'=0$.
Plugging (\ref{eq-2.5.12}) into (\ref{eq-2.5.8}) we get \begin{equation} u(x,t)=\int_0^t \frac{1}{2c} \Bigl[\int_{x-c(t-\tau)} ^{x+c(t-\tau)} f(x',\tau)\,dx'\Bigr]\,d\tau. \label{eq-2.5.13} \end{equation}
Exercise 2. Rewrite double integral (\ref{eq-2.5.13}) as a $2D$-integral in the right-hand expression of (2.4.11).
Proof of (\ref{eq-2.5.10}). Let us plug $\gamma$ into $F(x,t,\tau)$ instead of $t$. Then integral $I(t)=J(\alpha(t),\beta(t),\gamma(t))$ with $J(\alpha,\beta,\gamma)= \int_\alpha^\beta F(\gamma,\tau)\,d\tau$ and by chain rule $I'(t)=J_\alpha \alpha'+J_\beta \beta'+J_\gamma \gamma'$.
But $J_\alpha=-F(\gamma,\alpha)$, $J_\beta=F(\gamma,\beta)$ (differentiation by lower and upper limits) and $J_\gamma=\int_\alpha^\beta F_\gamma (\gamma,\tau)\,d\tau$. Plugging $\gamma=t$, $\gamma'=1$ we arrive to (\ref{eq-2.5.10}).
Recall formula (\ref{eq-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'\\[3pt] +\frac{1}{2c} \iint_{\Delta (x,t)} f(x',t' )\,dx’d t' \end{multline*} where $\Delta (x,t)$ is the same characteristic triangle as above:
Therefore
Proposition 2. Solution $u(x,t)$ depends only on the right hand expression $f$ in $\Delta(x,t)$ and on the initial data $g,h$ on the base of $\Delta(x,t)$.
Definition 1. $\Delta(x,t)$ is a triangle of dependence for point $(x,t)$.
Conversely, if we change functions $g,h$ only near some point $(\bar{x},0)$ then solution can change only at points $(x,t)$ such that $(\bar{x},0)\in \Delta(x,t)$; let $\Delta^+(\bar{x},0)$ be the set of such points $(x,t)$:
Definition 2. $\Delta^+(\bar{x},0)$ is a triangle of influence for point $(\bar{x},0)$.
Remark 3.
We see also that
Proposition 3. Solution propagates with the speed not exceeding $c$.
In examples we rewrite the last term in (\ref{eq-2.5.4}) as a double integral: \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'\\[3pt] +\frac{1}{2c} \int_0^t \int_{x-c(t-t')}^{x+c(t-t')} f(x',t' )\,dx'd t' \label{eq-2.5.14}\qquad \end{multline}
Example 1. \begin{align*} &u_{tt}-4u_{xx}= \sin(x)\cos( t),\\ &u|_{t=0}= 0,\\ &u_t|_{t=0}= 0. \end{align*} Then $c=2$ and according to (\ref{eq-2.5.14}) \begin{align*} u(x,t) &= \frac{1}{4} \int_0^t \int_{x-2(t-t')}^{x+2(t-t')} \sin (x')\cos( t')\,dx' d t'\\ &=\frac{1}{4} \int_0^t \Bigl[\cos \bigl(x-2(t-t')\bigr)-\cos \bigl( x+2(t-t')\bigr) \Bigr] \cos( t')\, d t' \\ &=\frac{1}{2} \int_0^t \sin(x) \sin (2(t-t'))\cos( t')\, d t'\\ &=\frac{1}{4}\sin(x) \int_0^t \Bigl[\sin (2(t-t')+t')+\sin( 2(t-t')-t')\Bigr]\, d t'\\ & =\frac{1}{4}\sin(x) \int_0^t \Bigl[\sin (2t-t')+\sin( 2t-3t')\Bigr]\, d t' \\ &=\frac{1}{4}\sin(x)\Bigl[\cos (2t-t')+\frac{1}{3}\cos( 2t-3t')\Bigr]_{t'=0}^{t'=t}\\ &\qquad\qquad\qquad\qquad\qquad\qquad =\frac{1}{3}\sin(x)\Bigl[\cos(t)-\cos(2t) \Bigr]. \end{align*} Sure, separation of variables would be simpler here.
Example 2.
Find solution $u(x,t)$ to \begin{align} &2u_{tt}- 18 u_{xx}= \frac{36}{t^2+1} \qquad -\infty <x < \infty,\ -\infty < t<\infty, \label{eq-2.5.15}\\ &u|_{t=0}=x^2 , \quad u_t|_{t=0}=9x. \label{eq-2.5.16} \end{align}
If (\ref{eq-2.5.15})--(\ref{eq-2.5.16}) are fulfilled for $0< x <6$ only, where solution is uniquely defined?
Solution. Using D'Alembert's formula \begin{align*} u(x,t)=& \underline{\frac{1}{2} \bigl( (x+3t)^2 + (x-3t)^2)\bigr)}+ \underline{\frac{3}{2}\int_{x-3t}^{x+3t} \xi\,d\xi} \\ &\qquad\qquad+ 3 \int_{0}^t \int_{x-3(t-\tau)} ^ {x+3(t-\tau)} \frac{ 1 }{\tau^2 +1} \,d\xi d\tau\\ =&\underline{x^2+9 t^2} + \underline{9xt}+18 \int_0^t \frac{ t-\tau}{\tau^2+1}\,d\tau \\[3pt] =& x^2 +9 xt + 9t^2 + 18t \arctan(t) - 9 \ln (t^2+1). \end{align*}