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

# 1. Weighted average of two points

## Video transcript

so far our discussion has been largely visual in geometric and that's good because that's how our artists think but it Pixar we also have to create computer programs and computers think best in terms of numbers equations in algebra so somehow we have to bridge these two worlds the worlds of images in 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 we'll 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 mid points to the idea of weighted averages so let's look at our line segment a-b again but instead of wanting to compute the midpoint suppose I want to compute a point M say right about here that weights be twice as heavily as a there isn't anything particularly special about waiting be 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 2b over three and one final form is 1/3 a because 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 1 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 two thirds to this length here MB which is going to be a in 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 to 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 that's something plus T is equal to 1 well something that when added to T is 1 is a fraction 1 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 the T and this 1/3 gets replaced with a 1 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 of the 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 gives 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