Calculate: $x=2^{12} \pmod{13}$ in $\mathbb{Z}_{13}$ 
Calculate: $x=2^{12} \pmod{13}$ in $\mathbb{Z}_{13}$ by using Fermat's Little Theorem.

So I tried it like this but I don't know if I did it correctly?
Since the $\text{gcd}(2,13)=1$ we can use Fermat which says that 
$$2^{12}\equiv1\pmod{13}$$
So we can write:
$$x \equiv 2^{12}\equiv1\pmod{13}$$
Thus the solution will be $1 \pmod{13}$ ?
 A: It might worth noting that your solution is easy to check in this case: it is worth memorizing your powers of $2$, or at least certain specific ones (e.g. $2^{10}$). In this case, $2^{12} = 4,096$, which leaves a remainder of $1$ when divided by $13$. In this case, you thus use that to verify you're correct, but it's understandable that this is (a) not the method intended to be used and (b) might not be feasible for the general case.

Anyhow, let us remember Fermat's Little Theorem:

Fermat's Little Theorem: Let $p$ be prime, and $a$ an integer. Then $a^p - a$ is a multiple of $p$. This can be stated symbolically in a few ways: namely:
$$p | (a^p - a) \;\;\;\;\;\;\;\;\;\;  \frac{a^p - a}{p} = k \in \mathbb{Z} \;\;\;\;\;\;\;\;\;\; a^p \equiv a \pmod p$$
Corollary/Implication: If $p \not | a$, then this implies $a^{p-1} - 1$ is a multiple of $p$. Again, equivalent formulations:
$$p | (a^{p-1} - 1) \;\;\;\;\;\;\;\;\;\; \frac{a^{p-1} - 1}{p} = k \in \mathbb{Z} \;\;\;\;\;\;\;\;\;\; a^{p-1} \equiv 1 \pmod p$$

We use this latter form of Fermat's Little Theorem in this problem, with $a = 2, p = 13$.
Then by Fermat's Little Theorem, since $p = 13$ is a prime which does divide $a = 2$, we can claim the following:
$$2^{13-1} \equiv 1 \pmod {13} \iff 2^{12} \equiv 1 \pmod {13}$$
When $\mathbb{Z}_{13}$ denotes the integers mod $13$, then it is clear $1 \in \mathbb{Z}_{13}$, and thus $x = 1$ in this problem.

Your proof is more or less right, but Fermat's Little Theorem is not used correctly. Having $gcd(2,13) = 1$ is not a sufficient condition for the corollary of Fermat's Little Theorem: one of them must also be prime. (Then $gcd(a,p) = 1$ would imply the necessary condition of non-divisibility.) As an example, $gcd(15, 14) = 1$ but neither are prime, which means Fermat's Little Theorem could not be used if $a,p$ each were one of $14,15$.
A: Fermat's little theorem says $a^{12}\cong1\pmod{13}$ for $a\neq0\pmod{13}$.  Thus $2^{12}\cong1\pmod{13}$.  So $x=1$.
