If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

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 t. For example, if we have a line between two points, start color #6495ed, A, end color #6495ed and start color #6495ed, B, end color #6495ed, then we can define a point, P, left parenthesis, t, right parenthesis on that line.
The equation for the point is:
P, left parenthesis, t, right parenthesis, equals, left parenthesis, 1, minus, t, right parenthesis, start color #6495ed, A, end color #6495ed, plus, t, start color #6495ed, B, end color #6495ed
A line between points A and B
As t goes from 0 to 1, P, left parenthesis, t, right parenthesis traces out the line from start color #6495ed, A, end color #6495ed and start color #6495ed, B, end color #6495ed. The equation is linear, so the line can be considered a degree 1 curve.

Degree 2 curves

When we create a degree 2 curve (a parabola), we use three points, start color #6495ed, A, end color #6495ed, start color #6495ed, B, end color #6495ed, and start color #6495ed, C, end color #6495ed
A parabolic arc defined by points A, B and C
Now we get this equation for a point on the curve:
P, left parenthesis, t, right parenthesis, equals, left parenthesis, 1, minus, t, right parenthesis, squared, start color #6495ed, A, end color #6495ed, plus, 2, left parenthesis, 1, minus, t, right parenthesis, t, start color #6495ed, B, end color #6495ed, plus, t, squared, start color #6495ed, C, end color #6495ed

Degree 3 curves

If we create a degree 3 curve using four points, start color #6495ed, A, end color #6495ed, start color #6495ed, B, end color #6495ed, start color #6495ed, C, end color #6495ed, and start color #6495ed, D, end color #6495ed, is the equation for a point on the curve in terms of start color #6495ed, A, end color #6495ed, start color #6495ed, B, end color #6495ed, start color #6495ed, C, end color #6495ed, and start color #6495ed, D, end color #6495ed?
P, left parenthesis, t, right parenthesis, equals

Degree 4 curves

What about if we create a degree 4 curve using five points, start color #6495ed, A, end color #6495ed, start color #6495ed, B, end color #6495ed, start color #6495ed, C, end color #6495ed, start color #6495ed, D, end color #6495ed, and start color #6495ed, E, end color #6495ed?
P, left parenthesis, t, right parenthesis, equals

Degree n 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, plus, 1 points, start color #6495ed, A, start subscript, 0, end subscript, end color #6495ed, comma, start color #6495ed, A, start subscript, 1, end subscript, end color #6495ed, comma, point, point, point, comma, start color #6495ed, A, start subscript, n, minus, 1, end subscript, end color #6495ed, comma, start color #6495ed, A, start subscript, n, end subscript, end color #6495ed, to define an n 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 start color #6495ed, A, start subscript, 0, end subscript, end color #6495ed in an n 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 start color #6495ed, A, start subscript, n, end subscript, end color #6495ed in an n 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. left parenthesis, 1, minus, t, right parenthesis raised to a power
  3. t raised to a power
For example, for a degree 2 curve, the start color #6495ed, A, start subscript, 1, end subscript, end color #6495ed term is 2, left parenthesis, 1, minus, t, right parenthesis, t, so the constant term is 2, the exponent on left parenthesis, 1, minus, t, right parenthesis is 1, and the exponent on t is 1.
In the coefficient for the start color #6495ed, A, start subscript, i, end subscript, end color #6495ed term in an equation for an n degree curve:
What is the exponent on left parenthesis, 1, minus, t, right parenthesis?

What is the exponent on t?

Extra Super Bonus Challenge

Can you find a formula for the constant term for start color #6495ed, A, start subscript, i, end subscript, end color #6495ed? Once you have done that, can you combine all these parts into an equation for P, left parenthesis, t, right parenthesis for an n degree curve?

Want to join the conversation?

  • leaf green style avatar for user guillaume abbe
    thanks for those really interesting courses.
    Maybe I missed something but how can we get the value from a spline curve given a t value from the timeline (not the t parametric value going from 0 to 1).
    In the first video, it's easy with th y=mx+b equation but I can't get it with the Casteljau's equation.
    Maybe I missed something ?
    Thanks in advance
    (28 votes)
    Default Khan Academy avatar avatar for user
    • leafers sapling style avatar for user Peter Collingridge
      If I understand the question correctly, you want to know, for example, if you have a Bezier spline that goes from frame 1 to frame 10, how do you find the value at, say, frame 5. It's tempted to say that you put in the value of t = 0.5, but that doesn't quite work since the x-coordinate along the curve does not change linearly with t.

      I don't know if you can do it directly via deCasteljau's equation. I believe it's done by finding the equation as a cubic, and solving for the cubic, which is quite difficult and involves some fairly intense algebra.
      (6 votes)
  • duskpin ultimate style avatar for user Dana
    (1-t)^4 A + 4(1-t)^3 t B + 4(1-t)^2 t^2 C + 4(1-t) t^3 D + t^4 E
    I typed this into the 4th-degree question and it says it is wrong. Is it because of spacing maybe? From the rest of the notes, it seems it would be the correct answer.
    (7 votes)
    Default Khan Academy avatar avatar for user
    • hopper cool style avatar for user ChrisRennick56
      You were so close!! if you look at my answer to Favour Umoru you will see the pascal's triangle at the end. In your case you have got the coeficient of the middle term wrong it should be a 6 and not a 4. This ought to be what you are looking for
      (1-t)^4 A + 4(1-t)^3 t B + 6(1-t)^2 t^2 C + 4(1-t) t^3 D + t^4 E
      (11 votes)
  • mr pink red style avatar for user robert cook
    Lessons have a Pixar part and a math part.
    It would be nice to have a programming part as well; for example, drawing n-degree curves.
    (9 votes)
    Default Khan Academy avatar avatar for user
  • starky tree style avatar for user IEC.Learning.Co
    was i supposed to do this because i am only in 4 grade
    (7 votes)
    Default Khan Academy avatar avatar for user
  • starky sapling style avatar for user Лиам МакКарти (liam m)
    this is cabrasing my brain
    (7 votes)
    Default Khan Academy avatar avatar for user
  • duskpin ultimate style avatar for user Henry
    my student seems a bit to young for this so is there any recomended age?
    (6 votes)
    Default Khan Academy avatar avatar for user
  • male robot donald style avatar for user 7467522
    i didn't quite understand these curves
    (3 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Cailin Temple
    I'm unclear on the terms A(sub)0 or A(sub)1 or A(sub)i etc. Are these sequential terms in the equation or do they refer to specific locations in the equation? I have everything correct until what is the exponent for (1-t)? part.
    (4 votes)
    Default Khan Academy avatar avatar for user
    • leafers sapling style avatar for user Peter Collingridge
      A0, A1 etc. refer to points to the control points in order. For a degree 2 curve, we used points A, B, C. But for a degree n curve, we use A0, A1, ... An. We use this instead of A, B, C to make it easier to refer to a point.

      So, they do refer to sequential terms in the equation (but the order doesn't really matter - you could write P = (1 - t)A + tB or P = tB + (1 - t)A). With the new naming scheming for the points, the equation for the degree 2 curve is P = (1 - t)A0 + tA1.
      (5 votes)
  • hopper cool style avatar for user wublablu
    i dont know how to do this?
    (5 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user 63801
    I thought this was code not math
    (3 votes)
    Default Khan Academy avatar avatar for user