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.$$

Thus, 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 $$-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),$$

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

Using the initial conditions, we get $C_1=1$ and $C_2=\frac{-2-\frac{1}{2\pi}-\cos(a)}{\sin(a)}$, but $a=\pm\pi$ and so $\sin(\pm\pi)=0$, which indicates $u$ is undefined when $a=\pm\pi$. But is it truly undefined? I am not sure I solved this correctly.

  • $\begingroup$ What do u mean by BVP? $\endgroup$
    – Shobhit
    Feb 23, 2017 at 3:46
  • $\begingroup$ @Shobhit, boundary value problem. $\endgroup$
    – ozarka
    Feb 23, 2017 at 3:49

1 Answer 1


It is impossible to show you exactly where you made a mistake because in the wording of your question, you didn't write down the ODE, nor the initial conditions.

Supposing that the ODE is : $$y''+a^2y=\sin(\pi x)$$ The general solution is : $$y(x)=C_1\cos(ax)+C_2\sin(ax)+\frac{1}{\pi^2-a^2}\sin(\pi x)\qquad\text{if } a\neq \pm \pi$$ or $$y(x)=C_1\cos(\pi x)+C_2\sin(\pi x)-\frac{1}{2\pi}x\cos(\pi x)\qquad\text{if } a= \pm \pi$$ If the first condition is $y(0)=0$ , then $C_1=0 $

Without knowing exactly what is the second condition, one cannot go further.


Since you set $\quad u_p=C_3x\sin(\pi x)+C_4x\cos(\pi x)\quad$ one can suppose that the ODE isn't $\quad y''+a^2y=\sin(\pi x)\quad$ but is $\quad y''+\pi^2y=\sin(\pi x)$. Introducing in the ODE the symbol $a$ which is a known constant $a=\pi$ is the cause of confusion in the search for $y_p$.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .