trying to solve $2^x \equiv 9 \pmod{13}$ I'm trying to solve 
$$ 2^x \equiv 9 \pmod{13} $$
so I tried to define all numbers for $x$ which match this requirement and I came up with this equation:
$$ \sqrt{\sin(((x)-13/2-9)*\pi/13)^2} $$
now i just want numbers 2^x and i changed it to
$$ \sqrt{\sin(((2^x)-13/2-9)*\pi/13)^2} = 1 $$
this part seems to work, i come to
$${pi = pi, x = ln(-1/2*(-31*pi+13*Pi)/pi)/ln(2)}, {pi = pi, x = ln(1/2*(31*pi+13*Pi)/pi)/ln(2)}$$
and
$$ 2^(1.442695041*ln(-.5000000000*(-31.*pi+40.84070450)/pi)) = 9.00000000099 $$
the second requirement is that $x$ is an integer, I defined it by this equation
$$ \sqrt{\sin((x+1/2)*\pi)^2}=1 $$
but when I try to solve this system of equations with maple, I don't get an answer, why?
 A: The powers of $2$ mod $13$ are:
$$
\begin{array}{c|c}
n&0&1&2&3&4&5&6&7&8&9&10&11&12\\
\hline
2^n\text{ mod }13&1&2&4&8&3&6&12&11&9&5&10&7&1
\end{array}
$$
Note that this repeats for $n$ mod $12$. Therefore,
$$
n\equiv8\pmod{12}\implies2^n\equiv9\pmod{13}
$$

Here are plots of the functions you are using:
$\hspace{8mm}$
Both curves do seem to meet at $x=8$; however, tangents to solutions are often less stable for automated solvers. A small amount of error can keep a solution from being found. This is most likely why Maple is having trouble finding solutions. The frequecy of the green function get higher as $x$ gets larger, while the frequency of the red function stays constant. This also adds to the numerical instability.

A more stable attempt would be to use
$$
\sin((2^x-9)\pi/13)=0
$$
and
$$
\sin(x\pi/13)=0
$$

However, the frequency of the green function becomes so great at the next solution ($x=20$), that numerical solution become sensitive to small errors because of that.
A: I used another method, using less intelligence than Mark Bennet's answer but still a little quicker than checking all the powers until the answer appears.  Checking powers of 2 modulo 13, I got 2, 4, 8, 3, 6, 12.  Since $2^6\equiv 12\equiv-1$ and $2^2=4$, it follows that $2^{6+2}\equiv4\cdot(-1)\equiv 9$ so one solution is 6+2, i.e., 8.  
To get all the solutions, use the fact that powers of 2 (or of anything) repeat after 12 steps, by Fermat's little theorem.  The powers of 2 don't repeat after any proper divisor of 2 many steps (because none of the 2, 4, 8, 3, 6, 12 computed above are 1), so all the solutions are $8+12k$ for arbitrary natural numbers $k$.
A: Note that $2^4=16 \equiv 3 \mod 13$ so that $2^8=(2^4)^2\equiv (3)^2=9 \mod 13$
