How does one compute an ECEF vector? [closed]

I know how to compute an n-vector given the latitude and longitude of a location. I want to compute the ECEF (Earth-centered, Earth-fixed) vector of two positions so that I can subtract those vectors to obtain a vector between the two positions (I know somewhere out there there's a formula for finding this more directly, however for my uses I need to calculate it as a difference of two ECEF vectors). How is this done?

• Ae you asking how to do cartesian vector math or how to convert between cartesian and geodetic ? Both have mutliple examples all over the web. And strictly spoken, this is only very tangential geoscience ... – user20217 Jul 20 at 14:21