3

In the following display, $+ \frac{1}{4!}$ in the third line of the alignat environment should be aligned directly below $+ \frac{1}{2!}$ in the second line. Depending on the spacing in the corrected display, I may want to have $+ \frac{1}{n!}$ aligned directly below $+ \frac{1}{4!}$. Why does my code not give me this alignment? How do I get the alignment that I want?

\documentclass{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}

\begin{document}

\noindent {\em The sequence}
\begin{equation*}
\left(1 + \frac{1}{n}\right)^{n}
\end{equation*}
{\em is bounded between $2$ and $2.75$.}
\vskip0.2in

\noindent $a_{1} = 2$, and since the given sequence is an increasing sequence, $a_{n} > 2$ for every integer $n > 1$. According to the Binomial Theorem,
\allowdisplaybreaks{
\begin{alignat*}{2}
\left(1 + \frac{1}{n}\right)^{n} &= 1 + \binom{n}{1} \frac{1}{n} + \binom{n}{2} \frac{1}{n^{2}} + \binom{n}{3} \frac{1}{n^{3}} + \ldots
+ \binom{n}{n} \frac{1}{n^{n}} \\
&= 1 + 1 &&+ \frac{1}{2!}\left(1 - \frac{1}{n}\right) + \frac{1}{3!}\left(1 - \frac{1}{n}\right)\left(1 - \frac{2}{n}\right) \\
&&&+ \frac{1}{4!}\left(1 - \frac{1}{n}\right)\left(1 - \frac{2}{n}\right)\left(1 - \frac{3}{n}\right) + \ldots \\
&&&+ \frac{1}{n!}\left(1 - \frac{1}{n}\right)\left(1 - \frac{2}{n}\right) \cdots \left(1 - \frac{n - 1}{n}\right) \\
&< 1 + 1 + \frac{1}{2!} + \frac{1}{3!} + \ldots + \frac{1}{n!} \\
&= 1 + 1 + \frac{1}{2!} + \frac{1}{2}\left(\frac{2}{3!} + \frac{2}{4!} + \ldots + \frac{2}{n!}\right) \\
&< 1 + 1 + \frac{1}{2!} + \frac{1}{2}\left(\frac{1}{3} + \frac{1}{3^{2}} + \ldots + \frac{1}{3^{n-2}}\right) \\
&< 1 + 1 + \frac{1}{2!} + \frac{1}{2}\left(\frac{1}{3} + \frac{1}{3^{2}} + \ldots + \frac{1}{3^{n-2}} + \frac{1}{3^{n-1}} + \frac{1}{3^{n}} + \ldots \right) \\
&< 1 + 1 + \frac{1}{2} + \frac{1}{2} \left( \frac{1}{2} \right) \\
&= 2 + \frac{3}{4} . \ \rule{1.5ex}{1.5ex}
\end{alignat*}}

\end{document}
Mico
  • 506,678
user74973
  • 4,071

2 Answers2

3

I don't think it's necessary to set up and fine-tune an alignat* environment. A basic align* environment, coupled with two \phantom statement, suffices.

enter image description here

\documentclass{amsart}
\begin{document}
\noindent 
{\em The sequence
\begin{equation*}
\left(1 + \frac{1}{n}\right)^{n}
\end{equation*}
is bounded between $2$ and $2.75$.}

\vskip0.2in

\noindent $a_{1} = 2$, and since the given sequence is an increasing 
sequence, $a_{n} > 2$ for every integer $n > 1$. According to the Binomial 
Theorem,
\allowdisplaybreaks
\begin{align*}
\left(1 + \frac{1}{n}\right)^{n} &= 1 + \binom{n}{1} \frac{1}{n} + 
  \binom{n}{2} \frac{1}{n^{2}} + \binom{n}{3} \frac{1}{n^{3}} + \dots
  + \binom{n}{n} \frac{1}{n^{n}} \\
&= 1 + 1 + \frac{1}{2!}\left(1 - \frac{1}{n}\right) + \frac{1}{3!}\left(1 - 
  \frac{1}{n}\right)\left(1 - \frac{2}{n}\right) \\
&\phantom{{}= 1 + 1}{}+ \frac{1}{4!}\left(1 - \frac{1}{n}\right)\left(1 - 
  \frac{2}{n}\right)\left(1 - \frac{3}{n}\right) + \dotsb \\
