How to show a formula too long to fit in a line?
For example: $$ P(Y-X=m | Y > X) = \sum_{k} P(Y-X=m, X=k | Y > X) = \sum_{k} P(Y-X=m | X=k, Y > X) P(X=k | Y > X) = \sum_{k} P(Y-k=m | Y > k) P(X=k | Y > X).$$
Thanks!
How to show a formula too long to fit in a line?
For example: $$ P(Y-X=m | Y > X) = \sum_{k} P(Y-X=m, X=k | Y > X) = \sum_{k} P(Y-X=m | X=k, Y > X) P(X=k | Y > X) = \sum_{k} P(Y-k=m | Y > k) P(X=k | Y > X).$$
Thanks!
Use double dollars and the \begin{align*} environment (within TeX-mode) to solve the problem.
$$\begin{align*} P(Y-X=m | Y > X) &= \sum_{k} P(Y-X=m, X=k | Y > X) \\ &= \sum_{k} P(Y-X=m | X=k, Y > X) P(X=k | Y > X) \\ &= \sum_{k} P(Y-k=m | Y > k) P(X=k | Y > X).\end{align*}$$
$$\begin{align*}
P(Y-X=m | Y > X) &= \sum_{k} P(Y-X=m, X=k | Y > X) \
&= \sum_{k} P(Y-X=m | X=k, Y > X) P(X=k | Y > X) \
&= \sum_{k} P(Y-k=m | Y > k) P(X=k | Y > X).\end{align*}$$
\left(
and ends with a \right)
? The align
environment seems to fail (in MathJax) for that case.
$\endgroup$
Commented
Mar 19, 2011 at 17:47
\right.
to close the left(
on the first line and the invisible \left.
to open the closing \right)
on the last line and make \begin{align}...\end{align}
happy.
$\endgroup$
\begin{align*}
environment can be used without first going into TeX mode (without the double dollar signs), though it sometimes requires you to escape with extra backslashes to get the interpreter to understand.
$\endgroup$
Commented
Mar 19, 2011 at 21:13
\left
and \right
pairs not working across line breaks is also inherent already in standard TeX, so not a problem with MathJax per se. The usual way to solve the problem is to manually insert \big
and similar versions. See en.wikipedia.org/wiki/Help:Displaying_a_formula
$\endgroup$
Commented
Mar 23, 2011 at 16:11
\begin{align*}
and \begin{align}
?
$\endgroup$
align*
is an unnumbered environment, whereas align
is numbered.
$\endgroup$
Alternatively, since MathJax supports the amsmath
extensions, the split
environment is also supported:
$$\begin{split}P(Y-X=m | Y > X) &= \sum_{k} P(Y-X=m, X=k | Y > X) \\ &= \sum_{k} P(Y-X=m | X=k, Y > X) P(X=k | Y > X) \\ &= \sum_{k} P(Y-k=m | Y > k) P(X=k | Y > X).\end{split}$$
which is generated by
$$\begin{split}
P(Y-X=m | Y > X) &= \sum_{k} P(Y-X=m, X=k | Y > X) \\ &= \sum_{k} P(Y-X=m | X=k, Y > X) P(X=k | Y > X) \\ &= \sum_{k} P(Y-k=m | Y > k) P(X=k | Y > X).\end{split}$$
\mid
instead of |
... :)
$\endgroup$
\middle
to go along with \left
and \right
though.
$\endgroup$
Commented
Aug 7, 2011 at 10:14
As the last mathematician in the world still using Plain TeX, I'd do it with eqalign.
$$\eqalign{P(Y-X=m\mid Y\gt X)&=\sum_kP(Y-X=m,X=k\mid Y\gt X)\cr&=\sum_kP(Y-X=m\mid X=k,Y\gt X)\,P(X=k\mid Y>X)\cr&=\sum_kP(Y-k=m\mid Y\gt k)\,P(X=k\mid Y\gt X)\cr}$$
\eqalign{
P(Y-X=m\mid Y\gt X)
&=\sum_kP(Y-X=m,X=k\mid Y\gt X)\cr
&=\sum_kP(Y-X=m\mid X=k,Y\gt X)\,P(X=k\mid Y>X)\cr
&=\sum_kP(Y-k=m\mid Y\gt k)\,P(X=k\mid Y\gt X)\cr
}