Thank you for asking for the solution of this nice and easy problem. We can prove this with at least three different ways. One of them, is the following:
3−22−1=(3−1)−22…(1)
3
n
−
2
n
2
−
1
=
(
3
n
−
1
)
−
2
n
2
…
(
1
)
Now, if
n
is even, we observe that:
3≡1(8)=>3−1≡0(8)…(2)
3
n
≡
1
(
m
o
d
8
)
=>
3
n
−
1
≡
0
(
m
o
d
8
)
…
(
2
)
and of course:
22≡0(8)…(3)
2
n
2
≡
0
(
m
o
d
8
)
…
(
3
)
Hence, by (1)
(
1
)
, (2)
(
2
)
and (3)
(
3
)
when
n
is even, we are done.
In case at which
n
is odd, we see that:
3≡3(8)=>3−1≡2(8)…(4)
3
n
≡
3
(
m
o
d
8
)
=>
3
n
−
1
≡
2
(
m
o
d
8
)
…
(
4
)
Moreover, when
n
is odd there exists integer
m
, such that =2+1
n
=
2
m
+
1
and we easily observe that:
22=2(2+1)2=82+8+2…(5)
2
n
2
=
2
(
2
m
+
1
)
2
=
8
m
2
+
8
m
+
2
…
(
5
)
Hence by (5)
(
5
)
, we conclude that:
22≡2(8)...(6)
2
n
2
≡
2
(
m
o
d
8
)
.
.
.
(
6
)
Finally, by (1)
(
1
)
, (4)
(
4
)
and (6)
(
6
)
when
n
is even, we are done and hence the proof follows.
Second proof:
3−22−1=(3−1)−22=
3
n
−
2
n
2
−
1
=
(
3
n
−
1
)
−
2
n
2
=
(3−1)(3−1+3−2+...+3+1)−22=
(
3
−
1
)
(
3
n
−
1
+
3
n
−
2
+
.
.
.
+
3
+
1
)
−
2
n
2
=
2[(3−1+3−2+...+3+1)−2]…(1)
2
[
(
3
n
−
1
+
3
n
−
2
+
.
.
.
+
3
+
1
)
−
n
2
]
…
(
1
)
Now, if we will prove that:
(3−1+3−2+...+3+1)−2≡0(4)
(
3
n
−
1
+
3
n
−
2
+
.
.
.
+
3
+
1
)
−
n
2
≡
0
(
m
o
d
4
)
we will be done. We easily observe that when
n
is even the number of powers of 3
3
from 3 1
1
to 3−1
3
n
−
1
is odd since −1
n
−
1
is odd. Moreove, since:
For =
n
=
odd =>3≡3(4)...(2)
=>
3
n
≡
3
(
m
o
d
4
)
.
.
.
(
2
)
For =
n
=
even =>3≡1(4)...(3)
=>
3
n
≡
1
(
m
o
d
4
)
.
.
.
(
3
)
we see that each consecutive pair of them is divisible by 4
4
. Hence, when
n
is even, we conclude that:
3−1+3−2+...+3+≡3(4)=>
3
n
−
1
+
3
n
−
2
+
.
.
.
+
3
+
≡
3
(
m
o
d
4
)
=>
3−1+3−2+...+3+1)≡0(4)...(4)
3
n
−
1
+
3
n
−
2
+
.
.
.
+
3
+
1
)
≡
0
(
m
o
d
4
)
.
.
.
(
4
)
and since
n
is even, it follows that:
2≡0(4)...(5)
n
2
≡
0
(
m
o
d
4
)
.
.
.
(
5
)
Hence, by (4)
(
4
)
and (5)
(
5
)
, we take:
(3−1+3−2+...+3+1)−2≡0(4)...(6)
(
3
n
−
1
+
3
n
−
2
+
.
.
.
+
3
+
1
)
−
n
2
≡
0
(
m
o
d
4
)
.
.
.
(
6
)
Now, when
n
is odd, we have an even number of consecutive powers of 3
3
and since each consecutive pair of them is divisible by 4
4
, we see that:
(3−1+3−2+...+3+1)≡1(4)...(7)
(
3
n
−
1
+
3
n
−
2
+
.
.
.
+
3
+
1
)
≡
1
(
m
o
d
4
)
.
.
.
(
7
)
and since
n
is odd, it follows that:
2≡1(4)...(8)
n
2
≡
1
(
m
o
d
4
)
.
.
.
(
8
)
Hence, by (7)
(
7
)
and (8)
(
8
)
, we take:
(3−1+3−2+...+3+1)−2≡0(4)...(9)
(
3
n
−
1
+
3
n
−
2
+
.
.
.
+
3
+
1
)
−
n
2
≡
0
(
m
o
d
4
)
.
.
.
(
9
)
Therefore, by (5)
(
5
)
and (9)
(
9
)
we complete the second proof.
Third proof (by induction):
For =1=>31−2(1)2−1=(0)(8)
n
=
1
=>
3
1
−
2
(
1
)
2
−
1
=
(
0
)
(
8
)
For =2=>32−2(2)2−1=(0)(8)
n
=
2
=>
3
2
−
2
(
2
)
2
−
1
=
(
0
)
(
8
)
For =3=>33−2(3)2−1=(1)(8)
n
=
3
=>
3
3
−
2
(
3
)
2
−
1
=
(
1
)
(
8
)
We assume that for =
n
=
k
:
3−2()2−1=8...(1)
3
k
−
2
(
k
)
2
−
1
=
8
m
.
.
.
(
1
)
where
m
is positive integer.
We will show that for =+1
n
=
k
+
1
:
3+1−2(+1)2−1=8...(2)
3
k
+
1
−
2
(
k
+
1
)
2
−
1
=
8
p
.
.
.
(
2
)
where
p
is positive integer.
By properly modifying (2)
(
2
)
, we have to show that:
3(3)−2(+1)2−1=8<=>
3
(
3
k
)
−
2
(
k
+
1
)
2
−
1
=
8
p
<=>
3(3)−22−4−2−1=8<=>
3
(
3
k
)
−
2
k
2
−
4
k
−
2
−
1
=
8
p
<=>
(3−22−1)+[2(3)−4−2]=8<=>
(
3
k
−
2
k
2
−
1
)
+
[
2
(
3
k
)
−
4
k
−
2
]
=
8
p
<=>
8+2[3−2−1]=8…(3)
8
m
+
2
[
3
k
−
2
k
−
1
]
=
8
p
…
(
3
)
Hence, by (3)
(
3
)
, if we will show that:
[3−2−1]≡04
[
3
k
−
2
k
−
1
]
≡
0
m
o
d
4
we will be done.
Case 1,
k
is odd:
3≡3(4)...(4)
3
k
≡
3
(
m
o
d
4
)
.
.
.
(
4
)
2≡2(4)...(5)
2
k
≡
2
(
m
o
d
4
)
.
.
.
(
5
)
Hence, by (4)
(
4
)
and (5)
(
5
)
, we take:
[3−2−1]≡04
[
3
k
−
2
k
−
1
]
≡
0
m
o
d
4
Case 2,
k
is even:
3≡1(4)...(6)
3
k
≡
1
(
m
o
d
4
)
.
.
.
(
6
)
2≡0(4)...(7)
2
k
≡
0
(
m
o
d
4
)
.
.
.
(
7
)
Hence, by (6)
(
6
)
and (7)
(
7
)
, we take:
[3−2−1]≡04
[
3
k
−
2
k
−
1
]
≡
0
m
o
d
4
and the third proof is now complete.