3

I was wondering if anyone might be able to help me out with a spacing issue that I'm running into whenever I type out a lengthy equation. I'm trying to make my proof of the binomial theorem look clean, but I'm running into trouble when trying to align the equations in a aesthetically appealing fashion. I tried using the split equation environment, and while it made everything visible on the page, I still really don't like the spacing, I would like everything to be vertically centered (horizontally as well, though that hasn't been to big of an issue). I'm new to LaTeX, as well as this site, so I would greatly appreciate any advice (code or otherwise).

\documentclass{article}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{setspace}
\usepackage{bm}

\begin{document}


\noindent \textbf{Binomial Theorem:} If $n \in {\mathbb Z_{\geq 0}}$, then

$$(x+y)^n = \sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k}$$

\begin{doublespace} \end{doublespace}
\noindent \textbf{Proof:} Let $n=0$, then $(x+y)^0 = 
\displaystyle\sum_{k=0}^{0} \binom{0}{k}x^{k}y^{-k} = 1$.

Suppose this holds for $n \geq 1$, we need to show that it holds for $n+1$, so
\begin{equation*}
\begin{split}
(x+y)^{n+1} = (x+y) \sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k} 
\\ &= \sum_{k=0}^{n} \binom{n}{k}x^{k+1}y^{n-k} + \sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k+1}
\end{split}
\end{equation*} 
Now we reindex the first sum, replacing each occurrence of $k$ 
by $k-1$. Since the original sum extends over all values of $k$, 
so does the reindexed sum. Hence
\begin{center}
\begin{equation*}
\begin{split}
(x+y)^{n+1} = 
\sum_{k=0}^{n} \binom{n}{k-1}x^{k}y^{n-k+1} + \sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k+1} 
\\ &= \sum_{k=0}^{n} \bigg(\binom{n}{k-1} + \binom{n}{k}\bigg)x^{k}y^{n-k+1} 
\\ &= \sum_{k=0}^{n} \binom{n}{k-1}x^{k}y^{n-k+1}
\end{split}
\end{equation*} 
\end{center}
By the addition identity, this establishes the required result. 

\end{document}
azetina
  • 28,884
Spence
  • 31

2 Answers2

1

It seems that you looking for this:

enter image description here

Anchors for split of equations should be present in each line of equation:

\documentclass{article}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{setspace}
\usepackage{bm}

\begin{document}
\noindent \textbf{Binomial Theorem:} If $n \in {\mathbb Z_{\geq 0}}$, then
    \[
(x+y)^n = \sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k}
    \]
\noindent \textbf{Proof:} Let $n=0$, then $(x+y)^0 =
\displaystyle\sum_{k=0}^{0} \binom{0}{k}x^{k}y^{-k} = 1$.

Suppose this holds for $n \geq 1$, we need to show that it holds for $n+1$, so
    \[
\begin{split}
(x+y)^{n+1} 
    & = (x+y) \sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k}   \\ 
    & = \sum_{k=0}^{n} \binom{n}{k}x^{k+1}y^{n-k} + \sum_{k=0}^{n}
                        \binom{n}{k}x^{k}y^{n-k+1}
\end{split}
    \]
Now we reindex the first sum, replacing each occurrence of $k$
by $k-1$. Since the original sum extends over all values of $k$,
so does the reindexed sum. Hence
    \[
\begin{split}
(x+y)^{n+1} 
    & = \sum_{k=0}^{n} \binom{n}{k-1}x^{k}y^{n-k+1} 
                    + \sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k+1} \\ 
    &= \sum_{k=0}^{n} \bigg(\binom{n}{k-1} 
                    + \binom{n}{k}\bigg)x^{k}y^{n-k+1}          \\ 
    &= \sum_{k=0}^{n} \binom{n}{k-1}x^{k}y^{n-k+1}
\end{split}
    \]
By the addition identity, this establishes the required result.
    \end{document}
Zarko
  • 296,517
1

Your input misses a couple of &, but it also has some other glitches.

  1. Use environments for the logical structures such as theorems and proofs; if you use \noindent in the document body more than once, there's something wrong

  2. Never use $$ (see Why is \[ ... \] preferable to $$ ... $$?)

  3. The syntax {\Bbb Z} has been replaced by \mathbb{Z} a couple of decades ago: use \mathbb{Z}_{\geq 0} or, even better something like below.

  4. \begin{doublespace}\end{doublespace} does nothing at all.

  5. The \displaystyle in the proof's first line just does harm: it spoils the line spacing, but also gives too much prominence to a trivial case

For point 1, you can use amsthm and a small trick for defining “named theorems”. If you want a colon instead of a period, it's just a matter of defining a theorem style (there are several examples on the site). Similarly for the typesetting of the “Proof” tag.

