# Missing $inserted error when using \pi I wanted to write down an equation however it seems that whenever I use \pi I keep on getting Missing$ inserted error Here is my code:

$u_k = 2\cos(2^kr\pi)$
\subsection{Create an equation for $u\textsubscript{k+1}$  using $u_k$}
$u_k = 2 \times \Re(e\textsuperscript{2ir$\pi$})$
\\
$u\textsubscript{k+1} = 2 \times \Re(e\textsuperscript{2\textsuperscript{k+1}ir\pi }) = 2 \times \Re(e\textsuperscript{2\superscript{k}ir\pi }\textsuperscript{2}) \Leftrightarrow \\ 2 \times( \cos^2(2^kr\pi ) - \sin^2(2^kr\pi ) )= 4\cos^2(2^kr\pi ) - 2$


Here of a few of my many errors:

! Missing $inserted. <inserted text>$
l.125 ...superscript{2\textsuperscript{k+1}ir\pi }
)
?
! Extra }, or forgotten $. \mbox #1->\leavevmode \hbox {#1} l.125 ...superscript{2\textsuperscript{k+1}ir\pi } ) ?  Just in case it matters I'm using the amsmath package. Thanks • Welcome. For superscripts in math mode there is ^: e^{2^{k+1}ir\pi} is the correct code. Similarly $u_{k+1}$ for subscripts. Aug 17, 2020 at 16:54 • Hmm, It doesn't seem to work. The errors are excactly the same. Aug 17, 2020 at 17:05 • Fix \Re(e\textsuperscript{2ir$\pi$}) into \Re(e^{2ir\pi}) Aug 17, 2020 at 17:13 • Thanks it works now. Aug 17, 2020 at 17:20 • \textsuperscript is for when you're in text mode, and what's inside is also in text mode. Aug 17, 2020 at 17:44 ## 1 Answer I supposed it is something like this you're trying to obtain: \documentclass{article}% \usepackage{nccmath, mathtools} \usepackage{amssymb} \begin{document}$u_k = 2\cos(2^kr\pi)$\subsection{Create an equation for \boldmath$u_{k+1}$using$u_k\$}
\begin{fleqn}
\begin{alignat*}{2}
u_k = {}& 2 \times \Re(e^{2ir\pi}) & & \\
u_{k+1}={} & 2 \times \Re(e^{2^{k+1}ir\pi }) = 2 \times \Re(e^{2^{k}ir\pi^{2}}) & & \\[-1ex]
\ArrowBetweenLines*[\Updownarrow]
& 2 \times( \cos^2(2^kr\pi ) - \sin^2(2^kr\pi ) )= 4\cos^2(2^kr\pi ) - 2
\end{alignat*}
\end{fleqn}

\end{document} 