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

Weighted average of two points

How can we calculate a weighted average between two points? (pssst. This video is super important).

Want to join the conversation?

  • male robot hal style avatar for user David G.
    What exactly is "t"? And if it is possible to find the arbitrary constant "t"; how do I find "t"?
    (7 votes)
    Default Khan Academy avatar avatar for user
    • leafers sapling style avatar for user Peter Collingridge
      You can think of t as the percentage of the way a point is from A to B. So:
      When t = 0 the point is 0% of the way to B, so is equal to A.
      When t = 1 the point is 100% of the way to B, so is equal to B.
      When t = 0.5 the point is 50% of the way to B, so at the midpoint from A to B.
      When t = 0.25 the point is 25% of the way to B, and so on.

      t can be any number from 0 to 1. If you know the position of A and B and P, then you can calculate t.

      If P = A(1- t) + tB, then you can just look at the x-coordinate of each point with the equation:
      Px = Ax(1 - t) + tBx
      Px = Ax - tAx + tBx
      Px = Ax + t(Bx - Ax)
      Px - Ax = t(Bx - Ax)
      t = (Px - Ax) / (Bx - Ax)
      That will work so long as Bx is not equal to Ax. If it is, then use the y-coordinates instead.
      (30 votes)
  • male robot hal style avatar for user ckapoor
    what do you mean by 'B is weighted twice as heavily as A'?
    (4 votes)
    Default Khan Academy avatar avatar for user
    • leaf blue style avatar for user Dean Smith
      The word Weight is a measure of force pushing or pulling on an object due to gravity. This means that during the calculation, when we consider B to measure two times the value of A, we are saying that B has two times the gravitational pull of A. This is the same as saying B weighs twice the value of A. From we hear Tony explain that the force of weight from B is pulling M two thirds (2/3) of the segment length, and is twice the force of weight at A, which only pulls back one third (1/3). The base of 3 is used for taking the average because we have 1A + 2B, or A + B + B.
      (7 votes)
  • female robot ada style avatar for user trexdino37
    i am still confused about T
    (1 vote)
    Default Khan Academy avatar avatar for user
    • leafers ultimate style avatar for user Bryan Ray
      In his initial example, before he introduced the t, he had this formula:
      M = 1/3 * A + 2/3 * B
      Since we know that M is describing a point that splits the line segment AB into two pieces, it follows that the coefficients of 1/3 and 2/3 must add up to 1 in order to preserve the total length of the line segment AB (AM + MB = AB), so:
      1/3 + 2/3 = 1
      This relationship must always be maintained in order to not change the length of the original line segment. Now, we can rearrange that equation by subtracting 2/3 from both sides to get:
      1/3 = 1 - 2/3
      Then substitute that into the formula I started with:
      M = (1 - 2/3) * A + 2/3 * B
      That process works the same for any fraction (any number from 0 - 1) you want to put in there. Whenever you have an equation that works for any number, you can substitute a variable for that number. So decide that 2/3 = t:
      1/3 + t = 1
      1/3 = 1 - t
      Substitute those in for the original formula:
      M = (1 - t) * A + t * B
      Now you have a formula you can use to put a point anywhere along the line by deciding how close you want it to be to B. Do you want the segment from M to B to be 10% of the total length of the line (10% is 1/10, or 0.1)? Then t = 0.1 and 1 - t = 0.9

      Again, though, t has to be between 0 and 1 (a proper fraction) or M will leave your line segment.
      (10 votes)
  • aqualine ultimate style avatar for user sjohnson0053
    I need some BIG help by now. I am in 4th grade and I recently found out that linear interpolation and blah blah blah is 8th grade math. So, if you can help me, please reply-post an linear interpolation problem and then simplify it so your a fraction of 1 percent more than average 4th grader can understand. PLEASE!! IT WOULD HELP ME A LOT!!
    ( confused emote )
    (5 votes)
    Default Khan Academy avatar avatar for user
  • duskpin ultimate style avatar for user Shiloh Trowbridge
    are there any other videos to help me understand the conceps of the algebra in this video?
    (4 votes)
    Default Khan Academy avatar avatar for user
    • orange juice squid orange style avatar for user Albus Dumbledore
      Yes, KA's math section has practically every concept a math student could ever want to learn. A basic understanding of algebra is needed to fully understand these videos, so you might want to try the Algebra 1 section or Pre-Algebra section to find out what you need to know.
      (3 votes)
  • marcimus pink style avatar for user Caitlyn Butcher
    how do the workers come up with the ideas to make the objects and characters? Also how do you create the items that you want to use in these disney shows
    (3 votes)
    Default Khan Academy avatar avatar for user
    • leafers ultimate style avatar for user Bryan Ray
      It's outside the scope of this lesson, but I'll answer anyway.
      When someone has an idea to make an animated film, the first thing they start with is story. Maybe one person writes the entire story and presents it, or maybe lots of people talk about it and throw ideas around. However it happens, eventually they have an outline of the kind of story they want to tell, and they have some idea of the kinds of characters and environments they'll need to tell it.

      These writers, producers, and creative directors (the development team) describe the characters and setting to concept artists. The concept artists start by making lots of rough sketches of the characters, showing them in batches to the development team and getting feedback on what works and what doesn't. Then the concept artists return to making drawings. This time they're more detailed, and they incorporate the feedback they got. The new drawings are shown, and this process continues until each character and the setting satisfy everyone involved. The concept artists may also make sculptures of characters, called maquettes, so that everyone can be sure that the character works as well in three dimensions as it does in two.

      From there, the process is pretty much as described in the Pipeline Video at the beginning of the course: https://www.khanacademy.org/partner-content/pixar/start/introduction/v/pipeline-video
      I haven't watched them yet, but I would imagine there is a lot more detail on the actual process of modeling characters in the Character Modeling lessons: https://www.khanacademy.org/partner-content/pixar/modeling-character
      (4 votes)
  • male robot hal style avatar for user akhil1604
    Do we have needed to go through high school geometry for this?
    (3 votes)
    Default Khan Academy avatar avatar for user
  • starky ultimate style avatar for user 51 crown wins
    I dont understand anything!
    (2 votes)
    Default Khan Academy avatar avatar for user
  • leafers ultimate style avatar for user Islander
    Are A, B, and M supposed to be points or line segments?
    (1 vote)
    Default Khan Academy avatar avatar for user
  • aqualine seed style avatar for user Joey O
    i'm not sure why B is weighted twice as A. Wouldn't it be the other way around?
    (1 vote)
    Default Khan Academy avatar avatar for user

