-1

I am trying to write the following mathematical expression in latex:

enter image description here

Can anybody help me out about how can I write this in latex?

Thruston
  • 42,268
Robin Kurtz
  • 115
  • 2

3 Answers3

8

This code:

\documentclass[border=15]{standalone}
\usepackage{amsmath}
\begin{document}
$z_1, \ldots, z_n \stackrel{\mathrm{i.i.d.}}{\sim} N(0, \sigma^2)$
\end{document}

produces exactly what is in your figure.

Andrey L.
  • 1,794
6

Another solution:

\documentclass{standalone}
\newcommand{\iid}{\mathbin{\ooalign{\hidewidth\raise1.2ex\hbox{\tiny i.i.d}\hidewidth\cr$\sim$\cr}}}
\begin{document}
$ z_1, \dots, z_n \iid N(0, \sigma^2) $
\end{document}

which produces

enter image description here

but I think I prefer it without the dots:

\documentclass{standalone}
\newcommand{\iid}{\mathbin{\ooalign{\hidewidth\raise1.2ex\hbox{\tiny iid}\hidewidth\cr$\sim$\cr}}}
\begin{document}
$ z_1, \dots, z_n \iid N(0, \sigma^2) $
\end{document}

enter image description here

For details of ooalign see this highly rated answer.

Thruston
  • 42,268
5

Plain TeX uses macro \buildrel for such purposes:

$ z_1, \dots, z_n \buildrel\rm iid \over\sim N(0, \sigma^2) $
\bye
wipet
  • 74,238