[Tex/LaTex] Writing steps in an equation

equations

What is the "best LaTeX practices" for writing equations with multiple steps? Feel free to recommend packages that might help. Do these methods work just as well within an enumeration?

Here is what I currently do:

\documentclass{article}

\begin{document}

\begin{enumerate}

\item Using the previous property, $|\mathbf{x} + \mathbf{y}|^2$

\( = (\mathbf{x} \cdot \mathbf{y}) \cdot (\mathbf{x} \cdot \mathbf{y}) \)

\( = \sum_{i=1}^k (x_i + y_i)(x_i + y_i) \)
(by the definition of inner product

\( = \sum_{i=1}^k (x_i^2 + 2 x_i^{} y_i^{} + y_i^2) \)

\( = \mathbf{x} \cdot \mathbf{x} + 2 \mathbf{x} \cdot \mathbf{y} + \mathbf{y} \cdot \mathbf{y} \)

\( \leq |\mathbf{x} \cdot \mathbf{x}| + 2 |\mathbf{x} \mathbf{y}| + |\mathbf{y} \cdot \mathbf{y}| \)

\( \leq |\mathbf{x}| |\mathbf{x}| + 2 |\mathbf{x}| |\mathbf{y}| + |\mathbf{y}| |\mathbf{y}| \)
(by Property 4)

\( = (|\mathbf{x}| + |\mathbf{y}|)^2, \)

and since both sides are $\geq 0$, we can take the square root.

\end{enumerate}

\end{document}

The main problem is that, because of the enumerate environment, I can't indent each step of the equality, so that first term looks sort of separate…

Best Answer

I usually advise against longish enumerate items in a proof; the indent at the start of a paragraph followed by a number is sufficient to mark a step. If the proof is longer than one page, the page would be very uneven.

1. Using the previous property,
\begin{align*}
\abs{\mathbf{x} + \mathbf{y}}^2
&= (\mathbf{x} \cdot \mathbf{y}) \cdot (\mathbf{x} \cdot \mathbf{y}) \\
&= \sum_{i=1}^k (x_i + y_i)(x_i + y_i)
   \quad\text{(by the definition of inner product)}\\
&= \sum_{i=1}^k (x_i^2 + 2 x_i^{} y_i^{} + y_i^2) \\
&= \mathbf{x} \cdot \mathbf{x}
   + 2 \mathbf{x} \cdot \mathbf{y}
   + \mathbf{y} \cdot \mathbf{y} \\
&\leq \abs{\mathbf{x} \cdot \mathbf{x}}
      + 2 \abs{\mathbf{x} \mathbf{y}}
      + \abs{\mathbf{y} \cdot \mathbf{y}} \\
&\leq \abs{\mathbf{x}} \abs{\mathbf{x}}
      + 2 \abs{\mathbf{x}} \abs{\mathbf{y}}
      + \abs{\mathbf{y}} + \abs{\mathbf{y}}
      \quad\text{(by Property 4)} \\
&= (\abs{\mathbf{x}} + \abs{\mathbf{y}})^2,
\end{align*}
and since both sides are $\geq 0$, we can take the square root.

enter image description here

A tip: notice that in the third line of the alignment I wrote

x_i^2 + 2 x_i^{} y_i^{} + y_i^2

with empty exponents, that will lower the subscripts at the same height as the others on the line.

Related Question