Nonlinear second order ODE $y''+f(x)y=g(x)y^3$ I encountered the following ODE in order to find a solution for Einstein equation 
$$y''+f(x)y=g(x)y^3.$$
It seems to me that it is not among the solvable nonlinear second order differential equations.
Is there any known method to solve that? Any help will be appreciated. 
 A: When $g(x) = 2$ (which can be achieved by a transformation in $x$) and $f(x)$ is linear in $x$, then this equation is a special case of the second Painlevé equation, which also appears in other areas of mathematical physics. It is known to be integrable by the isomonodromy method via its Lax representation and it has many other interesting properties.
A: The paper by Norbert Euler (1997) ``Transformation Properties of $\ddot{x}+f_1(t)\dot{x} + f_2(t)x + f_3(t) x^n = 0$" Journal of Nonlinear Mathematical Physics, 4:3-4, 310-337
describes in detail the "the most general conditions on the functions $f_1$, $f_2$ and $f_3$, by which the equation may be integrable, as well as conditions for the existence of Lie point symmetries."
A: While closed-form solutions will be very rare, you can get series solutions.
For example, the solution with $y(0)=0,\; y'(0)=v$ has Maclaurin series
$$ y = v x - \frac{f(0)}{6} v x^3 - \frac{f'(0)}{12} v x^4 + \left(\frac{f(0)^2 - 3 f''(0)}{120} v + \frac{g(0)}{20} v^3 \right) x^5 + \ldots $$
A: Consider the ODE
\begin{align}
y'+\frac{A'(x)}{3A(x)}y&=A(x)y^2,
\end{align}
with derivative
\begin{align}
y''+\left[\left(\frac{A'}{3A}\right)'-\left(\frac{A'}{3A}\right)^2\right]y=2A^2y^3.
\end{align}
This is equivalent to your equation if
\begin{align}
\left(\frac{A'}{3A}\right)'-\left(\frac{A'}{3A}\right)^2=f,\quad\text{and}\quad2A^2=g.
\end{align}
In other words, if $f(x)$ and $g(x)$ satisfy the equation
\begin{align}
\left(\frac{g'}{6g}\right)'-\left(\frac{g'}{6g}\right)^2=f,
\end{align}
your problem is reduced to an easily integrable Bernoulli equation.