&\phantom{{}= 1 + 1}{}+ \frac{1}{n!}\left(1 - \frac{1}{n}\right)\left(1 - 
  \frac{2}{n}\right) \dotsb \left(1 - \frac{n - 1}{n}\right) \\
&< 1 + 1 + \frac{1}{2!} + \frac{1}{3!} + \dots + \frac{1}{n!} \\
&= 1 + 1 + \frac{1}{2!} + \frac{1}{2}\left(\frac{2}{3!} + \frac{2}{4!} + 
  \dots + \frac{2}{n!}\right) \\
&< 1 + 1 + \frac{1}{2!} + \frac{1}{2}\left(\frac{1}{3} + \frac{1}{3^{2}} + 
  \dots + \frac{1}{3^{n-2}}\right) \\
&< 1 + 1 + \frac{1}{2!} + \frac{1}{2}\left(\frac{1}{3} + \frac{1}{3^{2}} + 
\dots + \frac{1}{3^{n-2}} + \frac{1}{3^{n-1}} + \frac{1}{3^{n}} + \dotsb 
  \right) \\
&< 1 + 1 + \frac{1}{2} + \frac{1}{2} \left( \frac{1}{2} \right) \\
&= 2 + \frac{3}{4} \,. \quad \rule{1.5ex}{1.5ex}
\end{align*}

