How to factor this cubic equation

polynomials

How do I rewrite this formula in plain polynomial form?

$$x(t) = a(1-t)^3 + 3b(1-t)^2t + 3c(1-t)t^2 + dt^3$$

According to what I'm reading, just fully writing out the expansion and then collecting the polynomial factors, as:

$$x(t) = (-a + 3b -3c +d)t^3 + (3a – 6b + 3c)t^2 + (-3a + 3b)t + a$$

I'm okay at factoring some quadratics but this is cubic and I want to understand this one; it's driving me crazy. How did we get from the formula to the polynomial? BTW, I'm doing some bezier curve learning and this is the formula I need, but I want to understand exactly how to factor this beast.

Edit: Following the suggestion by Taladris' comment I'm going to expand $(1-t)^3, (1-t)^2t, (1-t)t^2$ and group similar terms. Here goes:

I'll use the special form: $a^3$ + $b^3$ = (a + b)($a^2$ – ab + $b^2$) for the first part:

$a(1-t)^3$ =   $(a)^3$$(-at)^3$ =  (a – at)($a^2$ + $a^2$t – $at^2$)

Next part:

$3b(1-t)^2$(t)  =   (3b-3bt)(3b-3bt)(t)  =   ($9b^2$ -18$b^2$$t + $9$b^2$$t^2$)(t)

…not sure if the above is correct. Next part:

3c(1 – t)$t^2$ = (3c – 3ct)$(t)^2$

I can't imagine the above is correct, but next I do grouping…

Best Answer

I would ignore the $a, b, c, d$ at first and just look at the parts of the formula involving $t.$

The simplest is on the far right, $t^3$ is just $t^3.$

For $(1 - t)t^2$, because $(1 - t)$ is just a sum of some terms in parentheses you can distribute the multiplication by $t^2$ over the terms inside the parentheses:

$$ (1 - t)t^2 = (1\cdot t^2 - t\cdot t^2) = (t^2 - t^3) = t^2 - t^3. $$

In the case of $(1 - t)^2t$, now $(1 - t)^2$ is not just a sum of some terms in parentheses. It's the sum of some terms in parentheses which is then squared. So we can't just distribute the multiplication by $t$ over the terms inside the parentheses.

Instead, write

$$ (1 - t)^2 = (1 - t)(1 - t) = 1 - 2t + t^2. $$

So

$$ (1 - t)^2 t = (1 - 2t + t^2)t = (1\cdot t - 2t\cdot t + t^2\cdot t) = t - 2t^2 + t^3 . $$

For $(1 - t)^3,$ write

\begin{align} (1 - t)^3 &= (1 - t)(1 - t)(1 - t) \\ &= \bigg((1 - t)(1 - t)\bigg) (1 - t) \\ &= \bigg(1 - 2t + t^2\bigg) (1 - t) \\ &= \bigg(1 (1 - t) - 2t (1 - t) + t^2 (1 - t)\bigg) \\ &= (1 - t) - ( 2t\cdot 1 - 2t\cdot t) + (t^2\cdot 1 - t^2\cdot t) \\ &= (1 - t) - ( 2t - 2t^2) + (t^2 - t^3) \\ &= (1 - t) + ( -2t + 2t^2) + (t^2 - t^3) \\ &= 1 - t + (-2t) + 2t^2 + t^2 - t^3 \\ &= 1 - 3t + 3t^2 - t^3. \end{align}

If you know the Binomial Theorem, it's easier to write

$$ (1 - t)^3 = 1^3 + 3\cdot1^2\cdot(-t) + 3\cdot1\cdot(-t)^2 + (-t)^3 = 1 - 3t + 3t^2 - t^3 $$

for the same result, but the point of showing it the long way was that all the fancy special forms you have seen such as $a^3 + b^3 = (a + b)(a^2 - ab + b^2)$ are just facts that follow from the distributive law applied one multiplication at a time.

When we write $a (1 - t)^3$ it's not just one multiplication, it's $a$ multiplied by $(1 - t)$ three times: $a(1 - t)(1 - t)(1 - t).$ You could distribute the multiplication by $a$ into the parentheses of the first $(1 - t),$ but if we already know that $(1 - t)^3 = 1 - 3t + 3t^2 - t^3$ it's easier to do it this way:

$$ a (1 - t)^3 = a(1 - 3t + 3t^2 - t^3) = (a\cdot 1 - a\cdot 3t + a\cdot 3t^2 - a\cdot t^3) = a - 3a t + 3a t^2 - at^3. $$

I feel obligated to inform you that $a(1-t)^3,$ $(a)^3(-at)^3,$ and $(a - at)(a^2 + a^2t - at^2)$ are three completely different things that have almost nothing to do with each other except that they all expand to polynomials of some kind or another and they all use the symbols $a$ and $t.$

On the other hand, $$ 3c(1 - t)t^2 = (3c - 3ct)(t)^2 $$ is absolutely correct, because $3c(1 - t) = (3c - 3ct),$ although most people would not put parentheses around $t$ by itself; $(t)^2 = t^2.$ If you're trying to follow the advice about expanding and grouping like terms you would take this just a bit farther:

$$ (3c - 3ct)(t)^2 = (3c \cdot t^2 - 3ct \cdot t^2) = 3ct^2 - 3ct^3. $$

So now we've seen how to expand $a (1 - t)^3$ and $3c(1 - t)t^2.$ The expansion involving $b$ is

$$ 3b(1-t)^2 t = 3bt - 6bt^2 + 3bt^3 $$

and the term $dt^3$ just "expands" to itself. So we have

\begin{align} a (1 - t)^3 &+ 3b(1-t)^2 t + 3c(1 - t)t^2 + dt^3 \\ &= (a - 3a t + 3a t^2 - at^3) + (3bt - 6bt^2 + 3bt^3) + (3ct^2 - 3ct^3) + dt^3 \\ &= (-at^3 + 3bt^3 - 3ct^3 + dt^3) + (3at^2 - 6bt^2 + 3ct^2) + (-3at + 3bt) + a \\ &= (-a + 3b - 3c + d)t^3 + (3a - 6b + 3c)t^2 + (-3a + 3b)t + a. \end{align}

What particular great discovery this conversion of one formula to another is supposed to inform you about is unclear to me. If you understand polynomials you should understand that $(1 - t)^3,$ $(1-t)^2 t,$ $(1 - t)t^2,$ $t^3$ are all factorizations of cubic polynomials in $t,$ that multiplying such a polynomial by a constant (such as $a$) produces another cubic polynomial in $t,$ and that the sum of cubic polynomials in $t$ is a cubic polynomial in $t.$ So we should see right away that we have a cubic polynomial in $t$ without having to work out exactly what the coefficient of $t^3$ is and so forth.

In fact, the formula $a (1 - t)^3 + 3b(1-t)^2 t + 3c(1 - t)t^2 + dt^3$ is the one that seems most useful to me for understanding because I recognize it as a polynomial related to the cubic Bézier curve. The polynomials $(1 - t)^3,$ $(1-t)^2 t,$ $(1 - t)t^2,$ and $t^3$ are all related to each other in interesting ways, especially when combined like this. The other formula is relatively meaningless to me except for the fact that it happens to be equal to the first one. (The main reason I can think of to even bother working out the second formula is that it saves a few cycles of computing time if you have to compute values of the polynomial for a hundred different values of $t$ with the same values of $a,b,c,d$ each time.)