Function Repository Resource:

# CompleteSquare

Algebraically rewrite an expression by completing the square

Contributed by: Wolfram|Alpha Math Team
 ResourceFunction["CompleteSquare"][expr,x] returns an expression equivalent to expr, when possible, of the form (a x+b)2+c where a,b and c are FreeQ of x.

## Details

If no expression of the required form can be found, ResourceFunction["CompleteSquare"] returns \$Failed.

## Examples

### Basic Examples (4)

Complete the square of a quadratic:

 In[1]:=
 Out[1]=

Complete the square of a quadratic with a mixture of numeric and symbolic coefficients:

 In[2]:=
 Out[2]=

Complete the square of the generic quadratic:

 In[3]:=
 Out[3]=

Complete the square of a non-quadratic, even-ordered polynomial:

 In[4]:=
 Out[4]=

### Properties and Relations (1)

If no expression of the required form can be found, CompleteSquare returns \$Failed:

 In[5]:=
 Out[5]=

## Publisher

Wolfram|Alpha Math Team

## Version History

• 5.0.0 – 23 March 2023
• 4.1.0 – 11 May 2021
• 4.0.0 – 24 January 2020
• 3.0.0 – 06 September 2019
• 2.0.0 – 12 June 2019
• 1.0.0 – 01 February 2019