\documentclass[10pt, twoside, openany]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
%\usepackage{kpfonts}
\usepackage{float}
\raggedbottom

% Where are our images?
\graphicspath{{images/}}

% Let's set this as a half-letter sized sheet
% https://tex.stackexchange.com/questions/338789/how-to-set-paper-size-to-half-letter-5-5-x-8-5-in-in-amsbook
\usepackage{geometry}
\geometry{
	paperheight=8.5in,
	paperwidth=5.5in,
%	heightrounded,
	margin=0.5in
}

% Adjust the top and bottom margins
% http://kb.mit.edu/confluence/pages/viewpage.action?pageId=3907057
\addtolength{\topmargin}{0.4in}
\addtolength{\textheight}{-0.75in}

% Set the header style
% https://www.overleaf.com/learn/latex/Headers_and_footers
\usepackage{fancyhdr}
\pagestyle{fancy}
 \fancyhf{}
 \fancyhead[RE]{Completing}
 \fancyhead[LO]{the Square}
 \cfoot{\thepage}
\renewcommand{\footrulewidth}{0.5pt}

% Remove the heading from the last page, if necessary
\fancypagestyle{lastpage}{ %
 \fancyhf{} % remove everything
 \cfoot{\thepage}
}

% We will probably want some two- or three-column sections
\usepackage{multicol}

\title{Completing the Square}
\author{Kenneth John Odle}
\date{16 July 2023}

\begin{document}

\maketitle

\begin{abstract}
The purpose of this document is to describe how to ``complete the square''---a common method for factoring quadratic equations. 

It also provides several worked equations to serve as examples.
\end{abstract}

\section{Quadratic Equations}

\textbf{Quadratic equations} are equations of the form $ax^2+bx+c=0$. 

The simplest quadratic equation to solve is the type where both sides are a perfect square, because you can solve them by taking the square root of both sides:

\begin{align}\label{eq1}
\begin{split}
4x^2 &= 36 \\
\sqrt{4x^2} &= \sqrt{36} \\
2x &= \pm6 \\
x &= \pm\frac{6}{2} \\
x &= \pm3
\end{split}
\end{align}

\paragraph{Note:} Because we are taking the square root of a constant, we must include both the positive and negative values of the square root, hence $\pm3$. In story problems, the situation may mean that we can safely ignore one of these values.

\paragraph{Factorable equations} The other type of quadratic equation is one that can easily be solved by factoring. For example,

\begin{align}\label{eq2}
\begin{split}
x^2-x-6 &= 0 \\
(x-3)(x+2) &= 0 
\end{split}
\end{align}

Because any number times zero is equal to zero, we can conclude that either $x-3$ or $x+2$ (or both) are equal to zero. In the first case:

\begin{align}\label{eq3}
\begin{split}
x-3 & =0 \\
x &= 3
\end{split}
\end{align}

and in the second case:

\begin{align}\label{eq4}
\begin{split}
x+2 &= 0 \\
x &= -2
\end{split}
\end{align}

Using either of these values for $x$ in equation \ref{eq2} will result in one of the factors being equal to zero, meaning both sides of the equation will be zero.

\section{The Quadratic Equation}

For equations that are not easily factored, a general solution called ``the 	quadratic equation'' can be used to solve any quadratic.

For any equation of the form $ax^2+bx+c=0$, the solution can be found by using:

\begin{equation}\label{eq5}
x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}
\end{equation}

In reality, the quadratic equation is a generalized form of the solving technique called ``completing the square''. Using the quadratic equation is generally much easier (it can be programmed into some calculators and spreadsheets, for instance), but completing the square is used in certain calculus problems and for graphing some functions.

\section{Completing the Square}

The general procedure for completing the square is to first make both sides of the equation into a perfect square, and then solving it as we did in \ref{eq1}. This is not a difficult process, but most students tend to get stuck on the first step---making the equation into a perfect square. 

Here is the general procedure:

\begin{enumerate}
\item If the value for $a$ is \textit{not} 1, divide both sides of the equation by $a$. (We want the $x^2$ term to be by itself.) 
\item Move the constant term to the right side of the equation.
\item Divide $b$ by 2, square it, and add it to both sides of equation. 
\item Write the left side as a perfect square.
\item Take the square root of both sides.
\item Solve for $x$.
\end{enumerate}

\paragraph{Note:} Our goal is to make the \textit{left} side of the equation into a square. However, the right side will often not be a perfect square, as in equation set~(\ref{eq1}). This means that we will have a $\sqrt{~~}$ sign in our solution.

\subsection{Example \#1}

For our first example, we'll use an equation in which $a$ is already 1, so we can skip the first step. Our equation is \[x^2+4x+1=0\]

The second step is the move the constant term to the right side of the equation by subtracting 1 from both sides: \[x^2+4x+1-1=0-1\] \[x^2+4x=-1\]

Our value for $b$ is 4. $4\div2 = 2$ and $2^2=4$, so we will add 4 to both sides of the equation (step three): \[x^2+4x+4=-1+4\] \[x^2+4x+4=3\]

The left side is now a perfect square. Because $x^2+4x+4=(x+2)^2$ we can rewrite it as a perfect square (step four): \[(x+2)^2=3\]

All that is left to do is to take the square root of both sides (step five): \[\sqrt{(x+2)^2}=\pm\sqrt{3}\]

which gives us \[x+2=\pm\sqrt{3}\]

and then solve for $x$ (step six): \[x=\pm\sqrt{3} -2\]

Conventionally, we would write this as $x=-2+\sqrt{3}$ or $x=-2-\sqrt{3}$.

\bigskip

\noindent{}Here is the entire sequence all together:

\begin{equation}\label{eq6}
\begin{aligned}
x^2+4x+1 &= 0 && && &&\text{Original equation}\\
 & && && &&a=1\text{ so Step 1 is not needed} \\
x^2+4x &= -1 && && &&\text{Step 2}\\
x^2+4x &= 3  && && &&\text{Step 3}\\
(x+2)^2 &= 3 && && && \text{Step 4}\\
\sqrt{(x+2)^2} &= \pm\sqrt{3} && && && \text{Step 5}\\
x+2 &= \pm\sqrt{3} && && && \text{Step 5}\\
x &= -2\pm\sqrt{3} && && &&\text{Step 6}
%\end{split}
\end{aligned}
\end{equation}

\pagestyle{lastpage}% Remove the header from the last page; comment this out if the document ends on an odd-numbered page

\end{document}