I am trying to solve the BVP $$u_{xx}+a^2u=\sin(\pi x), \ \ \text{for} \ \ 0<x<1$$ with $u(0)=1$ and $u(1)=-2$, $\forall a\in\mathbb{R}$.

I begin by solving the homogeneous equation $u_{xx}+a^2u=0$. The roots of the characteristic equation of this ODE are $\pm ai$ and so the general solution of the homogeneous equation is $$u_H(x)=A\cos(ax)+B\sin(ax), \ \ A,B\in\mathbb{R}.$$ Searching for a particular solution, I guessed that $u_p(x)=x(C_1\cos(\pi x)+C_2\sin(\pi x))$ where $C_1,C_2\in\mathbb{R}$. So, \begin{align} u'_p(x)&=-C_1x\pi\sin(\pi x)+C_1\cos(\pi x)+C_2x\pi\cos(\pi x)+C_2\sin(\pi x) \\ u''_p(x)&=-C_1\pi^2 x\cos(\pi x)-2C_1\pi\sin(\pi x)-C_2\pi x\sin(\pi x)+2C_2\pi\cos(\pi x). \end{align} Substitution into the original ODE gives $C_1=-\frac{1}{2\pi}$ and $C_2=0$ and so $$u_p(x)=-\frac{x}{2\pi}\cos(\pi x).$$ Thus, $$u(x)=u_H(x)+u_P(x)=A\cos(ax)+B\sin(ax)-\frac{x}{2\pi}\cos(\pi x).$$ The boundary condition $u(0)=1$ implies $A=1$. The boundary condition $u(1)=-2$ implies \begin{align} -2&=\cos(a)+B\sin(a)-\frac{1}{2\pi}\cos(\pi) \\ \implies B&=\frac{1}{\sin(a)}\left(-2-\frac{1}{2\pi}-\cos(a)\right). \end{align} Hence, $$u(x)=\cos(ax)+\frac{1}{\sin(a)}\left(-2-\frac{1}{2\pi}-\cos(a)\right)\sin(ax)-\frac{x}{2\pi}\cos(\pi x).$$ But the resource I found this question states that this is not the correct answer. Have I made an error in logic?

  • $\begingroup$ By inspection there is a particular solution of the type $c\sin (\pi x)$. The value of $c$ is $\frac 1 {\pi^{2}-a{2}}$. What you have obtained is not a solution to the given DE. $\endgroup$ – Kavi Rama Murthy Mar 13 at 8:52
  • $\begingroup$ Have I made a mistake somewhere? $\endgroup$ – Stuart-James Burney Mar 13 at 9:04
  • $\begingroup$ I haven't checked carefully but the last term should be a constant times $\sin (\pi x)$. The might help you to find the mistake. $\endgroup$ – Kavi Rama Murthy Mar 13 at 9:08
  • $\begingroup$ Your particular solution is only valid for $a=\pm\pi$. For all other values there is no resonance, you get the particular solution in the form of @KaviRamaMurthy. $\endgroup$ – LutzL Mar 13 at 9:26
  • $\begingroup$ $u_p(x)=x(C_1\cos(\pi x)+C_2\sin(\pi x))$ is not a convenient proposal. $\endgroup$ – Cesareo Mar 13 at 9:36

In the general case $|a|\ne \pi$ there is no resonance in the forcing term on the right and you get the solution by the method of undetermined coefficients in the base case, that is, $$u_p(x)=C_1\cos(πx)+C_2\sin(πx).$$ This results in $C_1=0$ and $(-\pi^2+a^2)C_2=1$.

Inserting boundary conditions into $$u(x)=A\cos(ax)+B\sin(ax)+\frac1{a^2-\pi^2}\sin(πx)$$ gives $1=A$ and $-2=\cos(a)+B\sin(a)$, $B=-\frac{2+\cos(a)}{\sin(a)}$. Thus in general there will be no solutions for $a=k\pi$.

For $a\approx \pi$ one can write the solution as $$ u(x)=\cos(ax)-\frac{\sin(a)\sin(ax)}{1+\cos(a-\pi)}-\frac{\sin(ax)-\sin(πx)}{(a-π)(a+π)}+\left(\frac1{a^2-π^2}+\frac1{\sin(a-π)}\right)\sin(ax) $$ While the first three terms have a limit for $a\toπ$, the last coefficient does not cancel the two poles in its terms, thus is singular. There is no solution for $a=\pi$.


Using Laplace transform instead

$$ U(s) = \frac{s(s^2 +\pi^2)u(0)+(s^2 + \pi^2)u'(0)+\pi }{\left(s^2+\pi ^2\right) \left(a^2+s^2\right)} $$


$$ U(s) = \frac{s(s^2 +\pi^2)C_1+(s^2 + \pi^2)C_2+\pi }{\left(s^2+\pi ^2\right) \left(a^2+s^2\right)} $$

after inverting with previous expansion we have

$$ u(t) = \frac{1}{a(a^2-\pi^2)}\left(a(a^2-\pi^2)\cos(a t)C_1+(a^2-\pi^2)\sin(a t)C_2+a\sin(\pi t)-\pi\sin(a t)\right) $$

The constants are

$$ \begin{cases} C_1 = 1\\ C_2 = \frac{\pi}{a^2-\pi^2}-a(2+\cos a)\csc a \end{cases} $$

  • $\begingroup$ I appreciate the solution, but I haven't learnt about Laplace transforms in this sense. Is there a solution with a similar method to the one which I proposed? $\endgroup$ – Stuart-James Burney Mar 13 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.