When solving PDE, why this ansatz

partial differential equations

$$ u_{tt}(x,t)-c^2 u_{xx}(x,t)=K $$
$$ u_x (0,t)=u_t (x,0) = u(L,t) = u(x,0) = 0 $$

Since I have a non-homogenous differential equation, I can't use variable of separations and as such, I begin by creating a particular (stationary) and a homogenous solution;

$$ u(x,t) = u_{stat}(x) + v(x,t) $$

The problem for $u_{stat}$ is

$$ -c^2 u_{stat}''(x)=K, \quad u'_{stat}(0)=u_{stat}(L)=0$$

The solution for this is pretty easy so I will just write it out as

$$u_{stat}(x)=\frac{K}{2c^2} (L^2-x^2)$$

Now to the problem of $v(x,t)$, which is defined below. The constraints were derived from $v(x,t)=u(x,t)-u_{stat}(x)$.

$$ v_{tt} – c^2 v_{xx} = 0 $$
$$ v_x (0,t) = v_t (x,0) = v(L,t) = 0, \quad v(x,0) = -u_{stat} (x)$$

Since we have homogenous boundary conditions (non-homogenous initial conditions though) and a homogenous differential equation, I tried using variable of separation. Trivial solutions were gained for $\lambda>0, \lambda=0$. When $\lambda=\omega^2 <0$, I got $X(x)=Acos(\omega x)$, and $T(t)=\frac{K}{2c^2} (x^2-L^2) cos(c\omega x)$, where $\omega = \frac{\pi}{L}(\frac{1}{2}+n), n=0,1,2,…$

It seems like I have solved the question wrongly though, because when I got the correct solution to this problem, I saw that an ansatz had been made for $v(x,t)$, which was

$$ v(x,t) = \sum_n a_n(t)f_n(x) $$

Here, $f_n (x)$ has the same solution as my $X(x)$, but $a_n(t)$ was solved by putting $f_n (x)$ back into the PDE for $v(x,t)$, and then solving the ODE-problem defined as

$$ a_n ''(t) + (ck_n)^2 a_n(t) = 0, \quad a_n (0) = -\frac{2}{L} \int_0^L f_n(x)u_{stat}(x)dx, \quad a_n' (0) = 0 $$

My question;

How did they derive the ODE initial conditions (not the ODE itself)?
Is there any way to predict or intuitively understand why we should make the sum-ansatz for $v(x,t)$ instead of trying to use separation of variables, which I did?

Best Answer

There is nothing wrong with the way you did it. The ansatz made by whoever wrote the solution is an application of separation of variables, very similar to your approach. First, though, there is an issue with your solution, which I'll address below.

To start, your eigenfunction for $T(t)$ is wrong, and certainly should not contain any terms in $x$. When solving the ODEs in $X$ and $T$, you only the apply homogeneous conditions. Once you have done that, construct your solution as a Fourier series, then apply the inhomogeneous condition.

Following above, the solution to $T'' = - c^{2} \omega^{2} T$ (where $\omega$ is the eigenvalue you found) with the homogeneous boundary condition

$$v_{t}(x,0) = 0 \implies T'(0) = 0 \tag 1$$ is given by

$$T_{n}(t) = B_{n} \cos \left( \frac{(2n+1)\pi c t}{2L} \right)$$

This yields the solution for $v$ as a Fourier series

\begin{align} v(x,t) &= \sum_{n \ge 0} X_{n}(x) T_{n}(t) \\ &\sum_{n \ge 0} A_{n} \cos \left( \frac{(2n+1)\pi x}{2L} \right) \cos \left( \frac{(2n+1)\pi c t}{2L} \right) \tag 2 \end{align}

Substituting in the inhomogeneous boundary condition, we find

\begin{align} v(x,0) &= \sum_{n \ge 0} A_{n} \cos \left( \frac{(2n+1)\pi x}{2L} \right) \\ &= -u_{\text{stat}}(x) \tag 3 \end{align}

and multiplying both sides by $\cos \left( \frac{(2m+1)\pi x}{2L} \right)$ and integrating over the domain $x \in [0,L]$ gives

\begin{align} \sum_{n \ge 0} A_{n} \int_{0}^{L} \cos \left( \frac{(2n+1)\pi x}{2L} \right) \cos \left( \frac{(2m+1)\pi x}{2L} \right) dx &= - \int_{0}^{L} u_{\text{stat}}(x) \cos \left( \frac{(2m+1)\pi x}{2L} \right) dx \end{align}

which yields the coefficients (for $n = m$)

\begin{align} A_{n} = - \frac{2}{L} \int_{0}^{L} u_{\text{stat}}(x) \cos \left( \frac{(2n+1)\pi x}{2L} \right) dx \tag 4 \end{align}

and hence after solving the above integrals, you have the solution to your PDE as a Fourier series.

Now, imagine after doing separation of variables that you hadn't yet solved the ODE in $T$ but had only solved the ODE in $X$, given by $X'' = - \omega^{2} X$. Then, as we know the solution will be a Fourier series, we can assume the solution $v(x,t)$ takes the general form

$$v(x,t) = \sum_{n \ge 0} X_{n}(x) T_{n}(t)$$

which is essentially what we have written at $(2)$ (note that our $X_{n}(x) = \cos \left( \frac{(2n+1)\pi x}{2L} \right)$ is the solutions $f_{n}(x)$. Similarly, $T_{n}(t) = a_{n}(t)$). Substituting into the PDE yields

\begin{align} v_{tt} - c^{2} v_{xx} &= \sum_{n \ge 0} X_{n}(x) T''_{n}(t) - c^{2} \sum_{n \ge 0} X''_{n}(x) T_{n}(t) \\ &= \sum_{n \ge 0} X_{n}(x) T''_{n}(t) - c^{2} X''_{n}(x) T_{n}(t) \\ &= \sum_{n \ge 0} X_{n}(x) T''_{n}(t) + c^{2} \omega^{2} X_{n}(x) T_{n}(t) \qquad \text{(as $X'' = - \omega^{2} X$)} \\ &= \sum_{n \ge 0} [T''_{n}(t) + c^{2} \omega^{2} T_{n}(t)]X_{n}(x) \\ &= 0 \qquad \text{(from the PDE)} \end{align}

We know that $X_{n}(x) \ne 0$, hence we must have

$$T''_{n}(t) + c^{2} \omega^{2} T_{n}(t) = 0$$

We also need to use our initial conditions. Again, as $X_{n}(x) \ne 0$

\begin{align} v_{t}(x,0) &= \sum_{n \ge 0} X_{n}(x) T'_{n}(0) \\ &= 0 \\ \implies T'_{n}(0) &= 0 \qquad \forall n \end{align}

Notice that this is essentially the same condition we have at $(1)$. Applying the last condition

\begin{align} v(x,0) &= \sum_{n \ge 0} X_{n}(x) T_{n}(0) \\ &= -u_{\text{stat}}(x) \end{align}

which is essentially what we have written at $(3)$. So, just like we did after $(3)$, we multiply both sides by $X_{m}(x)$ and integrate over the domain, which gives

\begin{align} \sum_{n \ge 0} T_{n}(0) \int_{0}^{L} X_{n}(x) X_{m}(x) dx &= -\int_{0}^{L} X_{m}(x) u_{\text{stat}}(x) dx \end{align}

and using the result at $(4)$, we get that

$$T_{n}(0) = - \frac{2}{L} \int_{0}^{L} X_{n}(x) u_{\text{stat}}(x) dx$$

which is the other condition.

Related Question