Video transcript

- So far our discussion has been largely visual and geometric and that's good because that's how our artists think. But at Pixar we also have to create computer programs and computers think best in terms of numbers, equations, and algebra. So somehow we have to bridge these two worlds. The worlds of images and geometry and the world of algebra, numbers, and equations. In fact, this bridge between these two worlds was one of the things that really drew me into computer graphics in the first place. I find it really fascinating, how the algebra and the geometry conspire to create beautiful art. So what we're going to do is develop a formula that will allow us to compute points exactly on the parabola. And that formula will allow us to write computer programs like this one, that will be able to draw the parabola without ever having to draw any of the string art lines. Our first step in the search of that formula is to generalize the idea of averaging or midpoints to the idea of weighted averages. So, let's look at our line segment AB again but instead of wanting to compute the midpoint suppose I want to compute a point M, say right about here, that weights B twice as heavily as A. There isn't anything particularly special about weighting B twice as heavily as A it's just a simple non-midpoint example. So, the algebra would say that M is one copy of A plus two copies of B and then I have to divide by three for this to be a proper average. And I can write that a little bit simpler as A plus two B over three. And one final form is 1/3 A, 'cause there's an implicit one here in front of the A and there's a 2/3 in front of the B, so 2/3 B. And notice that this 1/3 plus this 2/3 add to one. And that's another way of saying that this is a proper average. So that's the algebra, let's take a look at the geometry. Well, the geometry says that this length here, AM is going to be in proportion 2/3 to this length here, MB which is going to be in proportion 1/3. Now, notice that the algebra says that the 2/3 sticks to the B, but the geometry says that the 2/3 is opposite the B. And that looks a little bit strange at first but if you think about it, it kind of makes sense because if there was a big weight in front of B you'd expect this point to be very close to B. Okay, well we can generalize this even further and let me replace a 2/3 here with an arbitrary fraction, call it t. So the t is going to stick to the B in the algebra and now for this to be a proper average I need to put something in front of A so that something plus t is equal to one. Well, something that when added to t is one is a fraction one minus t. So my expression now is 1 minus t times A plus t times B. That's the algebra of this generalized situation. The geometry is that this 2/3 gets replaced with a t and this 1/3 gets replaced with a one minus t. So let's get some feeling for this idea by using this interactive. So here I've got a line segment that I can drag around and you can see the coordinates of A and the coordinates of B and right now it's initialized so that the point I'm computing is at the midpoint. So I would have halves in front of each A and B. But now I can slide this point around anywhere I like along this line and that corresponds to just changing the value of t. So different values of t give me different positions along the line. In the next couple of exercises you'll have an opportunity to get some experience with the idea of weighted averages. (arrow flies and hits target)