Why defining \numberset as \mathbb and \Z in terms of \numberset? Because this gives you much more flexibility; if your supervisor tells you that the integers and all other number set names should be typeset in fancy calligraphic, you just need to change one line of your document and not chasing through it for \mathbb.

I present here two realizations of your code; in the second one the alignment of the equals signs goes on for both displays.

\documentclass{article}
\usepackage{mathtools}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{bm}

\newcommand{\numberset}[1]{\mathbb{#1}}
\newcommand{\Z}{\numberset{Z}}

\newcommand{\NAMEDtheoremname}{}
\newtheorem*{NAMED}{\NAMEDtheoremname}
\newenvironment{namedtheorem}[1]
 {\renewcommand{\NAMEDtheoremname}{#1}\begin{NAMED}}
 {\end{NAMED}}

\begin{document}

\begin{namedtheorem}{Binomial Theorem}
If $n \in \Z_{\geq 0}$, then
\[
(x+y)^n = \sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k}
\]
\end{namedtheorem}

\begin{proof}
Let $n=0$, then $(x+y)^0 = \sum_{k=0}^{0} \binom{0}{k}x^{k}y^{-k} = 1$.

Suppose this holds for $n \geq 1$, we need to show that it holds for $n+1$, so
\begin{equation*}
\begin{split}
(x+y)^{n+1}
  &= (x+y) \sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k} \\
  &= \sum_{k=0}^{n} \binom{n}{k}x^{k+1}y^{n-k} + 
     \sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k+1}
\end{split}
\end{equation*} 
Now we reindex the first sum, replacing each occurrence of $k$ 
by $k-1$. Since the original sum extends over all values of $k$, 
so does the reindexed sum. Hence
\begin{equation*}
\begin{split}
(x+y)^{n+1}
  &= \sum_{k=0}^{n} \binom{n}{k-1}x^{k}y^{n-k+1} + 
     \sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k+1} \\
  &= \sum_{k=0}^{n} \biggl(\binom{n}{k-1} + \binom{n}{k}\biggr)x^{k}y^{n-k+1} \\
  &= \sum_{k=0}^{n} \binom{n}{k-1}x^{k}y^{n-k+1}
\end{split}
\end{equation*} 
By the addition identity, this establishes the required result. 
\end{proof}

\end{document}

enter image description here

Second version

\documentclass{article}
\usepackage{mathtools}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{bm}

\newcommand{\numberset}[1]{\mathbb{#1}}
\newcommand{\Z}{\numberset{Z}}

\newcommand{\NAMEDtheoremname}{}
\newtheorem*{NAMED}{\NAMEDtheoremname}
\newenvironment{namedtheorem}[1]
 {\renewcommand{\NAMEDtheoremname}{#1}\begin{NAMED}}
 {\end{NAMED}}

\begin{document}

\begin{namedtheorem}{Binomial Theorem}
If $n \in \Z_{\geq 0}$, then
\[
(x+y)^n = \sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k}
\]
\end{namedtheorem}

\begin{proof}
Let $n=0$, then $(x+y)^0 = \sum_{k=0}^{0} \binom{0}{k}x^{k}y^{-k} = 1$.

Suppose this holds for $n \geq 1$, we need to show that it holds for $n+1$, so
\begin{align*}
(x+y)^{n+1}
  &= (x+y) \sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k} \\
  &= \sum_{k=0}^{n} \binom{n}{k}x^{k+1}y^{n-k} + 
     \sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k+1}
\intertext{Now we reindex the first sum, replacing each occurrence of $k$ 
by $k-1$. Since the original sum extends over all values of $k$, 
so does the reindexed sum. Hence}
(x+y)^{n+1}
  &= \sum_{k=0}^{n} \binom{n}{k-1}x^{k}y^{n-k+1} + 
     \sum_{k=0}^{n} \binom{n}{k}x^{k}y^{n-k+1} \\
  &= \sum_{k=0}^{n} \biggl(\binom{n}{k-1} + \binom{n}{k}\biggr)x^{k}y^{n-k+1} \\
  &= \sum_{k=0}^{n} \binom{n}{k-1}x^{k}y^{n-k+1}
\end{align*} 
By the addition identity, this establishes the required result. 
\end{proof}

\end{document}

enter image description here

egreg
  • 1,121,712
  • This looks amazing! And thank you for those pointers! I've typed up a few documents using the double space command, and it felt redundant, but I just got into the bad habit of using it. And those new commands are going to save me an extraordinary amount of time! Thank-you so much for the help! – Spence May 17 '16 at 16:34