Distance metric between two points on a sphere, Haversine formula versus 3D Cartesian surface distance Using the standard Haversine formula for calculating air distances on Earth, the distance between Cape Town (South Africa) and Juneau (Alaska) is calculated to be 16,638km.
However, we might also convert the spherical [r, lat, long] of the cities into 3D Cartesian coord [X, Y, Z] where origin is the center of the Earth.
Using discrete small steps, we might chop up the delta_lat and delta_long between Cape Town and Juneau into 1,000 small parts. Then, we can find the 3D-Cartesian coord [X,Y,Z] of each small part and calculate the normal Pythagorean distance between each, since the small parts are very nearly planar.
let resolution = 1000;

let del_lat = dlat/resolution;    
let del_lon = dlon/resolution;

let tot = 0;

for(let i=0; i<resolution; i++)
{
    let P1 = cartesian (lat1 + i*del_lat    , lon1 + i*del_lon    , RADIUS_EARTH);
    let P2 = cartesian (lat1 + (i+1)*del_lat, lon1 + (i+1)*del_lon, RADIUS_EARTH);
    
    tot += distance(P1, P2);
}

But, the answer using this method is calculated to be 18,137km. I couldn't understand what causes this difference? The second method basically chops the distance between Cape Town and Juneau into 1,000 small parts (I have tried 1,000,000 parts with same result), and calculate the standard Pythagorean ("ruler") distance in this small planar surface.
Method 2 should give the near exact Earth-surface distance between Cape Town and Juneau, no? If not, why?
Thank you for any help and pointers on this.
 A: The problem is that the points with spherical coordinates $(r, lat, lon)$ generated by
lat1 + i * del_lat
lon1 + i * del_lon

do not lie on the great circle from $(r, lat1, lon1)$ to $(r, lat2, lon2)$.  Instead, they lie on a different curve which is necessarily longer than the great circle.
A natural question to ask is whether we can easily generate points along the great circle.  The answer is yes, but it's more complicated than simple linear interpolation of latitude and longitude.  If you're interested, see the question Find a point along line on earth given initial point and distance
Edit added 1 Oct 2021:
To see that the arc produced by linear interpolation of (lat, lon) pairs does not usually agree with the great circle arc, consider a special case.  Suppose we have two points $A$ and $B$ in the northern hemisphere which lie on the same latitude.  In that case the interpolation arc is the line of latitude connecting the two points, but the great circle arc lies mostly to the north of that line, meeting the line only at $A$ and $B$.  (Remember that the great circle connecting $A$ and $B$ is the intersection of the plane through $A$, $B$, and the center of the sphere with the surface of the sphere.) This effect is most pronounced when $A$ and $B$ are separated by $180^{\circ}$ in longitude; in that case the great circle arc runs through the north pole, while the interpolating arc is still the line of constant latitude connecting the two points.
