A geometric sequence $(a_n)$ has $a_1=\sin x$, $a_2=\cos x$, and $a_3= \tan x$ for some real number $x$. For what value of $n$ does $a_n=1+\cos x$?
$\textbf{(A)}\ 4 \qquad \textbf{(B)}\ 5 \qquad \textbf{(C)}\ 6 \qquad \textbf{(D)}\ 7 \qquad \textbf{(E)}\ 8$
By the defintion of a geometric sequence, we have $\cos^2x=\sin x \tan x$. Since $\tan x=\frac{\sin x}{\cos x}$, we can rewrite this as $\cos^3x=\sin^2x$. 
The common ratio of the sequence is $\frac{\cos x}{\sin x}$, so we can write
\[a_1= \sin x\]
\[a_2= \cos x\]
\[a_3= \frac{\cos^2x}{\sin x}\]
\[a_4=\frac{\cos^3x}{\sin^2x}=1\]
\[a_5=\frac{\cos x}{\sin x}\]
\[a_6=\frac{\cos^2x}{\sin^2x}\]
\[a_7=\frac{\cos^3x}{\sin^3x}=\frac{1}{\sin x}\]
\[a_8=\frac{\cos x}{\sin^2 x}=\frac{1}{\cos^2 x}\]

Since $\cos^3x=\sin^2x=1-\cos^2x$, we have $\cos^3x+\cos^2x=1 \implies \cos^2x(\cos x+1)=1 \implies \cos x+1=\frac{1}{\cos^2 x}$, which is $a_8$ , making our answer $8 \Rightarrow \boxed{E}$.