# Are there any other good methods for performing cubic completion?

**URL:** <https://community.wolfram.com/t/are-there-any-other-good-methods-for-performing-cubic-completion/26314>\
**Category:** Questions\
**Tags:** algebra\
**Created:** [January 8, 2026, 11:43pm UTC](https://community.wolfram.com/t/are-there-any-other-good-methods-for-performing-cubic-completion/26314 "2026-01-08T23:43:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmamathes](https://avatars.discourse-cdn.com/v4/letter/m/5fc32e/32.png) [@mmamathes](https://community.wolfram.com/u/mmamathes)\
**Post date:** [January 8, 2026, 11:43pm UTC](https://community.wolfram.com/t/are-there-any-other-good-methods-for-performing-cubic-completion/26314/1 "2026-01-08T23:43:41Z")

</div>

```
2 x^3 - 3 a x^2 + 1 ==     
1 - a^3/2 - 3/2 a^2 (-(a/2) + x) + 2 (-(a/2) + x)^3

```

Write a Mathematica function that performs cubic completion. For a cubic polynomial in x, such as the equation above, the function should be able to complete the cube to achieve the form shown on the right-hand side.

Here is one way to solve it—are there any better approaches?

```
AutoCompleteCube[poly_, x_] := 
 Module[{a3, a2, x0, refinedPoly}, a3 = Coefficient[poly, x, 3];
  a2 = Coefficient[poly, x, 2];
  x0 = -a2/(3*a3);
  refinedPoly = 
   Total@Table[(Derivative[i][Function[x, poly]][x0]/i!)*(x - x0)^
       i, {i, 0, 3}];
  refinedPoly]
AutoCompleteCube[2 x^3 - 3 a x^2 + 1, x]

```

---

<div class="post-metadata">

**Author:** ![mroge02](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/mroge02/32/28775_2.png) [@mroge02](https://community.wolfram.com/u/mroge02)\
**Post date:** [January 9, 2026, 2:41am UTC](https://community.wolfram.com/t/are-there-any-other-good-methods-for-performing-cubic-completion/26314/2 "2026-01-09T02:41:31Z")

</div>

```
form = AA (x - x0)^3 + BB (x - x0) + CC;
form /. First@Solve[
   CoefficientList[2 x^3 - 3 a x^2 + 1, x] == CoefficientList[form, x]
   , {AA, BB, CC, x0}
   ]

(* 1/2 (2 - a^3) - 3/2 a^2 (-(a/2) + x) + 2 (-(a/2) + x)^3 *)

```

---

<div class="post-metadata">

**Author:** ![mroge02](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/mroge02/32/28775_2.png) [@mroge02](https://community.wolfram.com/u/mroge02)\
**Post date:** [January 9, 2026, 4:59pm UTC](https://community.wolfram.com/t/are-there-any-other-good-methods-for-performing-cubic-completion/26314/3 "2026-01-09T16:59:12Z")

</div>

Another way:

```
With[{x0 = First@SolveValues[D[2 x^3 - 3 a x^2 + 1, {x, 2}] == 0, x]},
 Expand[2 x^3 - 3 a x^2 + 1 /. x -> (u + x0)] /. u -> (x - x0)
 ]
(* 1 - a^3/2 - 3/2 a^2 (-(a/2) + x) + 2 (-(a/2) + x)^3 *)

```

Or:

```
With[{x0 = First@SolveValues[D[2 x^3 - 3 a x^2 + 1, {x, 2}] == 0, x]},
 Normal@Series[2 x^3 - 3 a x^2 + 1, {x, x0, 3}]
 ]

```

---

<div class="post-metadata">

**Author:** ![mmamathes](https://avatars.discourse-cdn.com/v4/letter/m/5fc32e/32.png) [@mmamathes](https://community.wolfram.com/u/mmamathes)\
**Post date:** [January 11, 2026, 1:17pm UTC](https://community.wolfram.com/t/are-there-any-other-good-methods-for-performing-cubic-completion/26314/4 "2026-01-11T13:17:27Z")

</div>

This is really nice—there are several ways to tackle the problem. Thank you very much!
