[SOLVED] How to get this 2nd differential as a function of x?

The question is: If $\displaystyle \sin y + \cos y = x$ find $\displaystyle \frac{d^2 y}{dx^2}$ as a function of x.

I differentiated once to get $\displaystyle \frac{dy}{dx}=\frac{1}{\cos y - \sin y}$

Then again to get $\displaystyle \frac{d^2y}{dx^2}=\frac{dy}{dx}\frac{\sin y + \cos y}{(\cos y - \sin y)^2} \Rightarrow \frac{d^2y}{dx^2} =\frac{x}{(\cos y - \sin y)^3} $

The book's answer is $\displaystyle \frac{d^2y}{dx^2}=\pm\frac{x}{\sqrt{(2-x^2)^3}}$. So I guess that means $\displaystyle \cos y -\sin y =\pm\sqrt{(2-x^2)}$. But I duno why.

Did I make a mistake? Can anyone help? Thanks.