CompleteSquareSteps - Maple Help

Student[Basics]

 CompleteSquareSteps
 generate steps for completing the square of a quadratic expression

 Calling Sequence CompleteSquareSteps( expr, variable ) CompleteSquareSteps( expr, implicitmultiply = true )

Parameters

 expr - string or expression variable - (optional) variable to collect the terms by implicitmultiply - (optional) truefalse output = ... - (optional) option to control the return value displaystyle = ... - (optional) option to control the layout of the steps bringtoleft - (optional) truefalse

Description

 • The CompleteSquareSteps command accepts a polynomial and displays the steps required to complete the square.  As a pre-step, the given expression will be reorganized into the general form of a quadratic by expanding and simplifying as needed.
 • An optional variable can be provided as a second argument.  This so-called variable can also be an expression, such as sin(t) for completing the square to the form (sin(t)+a)^2+b. If no variable is provided, the return of indets(expression,name) is used to find the first variable that has degree 2.
 • If expr is a string, then it is parsed into an expression using InertForm:-Parse so that no automatic simplifications are applied, and thus no steps are missed.
 • The implicitmultiply option is only relevant when expr is a string.  This option is passed directly on to the InertForm:-Parse command and will cause things like 2x to be interpreted as 2*x, but also, xyz to be interpreted as x*y*z.
 • The output and displaystyle options are described in Student:-Basics:-OutputStepsRecord. The return value is controlled by the output option.
 • Setting bringtoleft=false applies the semantics used by Student:-Precalculus:-CompleteSquare when the input expr is an equation or inequality: it attempts to complete the square for quadratics on either or both sides of the relation.  The default bringtoleft=true brings the right-hand side of the relation to the left side before proceeding to complete the square.
 • This function is part of the Student:-Basics package.

Examples

 > $\mathrm{with}\left(\mathrm{Student}:-\mathrm{Basics}\right):$
 > $\mathrm{CompleteSquareSteps}\left(\left(x+1\right)\left(x-3\right)=4x+2\right)$
 $\begin{array}{lll}{}& {}& \left({x}{+}{1}\right){\cdot }\left({x}{-}{3}\right){=}{4}{\cdot }{x}{+}{2}\\ \text{•}& {}& \text{Bring terms to left side}\\ {}& {}& \left({x}{+}{1}\right){}\left({x}{-}{3}\right){-}{4}{}{x}{-}{2}{=}{0}\\ \text{•}& {}& \text{Collect in terms of}\phantom{\rule[-0.0ex]{1.0thickmathspace}{0.0ex}}x\\ {}& {}& {{x}}^{{2}}{-}{6}{}{x}{-}{5}{=}{0}\\ \text{•}& {}& \text{Rewrite}\phantom{\rule[-0.0ex]{1.0thickmathspace}{0.0ex}}{x}^{2}-6{}x-5\phantom{\rule[-0.0ex]{1.0thickmathspace}{0.0ex}}\text{so it contains a perfect square and has the form (}{x}^{2}+2\cdot a\cdot x+{a}^{2}\text{) +}\phantom{\rule[-0.0ex]{1.0thickmathspace}{0.0ex}}C\text{. So we have}\phantom{\rule[-0.0ex]{1.0thickmathspace}{0.0ex}}2{}a\phantom{\rule[-0.0ex]{1.0thickmathspace}{0.0ex}}\text{=}\phantom{\rule[-0.0ex]{1.0thickmathspace}{0.0ex}}-6\\ {}& {}& {a}{=}{-3}\\ \text{•}& {}& \text{Add and subtract}\phantom{\rule[-0.0ex]{1.0thickmathspace}{0.0ex}}{\left(-3\right)}^{2}\\ {}& {}& {{x}}^{{2}}{-}{6}{}{x}{+}{9}{-}{9}{-}{5}{=}{0}\\ \text{•}& {}& \text{The first}\phantom{\rule[-0.0ex]{1.0thickmathspace}{0.0ex}}3\phantom{\rule[-0.0ex]{1.0thickmathspace}{0.0ex}}\text{terms can be regrouped as a perfect square}\\ {}& {}& {\left({x}{-}{3}\right)}^{{2}}{-}{9}{-}{5}{=}{0}\\ \text{•}& {}& \text{Simplify the remaining term}\\ {}& {}& {\left({x}{-}{3}\right)}^{{2}}{-}{14}{=}{0}\end{array}$ (1)
 > $\mathrm{CompleteSquareSteps}\left({\mathrm{sin}\left(t\right)}^{2}+2\mathrm{sin}\left(t\right)+1,\mathrm{sin}\left(t\right)\right)$
 $\begin{array}{lll}{}& {}& {{\mathrm{sin}}{}\left({t}\right)}^{{2}}{+}{2}{\cdot }{\mathrm{sin}}{}\left({t}\right){+}{1}\\ \text{•}& {}& \text{Rewrite}\phantom{\rule[-0.0ex]{1.0thickmathspace}{0.0ex}}{\mathrm{sin}{}\left(t\right)}^{2}+2{}\mathrm{sin}{}\left(t\right)+1\phantom{\rule[-0.0ex]{1.0thickmathspace}{0.0ex}}\text{so it contains a perfect square and has the form (}{\mathrm{sin}{}\left(t\right)}^{2}+2\cdot a\cdot \mathrm{sin}{}\left(t\right)+{a}^{2}\text{) +}\phantom{\rule[-0.0ex]{1.0thickmathspace}{0.0ex}}C\text{. So we have}\phantom{\rule[-0.0ex]{1.0thickmathspace}{0.0ex}}2{}a\phantom{\rule[-0.0ex]{1.0thickmathspace}{0.0ex}}\text{=}\phantom{\rule[-0.0ex]{1.0thickmathspace}{0.0ex}}2\\ {}& {}& {a}{=}{1}\\ \text{•}& {}& \text{Add and subtract}\phantom{\rule[-0.0ex]{1.0thickmathspace}{0.0ex}}{1}^{2}\\ {}& {}& {{\mathrm{sin}}{}\left({t}\right)}^{{2}}{+}{2}{}{\mathrm{sin}}{}\left({t}\right){+}{1}{-}{1}{+}{1}\\ \text{•}& {}& \text{The first}\phantom{\rule[-0.0ex]{1.0thickmathspace}{0.0ex}}3\phantom{\rule[-0.0ex]{1.0thickmathspace}{0.0ex}}\text{terms can be regrouped as a perfect square}\\ {}& {}& {\left({\mathrm{sin}}{}\left({t}\right){+}{1}\right)}^{{2}}{-}{1}{+}{1}\\ \text{•}& {}& \text{Simplify the remaining term}\\ {}& {}& {\left({\mathrm{sin}}{}\left({t}\right){+}{1}\right)}^{{2}}\end{array}$ (2)

Compatibility

 • The Student:-Basics:-CompleteSquareSteps command was introduced in Maple 2023.