LaTex produces the formula I want:
but it returns some warning messages. The is the code of the formula above, I don't know where is the mistake:
\begin{align}
\mathbb{D} (k,n) = \frac{2}{n_q} ~\text{cos} \bigg(\frac{(n-1)(k-1)\pi}{n_q /2} \bigg) \cdot
\left\{ \begin{array}{c l l}
1/2 & \mbox{if} & n=\{1, n_q /2+1 \}\\
1 & \multicolumn{2}{l}{\mbox{otherwise}} \\
\end{array} \right
\end{align}


\right.(with a period after\right). Also it should be\cosand not\text{cos}. – egreg Sep 18 '17 at 12:40\cosinstead of\text{cos}and\textinstead of\mbox– Sep 18 '17 at 12:44