One of the most basic problems in Mathematics and Geometry in particular is finding the distance between two points on a graph. The technique of being able to calculate distance is a useful trick to know as it has a wide applicability. In this article I discuss how to calculate the shortest distance between two points on a 2D graph, 3D grid and a sphere. A knowledge of the formula to calculate distance between two points on a sphere can enable you to calculate the air travel distance between any two places on Earth, when you know their geographical latitude and longitude. The calculations for three dimensional grid lengths and graph lengths is simpler than calculating the distance on a sphere. I provide the required formulas for calculating distance between points in this article. Distance Between Two Points On a Graph Let us begin with the simplest case of finding the distance between points on a graph. The formula for calculating distance on a graph is based on the Pythagoras theorem. How is it so? To understand that, just draw points on a graph. Let the graph have a reference frame in the form of the X and Y axes intersecting with each other at the origin. Every point will have an X-Coordinate and a Y-coordinate. The X-coordinate is the distance of the point from the Y axis and Y-coordinate is the distance of the point from the X axis. Now draw perpendiculars from both points on both the axes. Then draw a straight line joining the two points. As you can see, the perpendiculars drawn from the points and the segment joining the two points form a right angled triangle. The distance between the two points is the length of the hypotenuse of the triangle. So using the Pythagorean theorem formula, you can easily calculate the distance. Here is the distance between two points formula for a graph. Distance Between Two Points [A(x1, y1), B (x2, y2)] = v[(x2 - x1)2 + (y2 - y1)2] To calculate the distance, you must know the coordinates of the two points. Then using the above formula, you can easily calculate the distance. You can create a 'distance between two points' calculator by doing a bit of programming in C and using the Pythagorean theorem formula above. Distance Between Two Points On a 3D Cartesian Grid The above formula can be used when you are calculating distance on a two dimensional graph, but what if the two points are situated on a three dimensional grid? To locate a point on this grid, you will have to know three coordinates instead of two. The formula for calculating this distance is a modification of the Pythagoras theorem formula for three dimensions. Here it is: Distance Between Two Points [A(x1, y1, z1), B(x2, y2, z2)] = v[(x2 - x1)2 + (y2 - y1)2 + (z2 - z1)2] The knowledge of three coordinates of both points will enable you to calculate distance. Distance Between Two Points On a Sphere Can the above formulas be used for calculating distance between two points on a sphere? No, absolutely not! That is because a sphere is not a flat surface and Euclidean geometry is not applicable there. It has a 'Curvature' which makes calculation difficult. That is why a complicated formula is required for calculating this distance. This formula can be used to calculate the great circle distance between two places on Earth (assuming the Earth is perfectly spherical, though it is not). The data you need is the knowledge of latitude and longitude of both those points and the radius of the sphere. Compared to the calculation below, calculating the volume of a sphere is simpler. The formula is as follows: Distance Between Two Points on a Sphere (D) = R x ?? where r is the radius of the sphere and ?? is the central angle subtended by the two points with the center of the sphere. The points are P (a1, b1) and Q (a2, b2) where a and b are latitude and longitude coordinates. ?? is calculated by using the following complicated formula (Also known as the Vincenty formula): ?? = arctan (A/B) where A = v[(cos a1 sin ?b)2 + (cos a2 sin a1 †sin a2 cos a1 cos ?b)2] and B = sin a2 sin a1 + cos a2 cos a1 cos ?b Here ?b = (b1 †b2). I can understand that your head may be spinning after reading this formula but there is no way that you can make it simpler. While using the formula convert the latitude and longitudes into radians before substituting values. Using it, you can calculate the shortest distance between any two points on Earth only if you know basic trignomtery and understand what the above math terms mean. Hope this article has cleared all your confusion regarding calculation of distance between two points. All you need to do is plug in the coordinates in the formulas provided above and calculate diligently.
Please Rate this Article 5 out of 54 out of 53 out of 52 out of 51 out of 5
Not yet Rated