\end{document}
Mico
  • 506,678
  • Yep. I had the proper alignment with an align environment and \hphantom commands. I want to know how to do it with an alignat environment. (I think not having both alignments set in the first line is leading to the misalignment ... but I don't know why that is happening!) – user74973 Dec 26 '15 at 17:03
  • 1
    @user74973 - The problem you described in your posting arises because there's no second alignment point in the first and the final row of the ten-row expression. Short of re-writing the first and last rows in some major ways, I see no way how an alignat* environment might be used here. – Mico Dec 26 '15 at 17:08
  • Either I didn't know that about the alignat environment or I forgot about it - one needs to maintain all alignment marks in every line of an alignat environment. Thanks. – user74973 Dec 26 '15 at 17:20
  • 1
    since amsart is being used, i think \qedhere would be a good thing, with the symbol being changed if desired. – barbara beeton Dec 26 '15 at 22:29
  • @barbarabeeton - Thanks for pointing out the availability of the \qedhere macro. Let's see if the OP weighs in and expresses a view on the preferred appearance of the QED symbol. – Mico Dec 28 '15 at 17:23
  • @Mico Coincidentally, I am currently referring to an analysis textbook that uses \qedhere. I have seen more and more textbooks using this symbol, too. I guess that I prefer the symbol that I have been using because it is customary for me. Objectively, it is more noticeable than the symbol printed using \qedhere. – user74973 Dec 30 '15 at 18:00
2

Nest aligned in an align environment:

\documentclass{amsart}
\usepackage{amsmath}
\usepackage{amssymb}

\newtheorem*{statement}{Statement}

\allowdisplaybreaks

\begin{document}

\begin{statement}
The sequence
\begin{equation*}
a_{n}=\left(1 + \frac{1}{n}\right)^{n}
\end{equation*}
is bounded between $2$ and $2.75$.
\end{statement}

\begin{proof}
We have $a_{1} = 2$ and, since the given sequence is an increasing sequence, $a_{n} > 2$ 
for every integer $n > 1$. According to the Binomial Theorem,
\begin{align*}
\left(1 + \frac{1}{n}\right)^{n} 
  &= 1 + \binom{n}{1} \frac{1}{n} + \binom{n}{2} \frac{1}{n^{2}} + \binom{n}{3} \frac{1}{n^{3}} + \dots
     + \binom{n}{n} \frac{1}{n^{n}} \\
  &= \!\begin{aligned}[t]
     1 + 1 &+ \frac{1}{2!}\left(1 - \frac{1}{n}\right)
            + \frac{1}{3!}\left(1 - \frac{1}{n}\right)\left(1 - \frac{2}{n}\right) \\
           &+ \frac{1}{4!}\left(1 - \frac{1}{n}\right)\left(1 
            - \frac{2}{n}\right)\left(1 - \frac{3}{n}\right) + \dotsb \\
           &+ \frac{1}{n!}\left(1 - \frac{1}{n}\right)\left(1 - \frac{2}{n}\right) \dots
                \left(1 - \frac{n - 1}{n}\right)
     \end{aligned}\\
  &< 1 + 1 + \frac{1}{2!} + \frac{1}{3!} + \ldots + \frac{1}{n!} \\
  &= 1 + 1 + \frac{1}{2!} + \frac{1}{2}\left(\frac{2}{3!} + \frac{2}{4!} + \dots + \frac{2}{n!}\right) \\
  &< 1 + 1 + \frac{1}{2!} + \frac{1}{2}\left(\frac{1}{3} + \frac{1}{3^{2}} + \dots
       + \frac{1}{3^{n-2}}\right) \\
  &< 1 + 1 + \frac{1}{2!} + \frac{1}{2}\left(\frac{1}{3} + \frac{1}{3^{2}} + \ldots + \frac{1}{3^{n-2}}
       + \frac{1}{3^{n-1}} + \frac{1}{3^{n}} + \ldots \right) \\
  &< 1 + 1 + \frac{1}{2} + \frac{1}{2} \left( \frac{1}{2} \right) \\
  &= 2 + \frac{3}{4} .\qedhere
\end{align*}
\end{proof}

\end{document}

enter image description here

Note that \allowdisplaybreaks is a declaration and not a command with argument. It should be issued in the preamble and removed for the final version of the document, where suitable \displaybreak commands should be added at the desired spots.

egreg
  • 1,121,712
  • This is some nice code. Why do you have \! before the aligned environment? Is there an erroneous small space that LaTeX puts before such environments, and a small negative space is needed to cancel the small space? Does the option t put the aligned environment flush to the bottom of the first line of the align environment? – user74973 Dec 26 '15 at 17:32
  • 1
    @user74973 The \! has been discussed in Why is there a space at the beginning of the aligned environment. The [t] is to get aligned into using the top row for the vertical positioning. – egreg Dec 26 '15 at 17:36
  • I tried replacing allowdisplaybreaks with displaybreak. I get an error. Do I need a package in the preamble? – user74973 Dec 26 '15 at 17:38
  • 2
    @user74973 \displaybreak should go in the row of align you want a break after. – egreg Dec 26 '15 at 17:39
  • I get an error compiling your code: "Command \! invalid in math mode on line 102. ! Argument of \begin has an extra }." Do I need some additional package in my preamble to use an aligned environment? – user74973 Dec 26 '15 at 17:47
  • @user74973 Sorry, but I just pasted the code I wrote for getting the shown output. Command \! invalid in math mode means you (or some package you're using) have redefined it. – egreg Dec 26 '15 at 17:50
  • I had \usepackage{graphicx,tipa} in my preamble to define the arc command. I don't need it in this file. I would prefer to keep it, though. What is an equivalent command for \!? Is it \hspace{- blah}? – user74973 Dec 26 '15 at 17:55
  • @user74973 \usepackage[safe]{tipa} doesn't redefine \|, \:, \;, \!; since the package provides substitutes for these, it's better doing so when math is used in the document. I'm not sure what “arc command” you're referring to, but probably it can be defined without tipa. – egreg Dec 26 '15 at 18:00
  • I just saw that the \negthinspace command is abbreviated by \!. So, I can use \negthinspace to avoid another package like tipa from redefining it. (\negthinspace is equal to 1/6 of a quad.) – user74973 Dec 26 '15 at 19:01
  • @user74973 No, \negthinspace is for use in text, not in math. You'll experience other problems without the safe option to tipa, when you have math in your document. – egreg Dec 26 '15 at 19:02
  • Rats! Should I just use \usepackage[safe]{tipa} and \usepackage{graphicx} in the preamble? – user74973 Dec 26 '15 at 19:04
  • 1
    @user74973 Yes. But maybe you can make a new question about the “arc command”. – egreg Dec 26 '15 at 19:09
  • These are the declarations that I have in my preamble to have TikZ draw the arc symbol above two or three letters indicating an arc of a circle. \usepackage{graphicx}, usepackage{tipa}, \newcommand{\arc}[1] {% \setbox9=\hbox{#1}% \ooalign{\resizebox{\wd9}{\height}{\texttoptiebar{\phantom{A}}}\cr#1}}. I found them on tex.stackexchange. – user74973 Dec 26 '15 at 19:36
  • 1
    @user74973 I added a different answer that avoids the dependency on tipa (and fixes the buggy solution you were using). – egreg Dec 26 '15 at 21:04
  • Did you add a different answer? I can also avoid tipa from redefining \! by replacing \! with a \hspace{} command with an appropriate value for the width. Do you know what that is in math mode? – user74973 Dec 30 '15 at 19:27
  • @user74973 The answer was to the question about \arc – egreg Dec 30 '15 at 20:25