I've had trouble trying to prove this statement. I have been at it for 4 hours, but I don't feel like the proof I produced is right. And since this is a simple question, I think I am missing some big point. I hope you guys can share some tips or feedback.
Here's the solution I've come up with so far. I am sure there is a more elegant way. I was also thinking of maybe assuming n is odd and finding a contradiction or come to a false conslusion using P.M.I. (math induction).
Let $n$ be a positive integer, then $n\geq1$. Suppose $3^n\equiv1 \pmod 8$. Then $8\mid 3^n-1$ and $3^n-1=8k$ for some integer $k$. Suppose $n$ is even, then $n=2v$ for some positive integer $v$. Then $$3^{2v}-1=8k=(3^2)^v-1=9^v-1,$$ which can be rewritten as $9^v-1=8k$. Now we need to prove that for every positive integer $v\geq 1$, $8\mid 9^v-1$ holds.
Let $P(v)$ denote the statement $8|9^v-1$. We shall prove, by mathematical induction that $\forall v\geq1:P(v)$. For $v=1$, $$P(1)\iff 8\mid9-1\iff 8\mid 8,$$ $8$ does indeed divide itself. Hence the basis premise $P(1)$ is true.
Now we shall work with the second step of this proof, which is the induction premise. Let $v$ be an integer, $v\geq 1$ and suppose that $P(v)$ is true. That is, suppose that $9^v-1=8m$ for some integer $m$ (induction hypothesis). It must be shown that $P(v+1)$ is true, that is $9^{v+1}-1=8p$ ($*$) for some integer $p$. Let’s expand ($*$). $9^{v+1}-1 = 9^v9^1$. But, by substitution from the induction hypothesis we can rewrite it as: $$(8m+1)9^1-1=72m+9-1=72m+8=8(9m+1)=8p$$ Thus, $P(v+1)$ is true for all $v\geq 1$.
Thus, from the basis step and the induction premise and with the help of P.M.I we can conclude that $P(v)$ is true for all $v\geq 1$. Therefore the congruence holds for all positive and even integers $n$.
Thanks in advance.
This is actually very simple and easy to prove.
Lets assume that it is true for $n$ odd in other words, if $n = 2k+1$ then
$$3^{2k+1} \equiv 1 \mod 8$$ Now note that the inverse for $3$ is $3$. $$3(3^2)^k \equiv 1 \mod 8$$ $$3^1 \equiv 1 \mod 8$$
Leading to a contradiction.