Let $S_n$ be the sum of the first $n$ elements of the geometric sequence. We know that $$\log_3\left(\frac{S_n}{2}+1\right)=n$$ Given this, determine the common ratio $r$.
My attempt
We've got $$\log_3\left(\frac{S_n}{2}+1\right)=n$$ We can remove the logarithm by raising both sides to $3$. $$\frac{S_n}{2}+1=3^n$$ Let's subtract $1$ from both sides $$\frac{S_n}{2}=3^n-1$$ Now, let's multiply everything by $2$ $$S_n=2 \cdot 3^n-2$$ Now, let's rewrite $S_n$ $$a_1\left(\frac{1-r^n}{1-r}\right)=2\cdot3^n-2$$ I can continue, but it doesn't lead me anywhere.
$S_1=2(3^1-1) $ and $S_2=2(3^2-1)$
$\Rightarrow a_1=4 \ and \ a_2=S_2-S_1= 16-4=12 \Rightarrow r=\frac{a_2}{a_1}=3$