# How do we handle the inhomogenity of an ODE in “variation of parameters”?

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

$f_h(x)=\hat{A}e^{2ix}+\hat{B}e^{-2ix}=A\cos(2x)+B\sin(2)$

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$

II:$-4u_1\sin(2x)+4u_2\sin(2x)=\frac{1}{\sin(2x)}$

so:

$\begin{pmatrix}\cos(2x)&\sin(2x)\\-2\sin(x)&2\cos(x)\end{pmatrix}=\begin{pmatrix}u_1\\u_2\end{pmatrix}=\begin{pmatrix}0\\\frac{1}{\sin(2x)}\end{pmatrix}$

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.

Question:

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$? • 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$. – Hans Lundmark Jun 27 '18 at 14:18 • Yeah I forgot something, I'm going to add it. – xotix Jun 27 '18 at 14:44 • 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. – Hans Lundmark Jun 27 '18 at 15:33 • This question is also a bit similar: math.stackexchange.com/questions/1242015/… – Hans Lundmark Jun 27 '18 at 15:34 • But to summarize: you must set$I=0$and$II=1/\sin 2x, the other options won't work. – Hans Lundmark Jun 27 '18 at 15:41 ## 2 Answers 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).$$ Settingx=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).$$

• 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 – xotix Jun 27 '18 at 14:54