Bonus: Equations from de Casteljau's algorithm

Challenge question: can you work out the equations for n-degree curves generated by de Casteljau's algorithm?

Parametric equation for a line

In the first step of de Casteljau's algorithm we define a point along a line in terms of tt. For example, if we have a line between two points, A\blue{A} and B\blue{B}, then we can define a point, P(t)P(t) on that line.
The equation for the point is:
P(t)=(1t)A+tBP(t) = (1- t)\blue{A} + t\blue{B}
A line between points A and B
As tt goes from 00 to 11, P(t)P(t) traces out the line from A\blue{A} and B\blue{B}. The equation is linear, so the line can be considered a degree 11 curve.

Degree 22 curves

When we create a degree 22 curve (a parabola), we use three points, A\blue{A}, B\blue{B}, and C\blue{C}
A parabolic arc defined by points A, B and C
Now we get this equation for a point on the curve:
P(t)=(1t)2A+2(1t)tB+t2CP(t) = (1- t)^2\blue{A} + 2(1- t)t\blue{B} + t^2\blue{C}

Degree 33 curves

If we create a degree 33 curve using four points, A\blue{A}, B\blue{B}, C\blue{C}, and D\blue{D}, is the equation for a point on the curve in terms of A\blue{A}, B\blue{B}, C\blue{C}, and D\blue{D}?
P(t)=P(t) =

Degree 44 curves

What about if we create a degree 44 curve using five points, A\blue{A}, B\blue{B}, C\blue{C}, D\blue{D}, and E\blue{E}?
P(t)=P(t) =

Degree nn curves

Now let's see if we can spot any patterns in these equations that will allow us to find a general equation that uses n+1n + 1 points, A0,A1,...,An1,An\blue{A_0}, \blue{A_1}, ..., \blue{A_{n-1}}, \blue{A_n}, to define an nn degree curve.
Look at the first term in each of the above equations and see if you can spot a pattern.
What would be the coefficient for A0\blue{A_0} in an nn degree curve?

Look at the last term in each of the above equations and see if you can spot a pattern.
What would be the coefficient for An\blue{A_n} in an nn degree curve?

Now, the hardest part: look at the remaining terms in each of the above equations. Notice that each term includes:
  1. a constant
  2. (1t)(1 - t) raised to a power
  3. tt raised to a power
For example, for a degree 22 curve, the A1\blue{A_1} term is 2(1t)t2(1 - t)t, so the constant term is 22, the exponent on (1t)(1 - t) is 11, and the exponent on tt is 11.
In the coefficient for the Ai\blue{A_i} term in an equation for an nn degree curve:
What is the exponent on (1t)(1 - t)?

What is the exponent on tt?

Extra Super Bonus Challenge

Can you find a formula for the constant term for Ai\blue{A_i}? Once you have done that, can you combine all these parts into an equation for P(t)P(t) for an nn degree curve?
For the constant term, have a look at the last video in the Crowds topic which covers binomial coefficients.
The constant term is a binomial coefficient (ni)\binom{n}{i}, which can be calculated with:
n!i!(ni)!\dfrac{n!}{i!(n - i)!}
So the complete equation for the coefficient of Ai\blue{A_i} is:
n!i!(ni)!(1t)niti\dfrac{n!}{i!(n - i)!}(1-t)^{n-i}t^i
Note that this formula works for all the terms, including A0\blue{A_0} and An\blue{A_n}.
So the equation for P(t)P(t) for any nn degree curve is:
P(t)=i=0nn!i!(ni)!(1t)nitiAiP(t) = \sum \limits_{i = 0}^n \dfrac{n!}{i!(n - i)!}(1-t)^{n-i}t^i\blue{A_i}
Loading