# LaTeX aligning equation with matrices

How do I simplify this equation so that each step is shown on a different line, instead of it all being on the same line? I tried to use \begin{align*} \end{align*} but I kept getting errors that I don't know how to fix. This is the code without any alignment

\noindent
Let $k \in \mathbb{N}$ and suppose that the equation holds for $n = k$. Then:\\

$\begin{bmatrix} 1 & 1\\ 1 & 0\\ \end{bmatrix}^{k+1} = \begin{bmatrix} 1 & 1\\ 1 & 0\\ \end{bmatrix}^{k} \begin{bmatrix} 1 & 1\\ 1 & 0\\ \end{bmatrix} = \begin{bmatrix} F_{k+1} & F_{k}\\ F_{k} & F_{k-1} \end{bmatrix} \begin{bmatrix} 1 & 1\\ 1 & 0\\ \end{bmatrix} \text{(by the equation with n = k)} = \begin{bmatrix} F_{k+1} + F_k & F_{k + 1}\\ F_{k} + F_{k - 1} & F_{k} \end{bmatrix} \text{(by matrix multiplication)} = \begin{bmatrix} F_{k+2} & F_{k + 1}\\ F_{k + 1} & F_{k} \end{bmatrix} \text{(by the recurrence F_n = F_{n-1} + F_{n-2})}$ align does work.

\documentclass{article}
\usepackage{amsmath,amssymb}
\begin{document}
Let $k \in \mathbb{N}$ and suppose that the equation holds for $n = k$. Then:
\begin{align*}
\begin{bmatrix}
1 & 1\\
1 & 0\\
\end{bmatrix}^{k+1}
=& \begin{bmatrix}
1 & 1\\
1 & 0\\
\end{bmatrix}^{k}
\begin{bmatrix}
1 & 1\\
1 & 0\\
\end{bmatrix}\\
= &
\begin{bmatrix}
F_{k+1} & F_{k}\\
F_{k} & F_{k-1}
\end{bmatrix}
\begin{bmatrix}
1 & 1\\
1 & 0\\
\end{bmatrix} &\text{(by the equation with $n = k$)}\\
= &
\begin{bmatrix}
F_{k+1} + F_k & F_{k + 1}\\
F_{k} + F_{k - 1} & F_{k}
\end{bmatrix} &\text{(by matrix multiplication)} \\
= &
\begin{bmatrix}
F_{k+2} & F_{k + 1}\\
F_{k + 1} & F_{k}
\end{bmatrix} &\text{(by the recurrence $F_n = F_{n-1} + F_{n-2}$)}
\end{align*}
\end{document} And since you have more vertical than horizontal space, you may try

\documentclass[fleqn]{article}
\usepackage{amsmath,amssymb}
\begin{document}
Let $k \in \mathbb{N}$ and suppose that the equation holds for $n = k$. Then:
\begin{align*}
\begin{bmatrix}
1 & 1\\
1 & 0\\
\end{bmatrix}^{k+1}
=& \begin{bmatrix}
1 & 1\\
1 & 0\\
\end{bmatrix}^{k}
\begin{bmatrix}
1 & 1\\
1 & 0\\
\end{bmatrix}\\
= &
\begin{bmatrix}
F_{k+1} & F_{k}\\
F_{k} & F_{k-1}
\end{bmatrix}
\begin{bmatrix}
1 & 1\\
1 & 0\\
\end{bmatrix} & &
\begin{pmatrix}
\text{by the equation}\\
\text{with $n = k$}
\end{pmatrix}\\
= &
\begin{bmatrix}
F_{k+1} + F_k & F_{k + 1}\\
F_{k} + F_{k - 1} & F_{k}
\end{bmatrix} & &
\begin{pmatrix}\text{by matrix}\\
\text{multiplication}
\end{pmatrix} \\
= &
\begin{bmatrix}
F_{k+2} & F_{k + 1}\\
F_{k + 1} & F_{k}
\end{bmatrix} & &
\begin{pmatrix}\text{by the recurrence}\\
F_n = F_{n-1} + F_{n-2}
\end{pmatrix}
\end{align*}
\end{document} • Aaaah thank you so much for that! I had &= instead of =& which is why I was having issues
– M.Ng
Apr 13, 2018 at 2:22
• Why do you employ =& instead of &=?
– Mico
Apr 13, 2018 at 3:15
• @M.Ng - Using &= (rather than =&) is perfectly OK; for sure, it cannot have been the source of whatever errors you were encountering. For the example at hand; it actually doesn't matter if one uses &= or =&. In general, though, it's much better to use &=.
– Mico
Apr 13, 2018 at 3:26
• @Mico I agree with you that in this case it does not matter and feel that "In general, though, it's much better to use &=." is a slight overstatement. What if the next line starts with a + rather than a =? We could agree on "Often it is better to use &=.", though.
– user121799
Apr 13, 2018 at 4:02
• @marmot - Actually, it's precisely when the next line starts with + or - that it's most critical to use &=: That way, LaTeX will "know" that the spacing around the + or - symbol should be what's appropriate for a binary (rather than a unary) operator. If =& is in use, the horizontal spacing will be off.
– Mico
Apr 13, 2018 at 5:59

Here's a solution that uses (a) an align* environment to align the equations and (b) \tag directives to place the three explanatory "asides" to terminate at the right-hand edge of the text block. This, in turn, reduces any need to introduce line-breaks just to make them fit.

Note that I've also deleted quite a few instances of \\ from your code. \documentclass{article}
\usepackage{amsmath,amssymb}
\begin{document}

\noindent
Let $k \in \mathbb{N}$ and suppose that the equation holds for $n = k$. Then:
\begin{align*}
\begin{bmatrix}
1 & 1\\
1 & 0
\end{bmatrix}^{k+1}
&=
\begin{bmatrix}
1 & 1\\
1 & 0
\end{bmatrix}^{k}
\begin{bmatrix}
1 & 1\\
1 & 0
\end{bmatrix} \\
&=
\begin{bmatrix}
F_{k+1} & F_{k}\\
F_{k} & F_{k-1}
\end{bmatrix}
\begin{bmatrix}
1 & 1\\
1 & 0
\end{bmatrix}
\tag{by the equation with $n = k$} \\
&=
\begin{bmatrix}
F_{k+1} + F_k & F_{k + 1}\\
F_{k} + F_{k - 1} & F_{k}
\end{bmatrix}
\tag{by matrix multiplication} \\
&=
\begin{bmatrix}
F_{k+2} & F_{k + 1}\\
F_{k + 1} & F_{k}
\end{bmatrix}
\tag{by the recurrence $F_n = F_{n-1} + F_{n-2}$}
\end{align*}

\end{document}

• Nice solution. +1
– user121799
Apr 13, 2018 at 6:07