How to align the equal signs in this equation such that the first line and last 2 lines align
Here goes an answer:
\documentclass{amsart}
\begin{document}
\begin{align*}
&CoJPoD_{ \{I_1, \dots, I_{k-1}, I_{k+1}, \dots, I_{n}\} \mid I_{k} } \\
&= CoJPoD_{ \{\mathrm{system} \backslash I_{k}\} \mid I_k} \\
&= P\bigl( X_1 \ge X_d^{I_1}, \dots, X_{k-1} \ge X_d^{I_{k-1}}, X_{k+1} \ge X_d^{I_{k+1}}, \dots, X_n \ge X_d^{I_n} \mid X_k \ge X_d^{I_k}\bigr) \\
&=\frac{P\bigl( X_1 \ge X_d^{I_1}, \dots, X_{k-1} \ge X_d^{I_{k-1}}, X_k \ge X_d^{I_k}, X_{k+1} \ge X_d^{I_{k+1}}, \dots, X_n \ge X_d^{I_n}\bigr)}{P\bigl(X_k \ge X_d^{I_k}\bigr)} \\
&= \frac{JPoD_{\{I_1, I_2, \dots, I_n\}}}{PoD_{I_k}}\\
&= \frac{JPoD_{\mathrm{system}}}{PoD_{I_k}}
\end{align*}
\end{document}
Some of the changes I have made are:
- indicating how the equations should be aligned by using the
&
syntax. - using
\mathrm{text}
for subscripts which aretext
of length more than 1. - replace the
\cdots
directive by\dots
so that amsclasses figure what is best to do. - replace
|
by\mid
. - replace
\left(...\right)
by\bigl(...\bigr)
.
You'd find this entire document a very useful read. In particular, I'd like to draw you attention to the examples and discussion of the various align environments in Section 3 (pp. 3-9).
Output
I would still avoid the expression if possible because seemingly it's blurring the fact that the inequalities are repeated for the whole index set except k
which should be easy to convey for the author and to grasp for the reader. Something along the lines of
\documentclass{article}
\usepackage{mathtools} %<- Loads amsmath and enhances/fixes it.
\begin{document}
Let us introduce the shorthand notation $\sigma_i$ for the
inequality $X_i \ge X_d^{I_i}$. Then we have,
\begin{align*}
CoJPoD_{ \{I_1, \cdots, I_{k-1}, I_{k+1}, \cdots, I_{n}\} | I_{k} } &= CoJPoD_{ \{\text{system}\backslash I_{k}\} | I_k}\\
&= P\left( \sigma_1, \cdots, \sigma_{k-1}, \sigma_{k+1}, \cdots, \sigma_{n} | \sigma_k\right) \\
&= \frac{P\left( \sigma_{1}, \cdots, \sigma_n\right)}{P\left(\sigma_k\right)} \\
&= \frac{JPoD_{\{I_1, I_2, \cdots, I_n\}}}{PoD_{I_k}} \\
&= \frac{JPoD_{system}}{PoD_{I_k}}
\end{align*}
\end{document}
Last minute edit: I've missed the fix for the second system
word and the ...PoD
s. But other answers covered those pretty thoroughly.
And this is the solution, giving the output that you described.
\begin{align*}
CoJPoD_{ \{I_1, \cdots, I_{k-1}, I_{k+1}, \cdots, I_{n}\} | I_{k} } &= CoJPoD_{ \{system \backslash I_{k}\} | I_k} \\
\noalign{\text{$ = P\left( X_1 \ge X_d^{I_1}, \cdots, X_{k-1} \ge X_d^{I_{k-1}}, X_{k+1} \ge X_d^{I_{k+1}}, \cdots, X_n \ge X_d^{I_n} | X_k \ge X_d^{I_k}\right) $}}\\
\noalign{\text{$ = \displaystyle\frac{ P\left( X_1 \ge X_d^{I_1}, \cdots, X_{k-1} \ge X_d^{I_{k-1}}, X_k \ge X_d^{I_k}, X_{k+1} \ge X_d^{I_{k+1}}, \cdots, X_n \ge X_d^{I_n}\right) }{P\left(X_k \ge X_d^{I_k}\right)}$}} \\
& = \frac{JPoD_{\{I_1, I_2, \cdots, I_n\}}}{PoD_{I_k}} \\
& = \frac{JPoD_{system}}{PoD_{I_k}}
\end{align*}
However, I'd rather like the following code:
\begin{align*}
\mathit{CoJPoD}_{ \{I_1, \ldots, I_{k-1}, I_{k+1}, \ldots, I_{n}\} | I_{k} } &= \mathrm{CoJPoD}_{ \{\mathrm{system} \setminus I_{k}\} | I_k} \\ %either \mathit or \mathrm
\noalign{\text{$ = P\left( X_1 \ge X_d^{I_1}, \dots, X_{k-1} \ge X_d^{I_{k-1}}, X_{k+1} \ge X_d^{I_{k+1}}, \ldots, X_n \ge X_d^{I_n} | X_k \ge X_d^{I_k}\right) $}}\\
\noalign{\text{$ = \displaystyle\frac{ P\left( X_1 \ge X_d^{I_1}, \ldots, X_{k-1} \ge X_d^{I_{k-1}}, X_k \ge X_d^{I_k}, X_{k+1} \ge X_d^{I_{k+1}}, \ldots, X_n \ge X_d^{I_n}\right) }{P\left(X_k \ge X_d^{I_k}\right)}$}} \\
& = \frac{\mathrm{JPoD}_{\{I_1, I_2, \cdots, I_n\}}}{\mathrm{PoD}_{I_k}} \\ %either \mathit or \mathrm
& = \frac{\mathit{JPoD}_{\mathrm{system}}}{\mathrm{PoD}_{I_k}} %either \mathit or \mathrm
\end{align*}
Certainly, CoJPoD, JPoD, PoD should be either \mathrm
or \mathit
. This gives us better spacing. See also usage of \setminus
instead of \backslash
and \ldots
instead of \cdots
.