Solve the BVP $$\begin{cases} u''+a^2u=\sin\pi x, 0<x<1 \\ u(0)=1,\quad u(1)=-2 \end{cases}$$ for all $a\in\mathbb{R}$. What are the solutions in the cases $a=\pm\pi$.

Given that the BVP is a second-order inhomogeneous ODE, we find the characteristic equation to be in the form $$r^2+a^2=0\implies r=\pm ai.$$

The homogeneous equation is $$u_h=C_1\cos(ax)+C_2\sin(ax).$$

The particular equation is $$u_p=C_3x\sin(\pi x)+C_4x\cos(\pi x),$$ $$u_p'=-C_3\pi x\cos(\pi x)+C_3\sin(\pi x)-C_4\pi x\sin(\pi x)+C_4\cos(\pi x),$$ $$u_p''=-C_3\pi^2 x\sin(\pi x)+2C_3\pi\cos(\pi x)-2C_4\pi\sin(\pi x)-C_4\pi^2 x\cos(\pi x).$$

Substituting for the given ODE, we have \begin{multline*} u_p''+\pi^2u = -C_3\pi^2 x\sin(\pi x)+2C_3\pi\cos(\pi x)-2C_4\sin(\pi x)-C_4\pi^2 x\cos(\pi x) \\ +\pi^2(C_3x\sin(\pi x)+C_4x\cos(\pi x))=\sin(\pi x), \end{multline*}

and we get $C_3=0$ and $C_4=-\frac{1}{2\pi}$. Then the general solution is, $$u=u_h+u_p=C_1\cos(ax)+C_2\sin(ax)-\frac{1}{2\pi}x\cos(\pi x)$$

Using the given initial conditions, we get $C_1=1$ and $C_2=\frac{-2-\frac{1}{2\pi}-\cos(a)}{\sin(a)}$. Then the general solution is,

$$u=u_h+u_p=\cos(ax)+\frac{-2-\frac{1}{2\pi}-\cos(a)}{\sin(a)}\sin(ax)-\frac{1}{2\pi}x\cos(\pi x)$$

Note that if $a=\pm\pi$ then $\sin(\pm\pi)=0$, which indicates $u$ is undefined at $a=\pm\pi$.

  • 2
    $\begingroup$ What are you asking? $\endgroup$ – Chappers Feb 22 '17 at 20:35
  • $\begingroup$ @Chappers, sorry. I edited the post. $\endgroup$ – ozarka Feb 22 '17 at 20:36
  • $\begingroup$ There is a mistake when differentiating $C_3 x \sin(\pi x)$. The first minus sign must not be there. $\endgroup$ – Shashi Feb 23 '17 at 6:19
  • $\begingroup$ @Shashi, thank you. But this doesn't change anything since the term $x\sin(\pi x)$ vanishes anyway when I plug it into the BVP because on the right hand side we only have the term $x\sin(\pi x)$. $\endgroup$ – ozarka Feb 23 '17 at 6:29
  • $\begingroup$ @ozarka are you sure that $u(1)=-2$ is given instead of $u'(1)=-2$? I think that it must be $u'(1)=-2$ $\endgroup$ – Shashi Feb 23 '17 at 6:49


For $a=\pm \pi$, try: \begin{align*}u_I(x)=Ax\sin(\pi x) +Bx \cos(\pi x) \end{align*} for the inhomogeneous part. Calculate $u''_I$ and put it in the equation to find the constants $A$ and $B$.

For $a\neq \pm \pi$, try: \begin{align*} u_I(x)=A\sin(a x) +B \cos(a x) \end{align*}

I hope you can finish it from here.

  • $\begingroup$ Thank you. To confirm is the homogeneous solution $C_1\sin(ax)+C_2\cos(ax)$ the same for both $a=\pm\pi$ and $a\neq\pm\pi$? $\endgroup$ – ozarka Feb 23 '17 at 3:09
  • $\begingroup$ @ozarka yes! The homogeneous part remains the same. $\endgroup$ – Shashi Feb 23 '17 at 5:49
  • $\begingroup$ Could you check my new attempt? I feel like my constant $C_2$ is wrong because $u$ is being undefined when $a=\pm\pi$. $\endgroup$ – ozarka Feb 23 '17 at 6:04

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.