LaTex produces the formula I want:

enter image description here

but it returns some warning messages. The is the code of the formula above, I don't know where is the mistake:

\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

marked as duplicate by egreg, TeXnician, Troy, Stefan Pinnow, user36296 Sep 18 '17 at 14:29

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 3
    It should be \right. (with a period after \right). Also it should be \cos and not \text{cos}. – egreg Sep 18 '17 at 12:40
  • 1
    Use \cos instead of \text{cos} and \text instead of \mbox – user2478 Sep 18 '17 at 12:44

    \mathbb{D} (k,n) = \frac{2}{n_q} ~\cos \bigg(\frac{(n-1)(k-1)\pi}{n_q /2} \bigg) 
        1/2 &  \text{if } n=\{1, n_q /2+1 \}\\
        1   & \text{otherwise} \\


enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.