# how to write given equation? [duplicate]

I want to read an equation in latex, this is my code:

$$\left \{ \begin{array}{l} \hat{p}=1/N \sum_{i=1}^{N} I_{i} \\ \begin{split} \mathrm{Var}(\hat{p})= & 1/(N^2) \sum_{i=1}^{N} \sum_{j=1}^{N} \mathbb{E}[I_{i},I_{j}] - p^2 \\& = 1/(N^2) \sum_{i=1}^{N} \sum_{j=1}^{N} R(\tau_{ij}) \end{split} \end{array} \right$$


but it gives me this error:

! Missing delimiter (. inserted).
 I do not understand how to correct it please. ## marked as duplicate by The old JouleV, Andrew Swann, marmot, Marcel Krüger, siracusaApr 23 at 19:34 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. • Don't use . Use  instead – The old JouleV Apr 23 at 13:55 • You need something after \right. If you want nothing visual, use \right.. – Steven B. Segletes Apr 23 at 13:56 • @StevenB.Segletes thank you it works – dina Apr 23 at 14:00 ## 4 Answers I wouldn't align the first = with the other two, because they're unrelated and unbalance the final output. Use aligned nested in aligned: \documentclass[twocolumn]{article} \usepackage{amsmath,amssymb} \usepackage{lipsum} % for context \DeclareMathOperator{\Var}{Var} \DeclareMathOperator{\E}{\mathbb{E}} \begin{document} \lipsum*[3] \begin{equation*} \left\{ \begin{aligned} & \hat{p}=\frac{1}{N} \sum_{i=1}^{N} I_{i} \1ex] & \begin{aligned} \Var(\hat{p}) &= \frac{1}{N^2} \sum_{i=1}^{N}\sum_{j=1}^{N} \E[I_{i},I_{j}] - p^2 \\ &= \frac{1}{N^2} \sum_{i=1}^{N}\sum_{j=1}^{N} R(\tau_{ij}) \end{aligned} \end{aligned} \right. \end{equation*} \lipsum \end{document}  Note how I defined auxiliary commands for the variance and expectation. Never use  in LaTeX, see Why is \[ ... preferable to ...\$?.

If the document is not in two-column format, the second formula should not be split. If you prefer aligning the = signs, remove the nesting and change the place for the first &:

\begin{equation*}
\left\{
\begin{aligned}
\hat{p}
&= \frac{1}{N} \sum_{i=1}^{N} I_{i} \1ex] \Var(\hat{p}) &= \frac{1}{N^2} \sum_{i=1}^{N}\sum_{j=1}^{N} \E[I_{i},I_{j}] - p^2 \\ &= \frac{1}{N^2} \sum_{i=1}^{N}\sum_{j=1}^{N} R(\tau_{ij}) \end{aligned} \right. \end{equation*}  The \left and \right macros need to be followed by a delimiter. If no visible delimiter is desired, then the use of a period . serves the purpose. Thus, you need to make the closing syntax a \right.. Also, in LaTeX, don't use  equation delimiters. They are strictly intended for a TeX setting. \documentclass{article} \usepackage{amsmath,array,amssymb} \begin{document} \[ \left \{ \begin{array}{l} \hat{p}=1/N \sum_{i=1}^{N} I_{i} \\ \begin{split} \mathrm{Var}(\hat{p})= & 1/(N^2) \sum_{i=1}^{N} \sum_{j=1}^{N} \mathbb{E}[I_{i},I_{j}] - p^2 \\& = 1/(N^2) \sum_{i=1}^{N} \sum_{j=1}^{N} R(\tau_{ij}) \end{split} \end{array} \right.
\end{document}


Note: there is a cases environment intended for this sort of construct.

Here's a solution that employs an aligned environment to align the three = symbols.

\documentclass{article}
\usepackage{amsmath} % for "aligned" environment and "\DeclareMathOperator" macro
\usepackage{amssymb} % for "\mathbb" macro
\DeclareMathOperator{\E}{\mathbb{E}}  % expectations operator
\DeclareMathOperator{\Var}{Var}       % variance operator
\begin{document}

\left\{ \begin{aligned} \hat{p} &=1/N \sum_{i=1}^{N} I_{i} \\ \Var(\hat{p}) &= 1/(N^2) \sum_{i=1}^{N} \sum_{j=1}^{N} \E [I_{i},I_{j}] - p^2 \\ &= 1/(N^2) \sum_{i=1}^{N} \sum_{j=1}^{N} R(\tau_{ij}) \end{aligned} \right.
\end{document}


Still another variant, with empheq, aligned and the medium-sized fractions from nccmath, which look nicer here, in my opinion. Needlless to load amsmath: both empheq and nccmath do it.

\documentclass{article}
\usepackage{empheq, nccmath} % for "aligned" environment and "\DeclareMathOperator" macro
\usepackage{amssymb} % for "\mathbb" macro
\DeclareMathOperator{\E}{\mathbb{E}} % expectations operator
\DeclareMathOperator{\Var}{Var} % variance operator

\begin{document}

\begin{empheq}[left=\empheqlbrace]{align*}
\hat{p} &=\mfrac{1}{N} \sum_{i=1}^{N} I_{i} \\
\Var(\hat{p})
&= \mfrac{1}{N^2} \sum_{i=1}^{N} \sum_{j=1}^{N}
\E [I_{i},I_{j}] - p^2 \\
&= \mfrac{1}{N^2} \sum_{i=1}^{N} \sum_{j=1}^{N} R(\tau_{ij})
\end{empheq}

\end{document}