Why is the solution of $y''=\cos(x)/y$ increasing? I am studying the equation:

$$ y''=\frac {\cos(x)}y$$

, with y(0)>>1 and y'(0)=0. I can't find an exact solution so I calculated it using Runge-Kutta. Intuitively I expect an oscillatory function where the average value remains constant, since y" is oscillatory. However, the solution I get is increasing. It looks roughly like

$$y(x)= y_0+x+\cos(x)$$

Am I doing something wrong or is this the real behavior? And if so, can anyone try to find an explanation of why it would be increasing? I also found that it seems extremely sensitive to the initial value y'(0). If this is negative then the solution is decreasing (this is intuitively so), but I don't get why it is so sensitive, i.e. y'(0)=-0.001 and y(0)=10 will make the solution decreasing.
Thank you for any help.
 A: Suppose we restrict to an interval on which $y > 0$, so we may write
$$  y'' y = \cos x  $$
then recognize $(y' y)' = y'' y + (y')^2$ and add $(y')^2$ to both sides, producing
$$  (y' y)' = \cos x + (y')^2  \text{.}  $$
Now let us look at the average behaviour over any one period of cosine.  \begin{align*}
\frac{1}{2\pi} & \int_x^{x+2\pi} \; (y'(t) y(t))' \,\mathrm{d}t  \\
&= \frac{1}{2\pi}\left( y(x+2\pi)y'(x+2\pi) - y(x)y'(x) \right)  \text{,}  \\
\frac{1}{2\pi} & \int_x^{x+2\pi} \; \cos(t) + (y'(t))^2 \,\mathrm{d}t  \\
&= \frac{1}{2\pi} \left( 0 + \int_x^{x+2\pi} \; (y'(t))^2 \,\mathrm{d}t \right)  \\
&\geq 0  \text{.}
\end{align*}
Putting these together, 
$$  y(x+2\pi)y'(x+2\pi) \geq y(x)y'(x)  \text{.}  $$
Your intuition tells you $y'$ is (approximately) oscillatory with period $2\pi$, giving $y(x+2\pi) \gtrsim y(x)$, so you expect $y$ oscillates with amplitude $1/y$ and slowly trends upwards.
This is what we see in the solution.  For instance, with $y(0) = 100$,

A: From the initial conditions, it follows that $$0<y''(0)=\frac{1}{y(0)}< 1.$$ This means that $y'$ increases near $x=0,$ and since $y'(0)=0,$ it follows that $y'(x)>0$ for all $0<x<\epsilon,$ for some $\epsilon.$ Thus, $y$ must be an increasing function of $x$ in the interval $(0,\epsilon),$ and we probably can't say anything more definite than this based on just what we know.
Of course this tells us nothing about the behaviour of $y$ away from the origin -- it may indeed be increasing, but we cannot say. So one may want to say that you should trust your intuitive expectation of the behaviour of $y(x)$ more than what your approximation suggests.
However, one should point out that there is necessarily no conflict between the expectation that $y$ changes concavity and the result of the approximation, which suggests monotony. As is well known, both properties are compatible, for example in the function $g(x)=x+\sin x.$ I think where the confusion comes from is from how you interpreted what the equation tells you, immediately jumping to oscillation from mere variation in concavity -- but that doesn't follow. Indeed the equation only tells you that $y$ varies in concavity; but that of itself does not mean that $y$ oscillates, or repeats itself in some interval, which would necessarily imply non-monotony. As the example $g(x)$ above shows, a function need not repeat values (oscillate) yet it may change its concavity in any fashion (in the example it merely alternates it periodically, but this need not be the case in general). I hope this finally clears the air.
By the way yours is a good question. Kudos!

We can in fact say something more definite than what's here above, namely that your intuition that $y''$ changes sign is correct; what's not quite right is the deduction that therefore $y$ oscillates. Well, all we can deduce from the non-constancy of the sign of $y''$ is that $y$ alters its concavity, as explained above. Now how do we know that $y''$ cannot have constant sign?
Suppose to the contrary that $y$ has constant sign. Then either $y''>0$ throughout or it is negative, or it vanishes identically. This last case is easily dismissed since that would mean $\cos x=0$ for all $x\ge 0.$
So suppose $y''>0$ identically. Then it must be the case that $\cos x$ and $y$ have the same sign on the positive half-axis. Thus they must have the same roots as well, by continuity of $y.$ Hence, $y$ oscillates infinitely often as $x$ becomes large, since $\cos x$ oscillates for all $x.$ On the other hand we must have that $y'$ increases throughout the interval, so that $y$ must be convex. Thus, $y$ possesses a globally minimum value -- either at $x=0,$ or at some $x=x_m>0.$ In both cases, it follows that $y$ is monotonically increasing for sufficiently large $x$ (precisely for all $x$ greater than the minimum point). This contradicts the conclusion above that $y$ oscillates for all $x\ge 0.$ It follows that $y''$ cannot be positive for all $x\ge 0.$
Similarly, we conclude that $y''$ cannot be identically negative on the half-axis.
It follows that $y''$ changes sign as $x\to +\infty,$ which means that $y$ changes its concavity, from being down to up, etc. This however, as I've stressed above, does not mean that $y$ cannot be monotonic.
Indeed your approximations of the solution would seem to say that this is indeed what's the case.
