Last time out, I looked at a problem unearthed by @mathsjem - to find the cube root of a degree-six polynomial. This led (unsurprisingly) to a quadratic: $3 + 4x - 2x^2$.

When checking whether this was indeed the answer, I hit a problem: is there a simple way to cube a polynomial?

I *could* use the binomial expansion, treating the expression as $3 + \br{4x-2x^2}$ and getting $27 + 27\br{4x-2x^2} + 9\br{4x-2x^2}^2 + \br{4x-2x^2}^3$, but that still requires a lot more work before it drops out in canonical form (there's another bracket to square, another to cube, and multiplying out to do after that).

It can be done, but it's not nice.

Suppose, to get somewhat more general for a bit, we need to evaluate (or involute, if we're Victorians) $\br{a_0 + a_1 x + a_2 x^2}^3$.

If we multiplied this out boneheadedly and made sure to get all 27 possible terms - each element from the first bracket multiplied by each element from the second and each element frmo the third - each term would consist of the product of three $a$s, and some power of $x$.

The key insight: for each of these terms, the power of $x$ is the same as the sum of the subscripts of the $a$s - for instance, the term that comes from picking $a_2$ from the first bracket, $a_0$ from the second and $a_2$ from the third must be followed by an $x^4$.

This gives us a quick way to characterise the elements of the final polynomial, according to the subscripts of the terms!

The only way we can get a constant term is from $a_0 a_0 a_0$.

We can get an $x$ term only from permutations of $a_0 a_0 a_1$, of which there are three.

$x^2$ can come from permutations of $a_0 a_0 a_2$ and of $a_0 a_1 a_1$, three of each.

$x^3$ is trickier, but $a_1 a_1 a_1$ does the job, as do all six permutations of $a_0 a_1 a_2$.

Then it's all symmetrical: $a_2 a_2 a_0$ and $a_2 a_1 a_1$ (three permutations of each) provide the coefficients for $x^4$.

$a_2 a_2 a_1$ and rearrangements thereof (3) are the only way to make $x^5$.

And finally, $a_2 a_2 a_2$ gives the $x^6$ coefficient.

Which means, taking a deep breath:

$\br{a_0 + a_1 x + a_2 x^2}^3 = \left\{ \begin{array}{c} a_0^3 + \\ 3 a_0^2 a_1 x + \\ 3(a_0 a_1^2 + a_0^2 a_2)x^2 + \\ (a_1^3 + 6a_0 a_1 a_2)x^3 + \\ 3(a_2 a_1^2 + a_2^2 a_0)x^4 + \\ 3 a_2^2 a_1 x^5 + \\ a_2^3 x^6 \end{array} \right. $

(That's much easier to generate than to remember.)

... because my GeoGebra skills are not up to making this clear!

Imagine you have a cube in the first octant with opposite vertices at $O(0,0,0)$ and $A(2,2,2)$.

Consider the plane $x+y+z=k$ for various values of $k$, and think about where it meets the cube.

For $k=0$ and $k=6$, the plane just touches the cube at the vertices I mentioned before.

For $k=1$ and $k=5$, the plane intersects the cube in an equilateral triangle; the only integer points of intersection are the edges nearest $O$ and $A$.

For $k=2$ and $k=4$, it's a bit more involved: it's still an equilateral triangle, but as well as the three vertices immediately adjacent to $O$ or $A$, the centres of the three faces touching that corner are integer points on the cube and the plane.

For $k=3$, I could just throw up my hands and say "it's everywhere else!" but that would lose some of the magic. This plane bisects the six remaining edges (those which *don't* touch either $O$ or $A$), giving the six permutations of $(0,1,2)$, and passes through the centre of the cube at $(1,1,1)$.

This accounts for all 27 integer points or or in the cube, and corresponds exactly to the terms in the expansion.

In this case, we know that $\br{3 + 4x - 2x^2} = \left\{ \begin{array}{c} 27 + \\ 3(3^2)(4)x + \\ 3( 3(4^2)+ 3^2(-2))x^2 + \\ (4^3 + 6(3)(4)(-2))x^3 + \\ 3 ( (-2)(4)^2 + (-2)^2(3))x^4 + \\ 3 (-2)^2(4))x^5 + \\ (-2)^3 x^6 \end{array} \right. $.

Working it through gives $27 + 108x + 90x^2 - 80x^3 - 60x^4 + 48x^5 - 8x^6$, as we had to begin with.

This process can be extended (with enough patience) to the involution of any polynomial to any power. That, though, is left as an exercise.