so let's say we have: $f''+4f=\frac{1}{\sin(2x)}$

Homogeneous Problem:

We use Euler-Ansatz: $char(\lambda)=\lambda^2+4 \Rightarrow \lambda=\pm 2i$

So we get


Particular Problem:

We use variaton of constants. From the homogeneous solution we get the basis $\{\cos(2x),\sin(2x)\}$.

We get [I changed A and B to $u_1$ and $u_2$]

I: $-4u_1\cos(2x)+4u_2\cos(2x)=0$




whereas the particular solution will be $y_p(x)=U_1\cos(2x) + U_2\sin(2x)$ with $U_i$ being the $u_i$'s integrated.


Let me also quickly tell you about the idea I have about the whole thing we are doing here. Basicaly, the solution to a ODE is a vector space, so by solving the homogeneous problem, we have a nice vector space. We then only need to somehow adjust that vectorspace s.t. it "works" with the inhomogenity. We can do that by "changign" the coefficients.

What I don't see yet is why we set I=0$ and $II=\frac{1}{\sin(2x)}$.

Could someone please elaborate? Why can't I do $I=\frac{1}{\sin(2x)}, II=\frac{1}{\sin(2x)}$? Could I also do $I=\frac{1}{\sin(2x)}, II=0$?

  • $\begingroup$ Surely you meant to write something else instead of I & II? Those equations should contain $A'(x)$ and $B'(x)$, if the solution that you seek is $y(x) = A(x) \cos 2x + B(x) \sin 2x$. $\endgroup$ – Hans Lundmark Jun 27 '18 at 14:18
  • $\begingroup$ Yeah I forgot something, I'm going to add it. $\endgroup$ – xotix Jun 27 '18 at 14:44
  • $\begingroup$ I think this older question asks more or less the same thing as yours, so I wrote an answer there describing how I like to think about this. $\endgroup$ – Hans Lundmark Jun 27 '18 at 15:33
  • $\begingroup$ This question is also a bit similar: math.stackexchange.com/questions/1242015/… $\endgroup$ – Hans Lundmark Jun 27 '18 at 15:34
  • $\begingroup$ But to summarize: you must set $I=0$ and $II=1/\sin 2x$, the other options won't work. $\endgroup$ – Hans Lundmark Jun 27 '18 at 15:41

Not an answer but another approach

$$f''+4f=\frac{1}{\sin(2x)}$$ $$f''\sin((2x)+4f\sin(2x)=1$$ $$f''\sin(2x)+2f'\cos(2x)-2f'\cos(2x)+4f\sin(2x)=1$$ $$(f'\sin(2x))'-2(f\cos(2x))'=1$$ after integration $$f'\sin(2x)-2f\cos(2x)=x+K_1$$ Which is a first order ode $$(\frac f{\sin(2x)})'=\frac x {\sin^2(2x)}+\frac {K_1}{\sin^2(2x)}$$ $$\frac f{\sin(2x)}=\int \frac x {\sin^2(2x)}dx+K_1\int \frac {dx}{\sin^2(2x)}+K_2$$ $$ f(x)=\sin(2x)\int \frac x {\sin^2(2x)}dx+K_1{\cos(2x)}+K_2\sin(2x)$$


Consider the function $$ g_a(x)=2f(x)\cos(2x-2a)-f'(x)\sin(2x-2a) $$ then \begin{align} g_a'(x)&=-4f(x)\sin(2x-2a)-f''(x)\sin(2x-2a) \\& =-\frac{\sin(2x-2a)}{\sin(2x)} \\&=-\cos(2a)+\sin(2a)\frac{\cos(2x)}{\sin(2x)} \end{align} which can be integrated to $$ g_a(x)=-\cos(2a)x+\frac12\sin(2a)\ln|\sin(2x)|+C(a) $$ One can relate integration constant to initial conditions with for example $$C(a)=g_a(\frac\pi4)=2f(\frac\pi4)\sin(2a)-f'(\frac\pi4)\cos(2a).$$ Setting $x=a$ and then renaming $a$ to $x$ gives then $$ g_x(x)=2f(x)=-\cos(2x)x+\frac12\sin(2x)\ln|\sin(2x)|+2f(\frac\pi4)\sin(2a)-f'(\frac\pi4)\cos(2a). $$

  • 1
    $\begingroup$ It's not that I couldn't solve it - it's more about udnerstanding what I'm actually doing. Guess I have to rewrite me post/update it better $\endgroup$ – xotix Jun 27 '18 at 14:54

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.