2

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).
<to be read again>
$

I do not understand how to correct it please.

  • Don't use $$. Use \[ \] instead – user156344 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
2

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 $$ ... $$?.

enter image description here

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*}

enter image description here

1

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}

enter image description here

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

1

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

enter image description here

\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}
1

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} 

enter image description here

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