<s>[INST] To Solve an ODE To Solve: $\displaystyle (1+x^2)\frac{d^2y}{dx^2}+1+\left(\frac{dy}{dx}\right)^2=0$
My Attempt: Take $\displaystyle \frac{dy}{dx}=p$
Now we have: $\displaystyle (1+x^2)\frac{dp}{dx}+1+p^2=0$
$\displaystyle \frac{dp}{1+p^2}=-\frac{dx}{(1+x^2)}$
Integrating, $\displaystyle \tan^{-1}p=-\tan^{-1}x$
So now, can we take this as $\displaystyle p = -x$ ?
If I can,we end with: $\displaystyle \frac{dy}{dx}=-x+c_1$
The answer seems different: $\displaystyle y=c_1x+(c_1^2+1)\log(x-c_1)+c_2$
Where am I going wrong?
 [/INST] Continuing my above comment. We have 
$$ y' = p = \tan\bigl(-\tan x + c\bigr) = \frac{c_1-x}{1+c_1x }. $$
Now in case $c_1 = 0$, we have $y' = -x$, hence $y = c_2 - \frac 12 x^2$. Otherwise we have 
$$ y' \frac{c_1 - x}{1 + c_1x} =  -\frac 1{c_1}\frac{-c_1^2 + c_1x}{1+c_1x}
  = -\frac 1{c_1} \cdot \left( 1 - (1+c_1^2)\frac 1{1+c_1 x} \right) 
$$
Hence 
$$ y = c_2 - \frac 1{c_1} \cdot \left( x - \frac{1+c_1^2}{c_1}\log(1 + c_1 x)\right) $$
</s>