Transcript for:
Key Concepts in Geometry Formulas

hello welcome back to algebra the title of this lesson is the distance formula the midpoint formula and the Pythagorean theorem this is part one we have several parts to these lessons so as you can see from the title we're going to cover a lot of material in one lesson now most of you probably everyone watching this lesson has had some exposure to the Pythagorean theorem before you've also probably had some exposure to the distance formula before and some may or may not have had some exposure to the midpoint formula what we're gonna do is first we're gonna review and talk about what that Pythagorean theorem is why it's important and then we're going to show you that the distance formula that we use in algebra that we're going to learn in this lesson it's basically a direct extension it comes from the Pythagorean theorem so it's almost like they're the same exact thing and I'm gonna show you that a lot of the time students don't understand that the distance formula is just nothing more than what they already understand in the Pythagorean theorem we'll also talk about this midpoint formula so we're getting kind of into coordinate algebra coordinate geometry there's a little bit of overlap between what we've learning now and what we've learned in geometry in the past but we're gonna go a level deeper because we're into the more kind of advanced algebra here we're gonna go a little bit deeper I'm going to also take the opportunity to show you why this stuff is so important to modern science and math I want you to understand that the things that you're learning are not just useless things they're extremely important even to modern science modern physics modern chemistry modern engineering and so I'm gonna get into it as we get into the lesson a little bit more but just as a kind of an advanced preview right this concept of the distance formula that we're going to learn here it really only is we're gonna learn it in this lesson it applies to when we draw pictures on a flat sheet of paper or we draw pictures on a flat board like this we can calculate the distance between any two points that's what the distance formula does right if you've studied it in the past you know that that's what it does in other words I can put two points on the board I can figure out how many centimeters are between those two points if I set up a coordinate grid and go from there now in 1915 someone you've probably heard of Albert Einstein proved what we call now the general theory of relativity it's Einstein's theory of gravity right so you might think why are we talking about gravity in an algebra lesson it's because when you really dig into the details of relativity theory which is one of the crowning achievements of mod physics right the the understanding of gravity not being a force between things but gravity being the curvature of space and time you probably heard that curvature of space and time curvature of what we call space line when you drill down into that theory into the nitty-gritty details in advanced physics what you're gonna find out is the way that you measure distances in in space-time is very similar to this distance formula that you're gonna be reviewing in this lesson right now so we're gonna be covering how to calculate distances between things but just keep in the back your mind something that you think is simple like this is something that Einstein worked on for many many years to prove that when space and time are curved which you can measure by using this distance formula that gives rise to what we actually call gravity here and I know that that's beyond the scope of an algebra class but that's something I want to point out because it shows you that the things that you're learning now have real uses for real science and you know advanced physics and chemistry and engineering so let's dive into it we're gonna recall something but before we get into the distance formula we're gonna talk about and review something we call the Pythagorean theorem Pythagorean theorem and I'm going to spend obviously time talking about the Pythagorean theorem and the distance formula all that and then I'm gonna show you a little bit more about this curving of space and time just because I want you to understand generally how this stuff is used in more advanced concepts so it all has to do with triangles this Pythagorean theorem has to do with triangles right so when you learn it you taught you learn about the concept of what we call a right triangle a right triangle is a triangle aimée triangle that has one special property and that is that one of the angles is 90 degrees so that means that this is a 90 degree angle 90 degree angle means it goes straight perpendicular like this so 90 degrees is exactly like a like a straight though there's no opening up of an angle it's straight down on top of perpendicular to the lines under it so that's a 90 degree angle right here now when you have a child like this you have a side number one side number two side number three we generally call them side a side B and side C and side C here has to generally be the longest side so we kind of label the longest side being C a and B it doesn't really matter what we call it but we always want to use the variable C to represent the longest side of the triangle we also call this the hypotenuse of the triangle I know that you've probably learned that when you when you studied geometry you know years ago all right so the Pythagorean theorem basically says that if you have a right triangle it has to be a right triangle with a 90-degree angle and if the longest side is labeled C then it says that the square of that side is equal to the square of the other side plus the square of the third side so C squared is equal to a squared plus B squared one of the most famous formulas I know you've probably seen it if you haven't seen it that's okay too we're gonna go from the very basics here but you might look at this and say what does this mean right what it means is that if I take a right triangle as long as I have a 90-degree angle here if I measure this to be 23 centimeters and I measure this to be some other number of centimeters and this to be some other number of centimeters if I square the length of this side and I square the length of this side and I add them together it should always be equal to the longest side squared now you might look at that and say how is that true how do you know that's true well it's kind of like how do i how do I now I have five fingers on my hand well I count them one two three four five five you don't really prove how do I know I have five fingers you look at it and you say I have five fingers how do I know I have ten toes you know on both feet while I count them I have ten total right it's an observation how do we know this is true it's because if I take a ruler and measure this line and measure this line and measure this line and plug it into this equation it actually always equals no matter if the triangle is really big or really really small as long as there's a 90-degree angle in there the longest side squared is going to be equal to the other two sides squared added together that's the called the Pythagorean theorem it holds for all triangles but here's the big catch right and we're gonna do a couple of examples here just to show you but this Pythagorean theorem is only true when you draw the triangle on a flat space we call it a flat space which means this board is flat right so we draw the triangle on a flat space like this then and of course all works in that theorem if in contrast and I know this is not a great globe but it's a little sphere if instead I draw those those points of the triangle on a curved surface so Einstein talked about curved space in time so this is a representative representation of curved space curved space-time right if I draw one point of the triangle another point of the triangle and other points of the triangle and I verify it as a right triangle same as this it's just I'm drawing on a curved space if I take one side squared the other side squared and then add them together and then compare it to the longest side squared then it will not be equal like this because this Pythagorean theorem only holds in a flat space it doesn't hold when the thing is curved when you draw the triangle on a curved thing so you say why is he telling you this why don't I care about that I'm just pointing out but that's a use a very very famous use of a very important result because when you have space and time that are curved which was what we call gravity we call that that's what we call the thing that hold us to the ground that curvature of space and time can be measured by how much it doesn't really work in this equation other words this equation works for a flat triangle but if it's very slightly curved space then it'll be almost equal if it's really really curved like a black hole then this inequality will be really what really really far off the C squared will be totally different than a squared plus B so the more curvature you have the farther away from the Pythagorean theorem the farther away it doesn't hold anymore right the flatter this space like this chalkboard or this marker board here it holds exactly right so keep that in the back of your mind as a use a very famous important use in more advanced math and science down the road but for now let's get back down to reality let's take a look at our triangles and of course this isn't a flat space right so let's say I have a triangle with 3 centimeters this Direction 4 centimeters in this direction and 5 centimeters this direction is this a right triangle well let's check it out we're gonna say that a is equal to 3 and B is equal to 4 and C which is the longest side remember is going to be equal to 5 and we're gonna check that out we're gonna say well is C squared equal to a squared plus B squared ok well we put C in here we say well 5 Squared's on that side three squared goes here and then four squared goes here and we're asking ourselves is it actually equal like this well five squared is 25 equals question mark three times three is nine and then four times four is sixteen so then I have what I have is 25 equals this when you add it up is equal to 25 so because you can look at this triangle and say three a distance of three a distance of four a distance of five works exactly equally in the Pythagorean theorem then you can say with certainty that this has an actual 90-degree angle here yes this is a right triangle it's a right triangle all right now let's take another triangle will kind of make room over here let's take another triangle and see how it compares let's take another triangle let's say we have a triangle it's really long and slender like this let's say this has a distance of one centimeter a distance of nine centimeters and a distance of 11 centimeters and we want to ask ourselves is this also a right triangle well in this case a would be one B would be nine we don't care labeling a and B these sides but we care that the longest side C is always labeled with the longest side which so C is equal to 11 so again we'll say C squared is a squared plus B squared you know we'll ask the question anyway C squared is going to be 11 squared we'll ask ourselves is that equal to 1 squared plus 9 squared well 11 times 11 is 121 when you stick that in your calculator and 1 times 1 is 1 and 9 times 9 is 81 so you can see the right-hand side is going to be 82 and the left hand side is 121 so that's not equal so because you put these links into the Pythagorean theorem and it didn't work out they're not equal then what you have learned from this is this is not a 90-degree angle I've drawn it close to a 90-degree angle because I'm sketching it but if you actually measured 1 and 9 and connected it with 11 then you would find out that this angle is very far away from 90 degrees now bringing it back to 2 modern thinking on science ok we looked at this first triangle we said this one fits with the Pythagorean theorem why because 3 squared plus 4 squared is equal to 25 which is the longest side squared what I was telling you before is that this relation of the Pythagorean theorem it only holds when you draw things in flat space-time flat space right if I were to take that globe that I just showed you and Mark that triangle off exactly three units exactly up straight up four units exactly over five unit and try to connect it you're gonna find it it's not gonna work you're not going to be able to draw the triangle on a curved space and have it closed up on itself like that because when you when you it would be like taking this drawing and trying to bend it into a sphere you're gonna distort all of the distances and angles there so the Pythagorean theorem for a 3 4 5 triangle like that's not going to work when you curve it so when we talk about gravity around a black hole or gravity around a planet the space and the time are curved in such a way that this Pythagorean theorem and later on what we're gonna talk about to be the distance formula doesn't quite hold in the same way that it does here that's how we measure the curvature of space is what I'm trying to say alright enough talking about physics let's get back into the pure math so this is what we call the Pythagorean theorem now we're gonna draw a direct extension to what I know you've probably heard of before but we're gonna go a little bit deeper it's called the distance formula now most people learn the distance formula and they just use it because it's not too hard to use we don't really know where it comes from it turns out that the distance formula is exactly the same thing as the Pythagorean theorem there is no difference and when I say there's no difference I mean literally there is no difference at all if you already understand that this is true then you already know that the distance formula has to be true and so I want to show you that rather than just you know telling you that and saying believe me I want you to understand that so let's I want you to see that so let's draw in order for me to do this I have to draw some kind of a coordinate system so let's call X and let's call Y some kind of coordinate system alright so in this coordinate system I'm going to have a couple of points I want to find the distance between these two points so this point is point number one I'm going to call this P and it's going to be at coordinates x1 comma y1 now why am i labeling it x1 and well because this point can be anywhere I'm just putting it right there to illustrate it but really the point can be anywhere because I can measure the distance between any points I want I'm just drawing it here I mean the coordinate here is probably three comma two or three comma one but that doesn't matter it's really at some x coordinate X 1 and y coordinate y 1 that's what that means and I want to measure the distance between P I want to measure it compared to the two another point Q which has some coordinates x2 comma y2 so it's basically point x1 y1 and point x2 y2 again that I've drawn this thing probably like you know 10 comma 9 or something but doesn't matter I'm keeping all the coordinates basically general because it can be anywhere now ultimately I literally want to find the straight-line distance even though I can't draw a perfect straight line I'm sorry about that I guess I could try a little bit better I want to find the straight-line distance between these two points that's probably not that much better but you see if I got a straight edge out I could draw a straight line between them and say how many centimeters is it between P and Q now there is a formula that we're gonna learn but I want to show you where the formula comes from so what you we're gonna do is we're gonna say what are the actual coordinates let me switch colors here a little bit what are the coordinates of this point P well we already said it's x1 y1 right we said it was x1 y1 let me just double check one thing real quick yeah so if this is x1 y1 basically you can see this coordinate here is x1 and this coordinate here is y1 that's what it means to have coordinates x1 y1 right and then the this coordinates of Q here is X 2 and the y coordinate of this point Q over here is because I got to put this somewhere else why to right so I'm gonna put the Y little Y axis label up above like this so all I'm doing is showing you this is the coordinate of this point this is the cordon at this point in green just like this but if I really want to find the distance between them to make it all come into focus for you what I really should draw is the fact that this forms a triangle so this forms a base of a triangle here and I'm gonna draw this in blue I'm not gonna cover up the green to kind of kind of draw it in parallel here so you can see it kind of forms a right triangle notice this exactly it looks like the right triangle be drawn right here you have a longest side called C this is the distance between the points we care about but they're also these other sides of the triangle and there's a 90 degree angle here so when you have any two points like this it always has a 90 degree angle like this and you can always form a triangle like this and the distance between them is the distance that we want to actually calculate the distance in this case is PQ this is what we want to find the distance between a PQ well if we learn from the Pythagorean theorem that the longest side squared is equal to the other two sides of the triangle squared and added together then all we need to do is figure out what are the other sides of this triangle here and we can see it we can read it directly from the diagram what is the distance of this side of this triangle from here to here what would it be it's going to be the point x2 minus x1 like if this were at 9 and this were at 3 it'd be 9 minus 3 that would be the difference in the in the coordinates so that would be the distance here right and then this distance here is going to be what it's gonna be y2 minus y1 because that's the distance right here between these two points so this is y2 minus y1 like this so if you want to put numbers on it if this point were 10 and this point where Y is equal to 10 and Y is equal to 2 would be 10 minus 2 and you would have 8 units here so if you want to find or use the Pythagorean theorem C squared is a squared plus B squared what we're going to do is we're gonna say PQ the distance here squared is equal to this side here squared x2 minus x1 squared plus this distance here squared Y 2 minus y 1 quantity squared make sure you understand what I'm doing this is the magic this is the secret sauce of what I'm trying to show you we're gonna end up calculating and finding the distance formula which you've probably already seen before but I'm showing you that it comes exactly from the Pythagorean theorem the longest side of this triangle is PQ we're saying that distance squared is equal to this side of the triangle which is just x2 minus x1 squared plus this side of the triangle which is just y2 minus y1 squared so this is the Pythagorean theorem C squared is a squared plus B squared that's all it is now to find the distance of course right now we have PQ squared so what we have to do is take the square root of both sides so all we'll have is the distance PQ is equal to we have to take the square root of both sides so we take the square root of this side the square goes away here we have x2 minus x1 squared plus y2 minus y1 quantity squared now you may have remembered from algebra in the previous lessons that when you take the square root of both sides you have to put a plus or minus in front of the radical but what we have here is we're calculating distances when you have a distance between two points in the plane it's always going to be a positive number the distance between me and you is always going to be a positive number even if I'm going a negative direction the absolute value of the distance going in any direction is always positive so even though you're always taught to put this plus/minus here because we're talking about distances we never ever need the negative sign so basically it's always positive so because of that we don't even need to write the plus or minus at all we just say the distance is the square root of all of this stuff that's under there now in your books you're probably not going to see it written like that you're gonna see it written like this it's going to be called the distance formula and what it says is the distance D is x2 minus x1 squared plus y2 minus y1 squared and then take a nice big fat square root around the whole entire thing this is one of the most important things this is probably the central concept in this lesson the distance formula so if you want to find the distance between a point here in the XY plane and a point way over there in the XY plane all you do is you subtract the x-coordinates of the points and square it and then you subtract the Y coordinates of the points and square it you add those numbers together and then the last thing you do is you take a square root again most people just use because it's not that hard to use but they don't really know where it comes from it comes from the fact that these things always form triangles right triangles and so it comes from the Pythagorean theorem this distance formula is what we use to calculate the distance between points and space when you get to more advanced science like I told you about gravity modern theories of gravity we don't talk about just space we talk about space and time there's a very similar equation not exact but very close to this one called the it's called the distance formula in space-time it's really called the space-time metric really but it measures the distance between points in space and time and it looks really close to this as big radical has quantity squared it looks really similar to this there's a slight change to it I don't want to get into it right now it has to do with how time works but the bottom line is something that you think is kind of useless actually has far-reaching consequences so we measure the distance between points and space-time we measure the curvature of gravity by really using a very similar formula to this with space and time all mixed together all right so now what we want to do is we want to use this distance formula to calculate a couple of things in algebra here we want to find as an example the distance between the points negative 1 comma 2 and the point 3 comma 4 so obviously I could draw this on a XY plane I could plot them and I could draw the triangle I could do all the same stuff I just did but ultimately you don't need to do that anymore once you have the distance formula there's no reason to plot it every time you can just put the information directly into the distance formula knowing that it always works so that distance formula is what again it is x2 minus x1 squared plus y2 minus y1 quantity squared and I'd have to take the square root of the whole thing alright so now we have to put the values in here now here's the thing you have to subtract the values of X x coordinate of 1 point and x coordinate of another point so let's do it first one way and show you how it works let's take this is the next coordinate and here's another x coordinate so inside of here we'll say 3 - the minus sign comes from the distance formula then you have a negative one so you have a double negative there because it's a minus the minus one but then you have to square that and then you have to go the same way if you go from this point subtracting this point you have to go the y-values in the same direction 4 minus 2 quantity squared you can't mix up directions if you go this way subtracting you have to go this way on the other point there as well so then you have over here 3 minus a minus 1 is 3 plus 1 so you have 4 squared and then over here 4 minus 2 is 2 squared and so you have the square root of all of that so the distance between these points is 16 plus 4 which is the square root of 20 and so you have to ask yourself what is the square root of 20 well I can do a factor tree here right I can do 10 times 2 and 5 times 2 so I can have a circle a pair here so what I'm going to get is the distance this two comes out of the radical square root of 5 2 square root of 5 and that's the final answer so you say what is 2 square root of 5 mean well it means if I grab a sheet of paper and put XY tick marks on it let's say I measure it in meters or centimeters you pick is what the unit of the answer is going to be if I put the first coordinate at negative 1 centimeter and then up to centimeters and I put this one at 3 centimeters and up 4 centimeters then the distance if I measured it with a ruler between those points with literally putting a ruler between them would be 2 times the square root of 5 now you could put this in a calculator and get the decimal you would get some value in decimal but that would be in centimeters if you put the original points in terms of meters then the answer you get for the distance would be in meters if the points were in terms of lightyears then the answer you get would be light-years you see it doesn't it doesn't matter whatever units you use for the points is going to give you and dick dictate the units that you get in the answer between the two points now one more important thing I want to point out is that it doesn't matter which point is x 2 and which point is X 1 in this case I did 3 minus 2 minus 1 and then because of that I did 4 minus 2 2 but it doesn't matter which point is X 1 and which point is X 2 but you just have to be consistent for instance let's go the other direction so let's say instead of going calling this x2 in this x1 we'll flip it around and say this is X 2 and this is X 1 so we'll go the other directed this direction squared and then if we do it this direction we have to be consistent so we have to do 2 minus 4 quantity squared I want you to make sure that you understand that this is exactly backwards from what we did here the negative 3 minus the negative 1 is exactly backwards from negative 1 minus 3 and then the 4 minus 2 is exactly backwards of the 2 minus 4 but we're gonna get the same answer because what do we have here negative 1 minus 3 is negative 4 squared 2 minus 4 is negative 2 squared and you can see that the negatives it's not going to matter because everything is squared inside you're still gonna have the 16 you're still gonna have the 4 you're still gonna have the square root of 20 and so you're still gonna have 2 times the square root of 5 so the most important thing to realize for the distance formula is when you're calculating distances it does not matter which direction you subtract but you must be consistent if you pick a point and say this minus this for X then you must also pick the same direction for Y when you're doing the subtraction so we covered a lot so far we've covered the Pythagorean theorem we've shown you that when you draw these triangles on a flat board like this any way and it has a right 90 degree angle here then the Pythagorean holds C squared is a squared plus B squared we showed you that the distance formula comes from the Pythagorean theorem so this distance formula you get will hold for any points again in flat space we're not talking about black holes or gravity or neutron stars we're talking about on a chalkboard on a sheet of paper and we calculated the distance between two points and we showed you that it doesn't matter the direction used to do the subtraction so we're gonna do more problems but that's the general idea now the last thing we want to talk about is something called the midpoint formula some of you haven't been exposed to this and some of you haven't but it's really really simple to understand what we want to do is if we have two points like we did in the last part where we were finding the distance between them let's say we don't care about the distance we just want to figure out if we have two points in space where is the point between now of course I'm holding my fingers up so you know the point is somewhere here in the middle between them but not what I mean by where is the point I'm talking about if I give you the coordinates of two end points and you can put your finger in the middle of you know cutting the thing in half where is that point in terms of what are its coordinates that's called the midpoint of the two original points you have and so we have something called the midpoint formula now again I don't want to just blab it out for you I want you to understand where it comes from so we have something called the midpoint formula it's very easy to understand it's actually easier to understand than any of the other guys here so what we have here is let's go ahead and again draw an XY plane it's not going to be perfect so this is X and this is y and the same kind of thing I'm going to draw two random points here P and Q so when I call this again P this is x1 comma y1 exactly the same before and this thing we're going to call it Q it's going to be at some coordinates x2 comma y2 right now I know that there's a straight line that that connects these guys I mean I've drawn that I know how to calculate that that's covered with the distance formula right but I don't want to actually figure out the distance between them let's say I want to figure out where exactly is the midpoint of this line segments probably somewhere right around there it's hard for me to tell but there's a point somewhere here that's exactly midway between the two end points like if this were 5 centimeters and this were five centimeters and the whole thing will be 10 centimeters it's right in the middle I want to figure out what is the coordinates of this thing right how do I figure that out well first let's go take a look at point P what are the coordinates of P we already talked about this before this is x1 and over here is y1 right now we have some coordinate point Q and it's coordinates are X 2 and the y coordinate of this point is y sub 2 nothing has changed from before everything is exactly the same so my question to you is how can I figure out what this point is in the middle in terms of its coordinate how could I possibly figure that out well this point has to have some kind of X value and it has to have some kind of Y value and the way you figure out what the mid point is is you kind of forget about Y for a second you just look kind of if you could just look down from above then you would say the end point has some point along X here and the end point has some point along X here so midway between this thing has to be equal distance from here to here and from here to here so this point right here the X value of it has to be the average x2 minus x1 over 2 in other words the value of this x coordinate of the midpoint is the average of x2 and x1 in other words I mean if you think about it if I have the end point the x-coordinate of the end point is at 2 or let's make it easy if the end point is at 0 and the other endpoint is at 10 I'm talking along the x axis then we know halfway it's got to be at 5 so 10 plus 0 divided by 2 is 5 you're just averaging the two points if you pick any two points you want to find the middle of it you take the average that's what you do right so to find the middle in the x-direction you just average the x-coordinates and the exact same thing is going to happen over here the y-value here is going to be y2 minus y1 over to you just average the y-values so if I give you a point P and a point Q you can always tell me the bin point the midpoint is going to have an average of the X values for the x coordinate and an average of the Y values for the y coordinate so the midpoint of the segment joining P located at x1 y1 and q located at x2 comma y2 is this is the way it's written in a textbook and it's really confusing the way it's written a lot of times but this is a way it's usually written M represents the midpoint the x coordinate of that midpoint is x1 plus x2 over 2 that's the average of the x values the y coordinate is the average of the Y values let's put it just do it like this y1 plus y2 over 2 you see all this is saying it looks really confusing but all that's basically saying is the midpoint has an x value of the average of the x-coordinates and the Y value has the average of the y-coordinates so it's going to be easier to show with an example right what is the midpoint between the segment defined by 4 comma negative 6 and negative 3 comma 2 now of course I could plot 4 comma negative 6 and I could plot negative 3 comma 2 and I could put my finger in the middle and say aha it's about right there and do all that but I don't need to do that I mean I have the midpoint formula I know what it what it says and so the way to do this is you say okay the x-value of the midpoint is just going to be the average of these X values here so it's going to be 4 plus the negative 3 over 2 4 minus 3 is going to give you 1 and then you're gonna have it a 2 so the x the x value of the midpoint there is just at a location of 1/2 and then you're gonna have the Y value of the midpoint which is again the average of these guys here negative 6 plus 2 negative 6 plus 2 over 2 that's how you average things right so you're gonna get on top you're gonna get a negative 4 over 2 and then you're gonna get a negative 2 for this so what you would write down for your final answer is the midpoint exactly between these two the line segment joining these two points is gonna have an x coordinate of 1/2 and a y-coordinate of negative 2 and I promise you if you get some graph paper out and you plot this point you plot this point and you've then you look at this point it's gonna be right in the middle of the segment just like this all right so that was a long lesson I had to kind of cover it all together because in the next few lessons we're gonna have topics that kind of jumbled all of these concepts together so you have to know what what each of them all is and so we can do some more complicated problems Pythagorean theorem is something that is proven it is something that is just observed anytime you draw a triangle with a right 90 degree angle in one corner then you always know that this relation holds if you label the longest side C and the other two sides doesn't really matter then when you this equality holds again I showed you that in curved space I mean I didn't really show you but I'm telling you that in curved space this relationship doesn't hold right the angles inside the triangle also get distorted and looked weird as well and then when you we look at the distance formula you can see it comes directly from the Pythagorean theorem we did problems to calculate the distance between points we talked about it doesn't matter which direction you do the subtraction as long as you're consistent when you pick one direction you have to pick the other the same direction for the Y value and then we talked about the concept of midpoint between two points and the fact that it's just an average of the x-coordinates in the y-coordinates so I want you to undertake sure you understand these concepts follow me on to the next lesson we're going to do some more complicated problems dealing with the Pythagorean theorem the midpoint formula and the distance formula