General solution to $f^{\prime\prime} (x) + g(x) f(x) = 0$ I am trying to find the general solution to the following ODE with a variable coefficient:
$$ f^{\prime\prime} (x) + g(x) f(x) = 0 \tag{1}$$
where the function $f$ is not known and $g$ is known. By doing research I only managed to find solutions of equation $(1)$ for specific cases of $g$, but I did not find a general case where $g$ can be defined in any way.

*

*Is there a general solution for equation $(1)$ where $g$ is a general function, not a specific one?


*If a general solution does exist, what is it?
 A: This is not at all my area, but I don't think we can do much better than the usual reduction to a system of first-order ODEs. If we write $a(x) = f(x), b(x) = f'(x)$ then we get
$$a'(x) = b(x)$$
$$b'(x) = - g(x) a(x)$$
which can be written in the matrix form
$$\left[ \begin{array}{c} a'(x) \\ b'(x) \end{array} \right] = \left[ \begin{array}{cc} 0 & 1 \\ - g(x) & 0 \end{array} \right] \left[ \begin{array}{c} a(x) \\ b(x) \end{array} \right].$$
Equations of this form $v'(x) = M(x) v(x)$ for $v$ a vector-valued function and $M$ a matrix-valued function can be "solved" as a series expansion using Magnus series. The solution is quite simple if $M(x) M(y) = M(y) M(x)$ for all $x, y$ since then it's just given by $v(x) = \exp \left( \int_0^x M(t) \, dt \right) v(0)$, but in general this doesn't hold and then things are messy. The Magnus series is an infinite series of corrections to this special case in terms of commutators.
A: $$\frac{f''(x)}{f(x)}=-g(x)$$
Of course solutions exist. Given $g(x)$ approximates of $f(x)$ can be found thanks to numerical calculus. Or in somme cases the solution can be expressed in terms of infinite series.
The right question isn't if exact solutions exist but is if the solutions can be expressed with a finite number of already known functions (standard functions).
For many kind of functions $g(x)$ analytic solutions are known. For example :
$g(x)=$constant.$\quad f(x)$ is of exponential or sinusoidal kind.
$g(x)=a\,x+b. \quad f(x)$ is a linear combination of Airy functions.
$g(x)=a\,x^2+b\,x+c. \quad f(x)$ is a linear combination of parabolic cylinder functions.
$g(x)=\frac{a}{x^2}+\frac{b}{x}. \quad f(x)$ is a linear combination of functions involving Bessel functions.
$g(x)=\frac{a}{x^2}+\frac{b}{x}+c. \quad f(x)$ is a linear combination of functions involving Whittaker and/or Kummer functions.
$g(x)=a\,e^{b\,x}. \quad f(x)$ is a linear combination of functions involving Bessel functions.
Etc.
But for many other functions $g(x)$ no convenient special function have yet been defined and standardised. So in this sens the answer to your question is NO.
But this is not definitively no, until some new special functions be defined and standardised.
