How to solve $f''(x)+k^2f(x)=g(x)$

82 Views Asked by At

It's probably a stupid question, but due to my ignorance I can't solve the ODE $$f''(x)+k^2f(x)=g(x)$$ Could someone please show me how to proceed to find the general solution?

I am able to solve only the associated homogeneous equation:

$$f''(x)+k^2f(x)=0 \implies\\ f(x)=Ae^{jkx}+Be^{-jkx}$$

Thanks.

2

There are 2 best solutions below

0
On BEST ANSWER

Based on Kabo's comment (which I would have made if I got here first).

In this case, the variation of parameter formulas come out nicely:

$$ f \left( x \right) = C_1\sin \left( kx \right)+C_2\cos \left( kx \right)+ \frac{1}{k}\left(\int \!\cos \left( kx \right)\; g \left( x \right) \,{\rm d}x\right)\sin \left( kx \right) -\frac{1}{k}\left(\int \!\sin \left( kx \right)\; g \left( x \right) \,{\rm d}x\right)\cos \left( kx \right) $$

0
On

$$F''+k^2F(x)=g(x)~~~~(1)$$ can be solved by solving the homogeneous Eq. $$f''(x)+k^2f(x)=0$$ whose solutions are $$f(x)=C_1 \sin k x + C_2 \cos kx$$. Next the solution of (1) is given by variation of the parameters as $$F(x)= C_1(x) \sin kx +C_2 \cos kx,$$ where $$ C_1(x)=\int_{0}^{x} \frac{-\cos kx g(x)}{W(x)} dt+D_1,~~C_2(x)=\int_{0}^{x} \frac{\sin kt~ g(t)}{W(t)} dt+D_2 ~~~~~(2)$$~ Here $W(x)$ is the Wronskian of the linearly independent solutions $f_1=\sin kx, f_2= \cos kx$, namely $W(x)=[f_1f'_2-f'_1 f_2]=-k^2.$ Inserting (2) in (1) we can write $$F(x)=D_1 \sin kx+ D_2 \cos kx+\frac{1}{k^2} \int_{0}^{x} \sin k(x-t)~ g(t) dt$$