Describing steps in an equation
Somehing like this? (two &&
before the \mbox
)
\documentclass[letterpaper]{article}
\usepackage{fullpage}
\usepackage{amsmath,amssymb,amsthm,enumitem}
\usepackage[dvipsnames]{xcolor}
\newcommand{\red}[1]{%
{\color{OrangeRed}#1}}
\begin{document}
Let us apply completing the square to the standard form of a quadratic equation, $ax^2+bx+c=0$.
\begin{align*}
ax^2+bx+c&=0 &&\text{Divide by $a$, the leading coefficient.}&\\[1.25ex]
x^2+\frac{b}{a}x+\frac{c}{a}&=0 &&\text{Transpose the constant term to the RHS.}&\\[1.25ex]
x^2+\frac{b}{a}x&=-\frac{c}{a}&&\text{\red{Add $\left(\frac{1}{2}\left(\frac{b}{a}\right)\right)^2$ to both sides.}}&\\[1.25ex]
x^2+\frac{b}{a}x+\frac{b^2}{4a^2}&=-\frac{c}{a}+\frac{b^2}{4a^2}&&\text{Factor the LHS and simplify the RHS.}&\\[1.25ex]
\left(x+\frac{b}{a}\right)^2&=\frac{b^2-4ac}{4a^2}&&\text{Take the square root of both sides.}&\\[1.25ex]
x+\frac{b}{a}&=\pm\frac{\sqrt{b^2-4ac}}{2a}&&\text{Solve for $x$.}&\\[1.25ex]
x&=\frac{-b\pm\sqrt{b^2-4ac}}{2a}&&\text{\textbf{Quadratic Formula}.}&
\end{align*}
\end{document}
Package witharrows
provides a new environment WithArrows
similar to align
where it's possible to use command \Arrow
to print some text beside an arrow going from one line to another one.
Here you have the possible result with OP's examples:
\documentclass[letterpaper]{article}
\usepackage{fullpage}
\usepackage{amsmath,amssymb,amsthm,enumitem}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{calc, arrows.meta, bending, decorations.pathreplacing}
\usepackage{witharrows}
\newcommand{\red}[1]{%
{\color{OrangeRed}#1}}
\begin{document}
Let us show that by completing the square, we can achieve this.
\[ \begin{WithArrows}
f(x)&=ax^2+bx+c \Arrow{Factor $a$ from $ax^2+bx$. Do you know why?}\\
&=a\left(x^2+\frac{b}{a}x\right)+c \Arrow[tikz=OrangeRed]{Complete the square by adding $\frac{b^2}{4a^2}$.} \\
&=a\left(x^2+\frac{b}{a}x+\red{\frac{b^2}{4a^2}} \right)+c\red{-a\left(\frac{b^2}{4a^2}\right)}\Arrow{Factor and simplify.}\\
&=a\left(x+\frac{b}{2a}\right)^2+c-\frac{b^2}{4a}\\
&=a\left(x+\frac{b}{2a}\right)^2+\frac{4ac-b^2}{4a}\\
&=a(x-h)^2+k
\end{WithArrows}
\] \end{document}
\documentclass[letterpaper]{article}
\usepackage{fullpage}
\usepackage{amsmath,amssymb,amsthm,enumitem}
\usepackage[dvipsnames]{xcolor}
\newcommand{\red}[1]{%
{\color{OrangeRed}#1}}
\usepackage{tikz}
\usetikzlibrary{calc, arrows.meta, bending, decorations.pathreplacing}
\usepackage{witharrows}
\begin{document}
Let us apply completing the square to the standard form of a quadratic equation, $ax^2+bx+c=0$.
\[\begin{WithArrows}
ax^2+bx+c&=0 \Arrow{Divide by $a$, the leading coefficient.}\\
x^2+\frac{b}{a}x+\frac{c}{a}&=0 \Arrow{Transpose the constant term to the RHS.}\\
x^2+\frac{b}{a}x&=-\frac{c}{a} \Arrow[tikz=OrangeRed]{Add $\left(\frac{1}{2}\left(\frac{b}{a}\right)\right)^2$ to both sides.}\\
x^2+\frac{b}{a}x+\frac{b^2}{4a^2}&=-\frac{c}{a}+\frac{b^2}{4a^2} \Arrow{Factor the LHS and simplify the RHS.}\\
\left(x+\frac{b}{a}\right)^2&=\frac{b^2-4ac}{4a^2} \Arrow{Take the square root of both sides.}\\
x+\frac{b}{a}&=\pm\frac{\sqrt{b^2-4ac}}{2a} \Arrow{Solve for $x$.}\\
x&=\frac{-b\pm\sqrt{b^2-4ac}}{2a}
\end{WithArrows}
\] \end{document}
Note: Package documentation doesn't mention it, but we should load TikZ
and calc, arrows.meta, bending, decorations.pathreplacing
tikzlibraries to use WithArrows
environment.