I have reccurence relation:
$$a_n=\frac{1}{1-p}a_{n-1}-\frac{p}{1-p}a_{n-2}$$
Solving this using method from wikipedia, so plug $a_n=r^n$
$$r^2-\frac{1}{1-p}r+\frac{p}{1-p}$$
so $r_1=\frac{\frac{1}{1-p}-\lvert\frac{1-2p}{1-p}\rvert}{2}$ and $r_2=\frac{\frac{1}{1-p}+\lvert\frac{1-2p}{1-p}\rvert}{2}$ (if I calculated this correctly)
So the general solution should be
$$A(\frac{\frac{1}{1-p}-\lvert\frac{1-2p}{1-p}\rvert}{2})^n+B(\frac{\frac{1}{1-p}+\lvert\frac{1-2p}{1-p}\rvert}{2})^n$$
But WolframAlpha says:
$$A(\frac{p}{1-p})^n+B$$
What is correct?
There is no difference between your solution and that of Wolfram Alpha. If $\frac{1-2p}{1-p} \ge 0$ then $$ r_1=\frac{\frac{1}{1-p}-\frac{1-2p}{1-p}}{2} = \frac{p}{1-p} \\ r_2=\frac{\frac{1}{1-p}+\frac{1-2p}{1-p}}{2} = 1 $$ and if $\frac{1-2p}{1-p} < 0$ then $r_1 = 1$, $r_2 = \frac{p}{1-p}$.
In other words: The set $$ \{ r_1, r_2 \} = \left\{ \frac 12 \left( \frac{1}{1-p}-\left|\frac{1-2p}{1-p}\right|\right) , \frac 12 \left( \frac{1}{1-p}+\left|\frac{1-2p}{1-p}\right|\right) \right\} $$ is equal to the set $$ \left\{ \frac 12 \left( \frac{1}{1-p}-\frac{1-2p}{1-p}\right) , \frac 12 \left( \frac{1}{1-p}+\frac{1-2p}{1-p}\right) \right\} = \{ \frac{p}{1-p}, 1 \} $$ so you just “found” a slightly more complicated way to describe the solution set of $$ r^2-\frac{1}{1-p}r+\frac{p}{1-p} = \bigl(r-1\bigr) \left( r-\frac{p}{1-p}\right) $$