This is my solution :-
$$\int \frac{dx}{1 + x - x^2} = \int \frac{dx}{-(x^2 - x - 1)} = -\int \frac{dx}{x^2 - x - 1} = -\int \frac{dx}{x^2 - 2.x.\frac{1}{2} + (\frac{1}{2})^2 - \frac{5}{4}} = -\int \frac{dx}{(x - \frac{1}{2})^2 - (\frac{\sqrt5}{2})^2}\\\text{Let } x - \frac{1}{2} = u\\\text{Then, } \frac{du}{dx} = 1\\=> du = dx\\\text{Therefore, } -\int \frac{dx}{(x - \frac{1}{2})^2 - (\frac{\sqrt5}{2})^2} = -\int \frac{du}{u^2 - (\frac{\sqrt5}{2})^2} =-\int \frac{du}{(u + \frac{\sqrt5}{2})(u - \frac{\sqrt5}{2})}\\\text{Let }\frac{1}{(u + \frac{\sqrt5}{2})(u - \frac{\sqrt5}{2})} = \frac{A}{u + \frac{\sqrt5}{2}} + \frac{B}{u - \frac{\sqrt5}{2}}\\\text{Then, } A(u - \frac{\sqrt5}{2}) + B(u + \frac{\sqrt5}{2}) = 1\\=> Au - \frac{\sqrt5}{2}A + Bu + \frac{\sqrt5}{2}B = 1\\=> u(A + B) + \frac{\sqrt5}{2}(B - A) = 1\\\text{Equating coefficients on both sides we have, }\\A = -B\\\text{and, }\\\frac{\sqrt5}{2}(B - A) = 1\\=> \frac{\sqrt5}{2}.2B = 1\\=> B = \frac{1}{\sqrt5}\\\text{Thus, } A = \frac{1}{\sqrt5}\\\text{Therefore, } -\int \frac{du}{(u + \frac{\sqrt5}{2})(u - \frac{\sqrt5}{2})} = -\int (\frac{-\frac{1}{\sqrt5}}{u + \frac{\sqrt5}{2}} + \frac{\frac{1}{\sqrt5}}{u - \frac{\sqrt5}{2}}) du = \int (\frac{\frac{1}{\sqrt5}}{u + \frac{\sqrt5}{2}} - \frac{\frac{1}{\sqrt5}}{u - \frac{\sqrt5}{2}}) du = \frac{1}{\sqrt5} \int (\frac{1}{u + \frac{\sqrt5}{2}} - \frac{1}{u - \frac{\sqrt5}{2}}) du\\= \frac{1}{\sqrt5}(\int \frac{1}{u + \frac{\sqrt5}{2}}du - \int \frac{1}{u - \frac{\sqrt5}{2}}du) = \frac{1}{\sqrt5}[ln(u + \frac{\sqrt5}{2}) - ln(u - \frac{\sqrt5}{2}) + C] = \frac{1}{\sqrt5} ln|\frac{u + \frac{\sqrt5}{2}}{u - \frac{\sqrt5}{2}}| + C\\= \frac{1}{\sqrt5} ln|\frac{x - \frac{1}{2} + \frac{\sqrt5}{2}}{x - \frac{1}{2} - \frac{\sqrt5}{2}}| + C = \frac{1}{\sqrt5} ln|\frac{2x - 1 + \sqrt5}{2x - 1 - \sqrt5}| + C \text{ --------Answer}$$
But this is the answer given in the book :-
$$\frac{1}{\sqrt5} ln |\frac{\sqrt5 - 1 + 2x}{\sqrt5 + 1 - 2x}| + C$$
What am I doing wrong?
Since$$\left\lvert\frac{\sqrt5-1+2n}{\sqrt5+1-2n}\right\rvert=\left\lvert\frac{2n-1+\sqrt5}{2n-1-\sqrt5}\right\rvert,$$there is no difference between your solution and the one provided by the book.