I am trying to derive the formula for the Fibonacci sequence. Here is my work, I am making a mistake somewhere, but I can't seem to find where it is. My answer is almost correct but the the final terms are swapped for some reason.
Since we want a formula for $f(n)$ for $n\geq 0$, we will work with the recurrence $$f(n+2)=f(n+1)+f(n)$$ where $f(0)=1$ and $f(1)=1$. Let $F(x)=\sum_{n\geq 0}f(n)x^n$ be the ordinary generating function for the numbers $f(n)$. Multiplying both sides of the recurrence relation by $x^{n+2}$ and summing over all $n\geq 0$ gives $$\sum_{n\geq 0}f(n+2)x^{n+2}=\sum_{n\geq 0}f(n+1)x^{n+2}+\sum_{n\geq 0}f(n)x^{n+2}$$ Notice that $$\sum_{n\geq 0}f(n+2)x^{n+2}=F(x)-f(1)x-f(x)=F(x)-x-1$$ and $$\sum_{n\geq 0}f(n+1)x^{n+2}=x(F(x)-f(0))=xF(x)-x$$ and $$\sum_{n\geq 0}f(n)x^{n+2}=x^2F(x)$$ Hence, $$F(x)-x-1=xF(x)-x+x^2F(x)$$ and solving for $F(x)$ gives $$F(x)=\frac{1}{1-x-x^2}=\frac{1}{(x-\alpha)(x-\beta)}$$ where $\alpha = \frac{-1+\sqrt{5}}{2}$ and $\beta = \frac{-1-\sqrt{5}}{2}$. Now we will use the method of partial fractions to find constants $A$ and $B$ such that $$\frac{1}{(x-\alpha)(x-\beta)}=\frac{A}{(x-\alpha)}+\frac{B}{(x-\beta)}$$ Multiplying both sides of the equation by $(x-\alpha)(x-\beta)$ gives $$1=A(x-\beta)+B(x-\alpha)$$ Expanding gives $$1=(A+B)x-(A\beta+B\alpha)$$ therefore, we must have $$\begin{cases}A+B=0\\-(A\beta+B\alpha)=1\end{cases}$$ Solving this system yields, $A=\frac{1}{\sqrt{5}}$ and $B=-\frac{1}{\sqrt{5}}$. Now, \begin{align*} \frac{A}{(x-\alpha)}+\frac{B}{(x-\beta)}&=\frac{1}{\sqrt{5}}\frac{1}{(x-\alpha)}-\frac{1}{\sqrt{5}}\frac{1}{(x-\beta)}\\ &=-\frac{1}{\sqrt{5}}\frac{1}{(\alpha-x)}+\frac{1}{\sqrt{5}}\frac{1}{(\beta-x)}\\ &=-\frac{1}{\sqrt{5}}\frac{\beta}{\beta(\alpha-x)}+\frac{1}{\sqrt{5}}\frac{\alpha}{\alpha(\beta-x)}\\ &=-\frac{1}{\sqrt{5}}\frac{\beta}{(-1-\beta x)}+\frac{1}{\sqrt{5}}\frac{\alpha}{(-1-\alpha x)}\tag{since $\alpha\cdot\beta=-1$}\\ &=\frac{1}{\sqrt{5}}\frac{\beta}{(1-(-\beta x))}-\frac{1}{\sqrt{5}}\frac{\alpha}{(1-(-\alpha x))}\\ &=-\frac{1}{\sqrt{5}}(-\beta)\sum_{n\geq 0}(-\beta)^nx^n+\frac{1}{\sqrt{5}}(-\alpha)\sum_{n\geq 0}(-\alpha)^nx^n\\ &=\sum_{n\geq 0}\left[\frac{1}{\sqrt{5}}(-\alpha)^{n+1}-\frac{1}{\sqrt{5}}(-\beta)^{n+1}\right]x^n \end{align*} Therefore, \begin{align*} f(n)&=\frac{1}{\sqrt{5}}\left(\frac{1-\sqrt{5}}{2}\right)^{n+1}-\frac{1}{\sqrt{5}}\left(\frac{1+\sqrt{5}}{2}\right)^{n+1} \end{align*}
Your mistake is writing $-x^2-x+1=(x-\alpha)(x-\beta)$, notice the leading coefficient of LHS is $-1$ while that of RHS is $1$, so all your subsequent calculations are corresponding to $1/(x^2+x-1)$ instead. The correct way is to expect $-x^2-x+1=-(x-\alpha)(x-\beta)$.