# can array environment be applied in this case?

Consider the following document:

Basically what I would like to have are two things:

a curly bracket on the right side encompassing equations (5) and (6) below (in the flalign environment). From the curly bracket I would like to have a \Rightarrow leading to an equation (a=b).

\documentclass[leqno,10pt]{article}
\usepackage{soul}
\usepackage[margin=0.75in]{geometry}
\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]}
\let\endchangemargin=\endlist
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{mathtools}
\usepackage{enumitem,array}
\usepackage{relsize}
\usepackage{amsmath}
\usepackage{amsthm} %for proof
\newtheorem*{mythm}{Theorem}
\newtheorem*{mydef}{Definition}
\newtheorem*{mycases}{Special Cases}
\title{\ul{Conditional Expectations in Bivariate Probability Distribution}}
\date{}
\newenvironment{mydescription}{%
\renewcommand\descriptionlabel[1]{\hspace{\labelsep}\textbf{{##1}}}%
\begin{description}%
}{%
\end{description}%
}
\newenvironment{definition}[1][Definition]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}

\providecommand\given{}
\DeclarePairedDelimiterX{\EV}[1]{E(}{)}{\renewcommand\given{\nonscript\,\delimsize\vert\nonscript\,} #1}
\providecommand\iven{}
\DeclarePairedDelimiterX{\V}[1]{V(}{)}{\renewcommand\iven{\nonscript\,\delimsize\vert\nonscript\,} #1}

\begin{document}

\newenvironment{Myitemize}{%
\renewcommand{\labelitemi}{{}}%
\begin{itemize}[nosep]}{\end{itemize}}

\maketitle

\newcommand{\myitem}{\stepcounter{enumi}\item[(\theenumi)]}%for enumerate with no. in brackets
\newcommand\litem[1]{\item{\bfseries {#1}}}

\thispagestyle{fancy}

\begin{mydef}
If the random vector $(X,Y)$ has joint \textbf{pdf} $f(x,y)$ with conditional \textbf{pdf} $g_{2}(y|x)$, and if $Z=h(X,Y)$ is a (single-valued) function of (X,Y). Then the conditional expectation of the random variable $Z$, given $X=x$ is
$$E(Z|x)=\int_{-\infty}^{\infty}{h(x,y)g_{2}(y|x)dy} \label{eq:}$$
\end{mydef}

\begin{mycases}
(a,b,c are constants; ($X^{*}=X-E(X); Y^{*}=Y-E(Y)$)\\
\begin{flalign}\label{cas}
& Z=a+bX+cY & \Rightarrow\quad & \!\begin{aligned}[t]\EV{Z \given x}&=\EV{a \given x}+b.\EV{X \given x}+c.\EV{Y \given x} \\&= a+bx+c.\EV{Y \given x} \end{aligned} &\hphantom{Z=a+bX+cY\quad(2)} & \\
& Z=XY & \Rightarrow\quad & \EV{Z \given x} = x\EV{Y \given x}\\
& Z = Y & \Rightarrow\quad & \EV{Z \given x} = \EV{Y \given x} = \mu_{Y|x} = \text{The CE of Y given X}\\
& Z=(Y-\mu_{Y|X})^{2} &\Rightarrow\quad & \EV{Z \given x} = \V{Y \iven x} = \sigma^{2}_{Y|x}=\text{The CV of Y given X}\\
& Z=(Y-\mu_{Y})^{2} & \Rightarrow\quad & \EV{Z \given x} = \V{Y \iven x} + (\mu_{Y|x}-\mu_{Y})^2
\end{flalign}

\end{mycases}

\end{document}


I'll admit it is a kludge (that is to say, it is tailored for your specific problem rather than as a general approach), but I added the following to the end of the 2nd to last equation: \quad\smash{\raisebox{-10pt}{$\left.\rule{0pt}{17pt}\right\} a=b$}}

\documentclass[leqno,10pt]{article}
\usepackage{soul}
\usepackage[margin=0.75in]{geometry}
\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]}
\let\endchangemargin=\endlist
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{mathtools}
\usepackage{enumitem,array}
\usepackage{relsize}
\usepackage{amsmath}
\usepackage{amsthm} %for proof
\newtheorem*{mythm}{Theorem}
\newtheorem*{mydef}{Definition}
\newtheorem*{mycases}{Special Cases}
\title{\ul{Conditional Expectations in Bivariate Probability Distribution}}
\date{}
\newenvironment{mydescription}{%
\renewcommand\descriptionlabel[1]{\hspace{\labelsep}\textbf{{##1}}}%
\begin{description}%
}{%
\end{description}%
}
\newenvironment{definition}[1][Definition]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}

\providecommand\given{}
\DeclarePairedDelimiterX{\EV}[1]{E(}{)}{\renewcommand\given{\nonscript\,\delimsize\vert\nonscript\,} #1}
\providecommand\iven{}
\DeclarePairedDelimiterX{\V}[1]{V(}{)}{\renewcommand\iven{\nonscript\,\delimsize\vert\nonscript\,} #1}

\begin{document}

\newenvironment{Myitemize}{%
\renewcommand{\labelitemi}{{}}%
\begin{itemize}[nosep]}{\end{itemize}}

\maketitle

\newcommand{\myitem}{\stepcounter{enumi}\item[(\theenumi)]}%for enumerate with no. in brackets
\newcommand\litem[1]{\item{\bfseries {#1}}}

\thispagestyle{fancy}

\begin{mydef}
If the random vector $(X,Y)$ has joint \textbf{pdf} $f(x,y)$ with conditional \textbf{pdf} $g_{2}(y|x)$, and if $Z=h(X,Y)$ is a (single-valued) function of (X,Y). Then the conditional expectation of the random variable $Z$, given $X=x$ is
$$E(Z|x)=\int_{-\infty}^{\infty}{h(x,y)g_{2}(y|x)dy} \label{eq:}$$
\end{mydef}

\begin{mycases}
(a,b,c are constants; ($X^{*}=X-E(X); Y^{*}=Y-E(Y)$)\\
\begin{flalign}\label{cas}
& Z=a+bX+cY & \Rightarrow\quad & \!\begin{aligned}[t]\EV{Z \given x}&=\EV{a \given x}+b.\EV{X \given x}+c.\EV{Y \given x} \\&= a+bx+c.\EV{Y \given x} \end{aligned} &\hphantom{Z=a+bX+cY\quad(2)} & \\
& Z=XY & \Rightarrow\quad & \EV{Z \given x} = x\EV{Y \given x}\\
& Z = Y & \Rightarrow\quad & \EV{Z \given x} = \EV{Y \given x} = \mu_{Y|x} = \text{The CE of Y given X}\\
& Z=(Y-\mu_{Y|X})^{2} &\Rightarrow\quad & \EV{Z \given x} = \V{Y \iven x} = \sigma^{2}_{Y|x}=\text{The CV of Y given X}
\quad\smash{\raisebox{-10pt}{$\left.\rule{0pt}{17pt}\right\} a=b$}}\\
& Z=(Y-\mu_{Y})^{2} & \Rightarrow\quad & \EV{Z \given x} = \V{Y \iven x} + (\mu_{Y|x}-\mu_{Y})^2
\end{flalign}

\end{mycases}

\end{document}


• Hi, and thanks for the great answer. Would it be possible for you to please help me understand the part after the \raisebox? How is it enabling latex to draw the curly bracket? Cheers! – Abhimanyu Arora Aug 29 '14 at 13:46
• @AbhimanyuArora In math mode, the \left. stuff \right\} syntax will print out "stuff" followed by an enclosing right brace. In this case, I made "stuff" equal to a vertical line of zero width using the \rule{width}{height} syntax. I made the rule tall enough to span half of the brace height. Since math braces force vertical symmetry, it extended the bottom of the brace to match the extension I specified to the top. – Steven B. Segletes Aug 29 '14 at 13:49
• @AbhimanyuArora I chose to add this fix to the equation (5) line, rather than the equation (6) line, because the equation (5) line was longer in width. The \smash tells LaTeX to ignore the objects height in terms of making space for it, so that it doesn't push equation 6 down to make room for the descending brace. – Steven B. Segletes Aug 29 '14 at 13:52
• Thanks so much both for the answer as well as the great explanations! Have a great day – Abhimanyu Arora Aug 29 '14 at 13:54