[Tex/LaTex] Typesetting a function defined by case analysis

casesmath-mode

Can any one suggess me the code to write this equation in LaTeX.

enter image description here

Best Answer

You can make use of mathtools and its cases* environment.

The environments cases* and dcases* handles the second column as text, so you wont have to manually "escape" mathmode to typeset the text correctly. The dcases* variant use displaystyle math in the first column, which will make no difference in your situation. See section 3.4.3 in the package documentation for more details.

If you want to remove the equation number (1), you can use \begin{equation*} ... \end{equation*} instead of \begin{equation} ... \end{equation}.

\documentclass{article}
\usepackage{mathtools}

\begin{document}
  \begin{equation}
    L =
    \begin{cases*}
      (0 + 1)^{*} & if $P = \mathit{NP}$ \\
      \phi        & otherwise
    \end{cases*}
  \end{equation}
\end{document}

Output

Related Question