# 1D Wave Equation with Coupled IC's and Non-Homogeneous BC's

Consider the following wave equation:

\begin{align} &u_{tt} = u_{xx}, \\\\ &u(x,0) = \frac{1}{2 + \sin x} =: \psi(x), \\\\ &u_t(x,0) = -\frac{\cos x}{(2 + \sin x)^2} = \psi'(x), \\\\ &u(0,t) = u(2\pi, t) = \frac{1}{2 + \sin t} = \psi(t). \end{align}

This is an unforced wave equation with time-varying boundary conditions and initial conditions which are coupled together through $$\psi(x)$$ and its derivative.

I have gone through and performed the separation of variables solution method, and it get's messy. My idea was to define the solution $$u(x,t) = f(t) + v(x,t)$$ to transform the boundary conditions into fixed boundary conditions which yields a non-homogeneous wave equation for $$v(x,t)$$ which I can solve using separation of variables.

However, the math gets tedious and not analytical for the Fourier coefficients, so I feel this is not the correct method to solve this problem. Any ideas on the best method that would solve this particular wave equation? Is there any way to use the fact that $$u(x,0) = \psi(x)$$ and $$u_t(x,0) = \psi'(x)$$ to come up with an elegant solution?

EDIT: using D'Alembert's solution (neglecting boundary conditions right now), we have the general solution

\begin{align} u(x,t) &= \frac{\psi(x - t) + \psi(x + t)}{2} + \frac{1}{2}\int_{x-t}^{x+t} \psi'(\bar{x}) \ \mathrm{d} \bar{x} \\\\ &= \frac{\psi(x-t) + \psi(x+t)}{2} + \frac{1}{2}\left[\psi(x+t) - \psi(x-t)\right] \\\\ &= \psi(x + t) \\\\ &= \frac{1}{2 + \sin(x+t)}. \end{align} This solution indeed satisfies the initial conditions $$u(x,0) = \psi(x)$$ and $$u_t(x,0) = \psi'(x)$$. Additionally, it just so happens that this solution satisfies the boundary conditions as well, since $$u(0,t) = u(2\pi,t) = \psi(t)$$. Is this the complete solution to this problem?

Theorem: Suppose $$f(x)$$ and $$g(x)$$ are (sufficiently nice) function which are periodic, i.e. $$f(x+2\pi) = f(x)$$ and $$g(x+2\pi) = g(x)$$. If $$u(x,t)$$ is a function which solves the PDE, $$u_{tt} = u_{xx}$$ with the initial conditions that $$u(x,0) = f(x)$$ and $$u_t(x,0) = g(x)$$ then $$u(x,t)$$ would also be periodic function i.e. $$u(x+2\pi,t) = u(x,t)$$.
The key observation here is that the function $$\psi(x)$$ is already a periodic function, therefore, $$u(x,t)$$ will automatically be a periodic function. Furthermore, since the boundary condition is given by $$u(0,t) = \phi(t)$$, by the same function at the start of the problem, it means you do not need to do anything else to satisfy the boundary condition.
You would be correct that, in general, if the conditions $$u(0,t)$$ was entirely unrelated to $$\psi(t)$$ then this simple approach would not work and more effort is required to produce the solution.