# How do I find my coordinates using x, y and z variables and trilateration?

For a school project, I was really interested in finding my own location using information from satellites, by using trilateration (so basically do what GPS are doing but by myself and with some math).I am very new in this topic and my research online is giving me all sorts of discouraging knowledge...

I found a website that could tell me the latitude, longitude and altitude of a satellite.

This website: https://in-the-sky.org/satmap_worldmap.php

So, at the end, I would have these 3 information pieces about 3 different satellites.

I was hoping to set equations with x,y and z but I don't know exacly how that would work when I'm trying to find my own coordinates.

I know that the distance = speed of light multiplied by the time.

Thank you so much!

• If you meant "without using a satellite navigation system like GPS" you should probably say so. – Starfish Prime Feb 22 at 8:52
• In general, to calculate your own location, you would need to know the precise locations of the satellites and their distances relative to you. The GPS system has each satellite broadcasting messages containing its own location and a clock reading, which can be corrected to be the same clock for all satellites. The clock readings coming from the various satellites give you a way to evaluate the relative distances of the satellites : if you receive a signal from satellite A saying it's 8:00:03.11123, and a signal from satellite B saying it's 8:00:03.00000, and you trust... – Nimloth Feb 22 at 13:47
• ... that their clocks are synchronised, then you can conclude that satellite B is farther away (its clock seems to be running late, so the radio signal took more time to reach you) and that it's 0.11123 light-seconds farther than satellite A. If you can gather this information from enough satellites at a given instant, you can calculate your own location at that instant. This is the heart of what a GPS receiver does. (In reality, both the position and time information are subject to various corrections to improve accuracy.) If you were using... – Nimloth Feb 22 at 13:48
• ... satellites that are not designed for this use (weather satellites, Sirius radio satellites, etc.), they would not be broadcasting their position and precise time information, so both the locations and the distances of the satellites would be difficult to evaluate with precision, and accordingly your evaluation of your own position would be much less precise. – Nimloth Feb 22 at 13:48
• @Nimloth, re, "...and their distances relative to you." But, that's not something that the receiver can measure. The only thing it actually can measure is the difference in the time signals coming from the various satellites. From the timing differences, the receiver can infer that satellite X is however many meters closer or futher away than satellite Y, but it can not know absolutely how many meters it is from either satellite until it has solved the entire system of equations and, has found its own location on the Earth. – Solomon Slow Feb 23 at 15:38

If you want to understand how GPS works, a good first step would be to learn how LORAN worked. https://en.wikipedia.org/wiki/Loran-C

In a nutshell, pairs of transmitting stations would send out synchronized radio signals, and by measuring the difference between the time of arrival of the signals from the two towers, a ship's navigator could know that they were somewhere on a certain hyperbolic curve (a.k.a., a "loran line") on the face of the Earth. That's because, the locus of all points for which the difference in the distances to two fixed points is constant is a hyperboloid.

There were multiple pairs of transmitting stations. A ship's navigator could use two different pairs to place the ship on two different loran lines on the map, and then they would know that the place where those two lines intersected must be the location of the ship.

GPS basically is the same thing except, the transmitting stations don't come in pairs, and they are moving overhead in different orbits at tens of thousands of miles per hour. The principle is similar, but the math is somewhat more complicated.

Basically, Each satellite continually broadcasts the parameters of its own orbit, and the time of day. The receiver calculates the differences in the times of arrival of the signals from several satellites, and by solving a large system of simultaneous equations that account for those time differences, for the motions of the satellites, for the rotation of the Earth, and also (because the calculations must be extremely precise) for the laws of relativity; it is able to work out its coordinates in a coordinate frame that is rigidly attached to the Earth.

The last step is where it transforms those coordinates into map coordinates using the system of your choice (e.g., WGS84 latitude and longitude, UTM, or whatever.)

There are other technical challenges besides just the math. A GPS receiver must be able to receive extremely faint signals, from at least four (preferably more) sources at the same time. It must be able to decode the signals using a complex "spread spectrum" technique. And it must be able to measure timing differences between those signals with a sub-microsecond level of precision. All that, and then do the math.

Building an actual, working GPS receiver from scratch might be a bit much for a school project.

• Oh wow there are a lot of technicalities! However, if we were to "skip" all of the time things, so to just go straight to the math and algebra, how would the equations work with the different information gotten from the website? I know that there has to be simultaneous equations but I don't really see how that would work and how to solve it... – alana Feb 23 at 15:20
• @alana, re, "how would the equations work with...information..from the web site?" Consider this: If you and I simultaneously look at the same web site, we both will get the same information. If we both take that same information, and use it in the same system of equations, then we both should get the same answer. But if the answer is a location, then why would it be your location, and not my location? – Solomon Slow Feb 23 at 15:44

The core idea is that each measurement you can make allows you to compute a curved surface on which the receiver must be located. Assemble multiple surfaces from different measurements, and look for the one point where all those surfaces intersect. Wherever that intersection is, your receiver must be at that point. There is an awful lot more to it than that, but that is the basic plan.

To locate a point in three dimensions, you need at least three constraints. If there are additional unknowns for which you would also like to solve, you need more constraints. GPS uses a minimum of four because you have to solve for not only your location, but also the time at which the measurements were made, because including a clock good enough to give decent answers by itself in the receiver hardware would make the things cost tens or hundreds of thousands of dollars and weigh hundreds of kilograms (chip-scale atomic clocks are starting to change this, but GPS was designed with 1970s hardware in mind).

Sometimes multiple measurements tell you to compute the same surface; this redundancy means you don't have enough surfaces until you get more some other way (waiting and trying again, measuring a signal from a different source, measuring a different aspect of a signal, etc.), so you can intersect them to find out where you are. Of course, in the real world, there is measurement error, so you will always be trying to solve slightly the wrong equations. This means there probably won't be one point in which all the surfaces intersect, because you've got the wrong surfaces. The standard solution is to overdetermine the system: make not the smallest number of measurements you can get away with, but make as many as you can in the time available, and use a mathematical optimization algorithm to find the one location most consistent with the whole set of observations. You must know the locations of some references, so that the measurements you make of signals sent from them can be converted to position; there is always some error in that knowledge. If your reference sources are moving (and if they are in orbit, they are moving very fast), you need to know a lot more, have data that's kept extremely current, and still have to live with a sometimes considerable amount of residual error due to bookkeeping all of that.

If you are measuring range from a known point, then your receiver must be located on the sphere with that radius centered on that known point (GPS is usually described this way, but since they have to solve for the clock bias, it's really closer to the LORAN case under the hood). If you are measuring time differences between two signals from two known points (as in LORAN), then your receiver must be located on the hyperboloid with foci those two points and asymptotic cone angle corresponding to the measured time difference. If you are measuring the Doppler shift applied to a signal from a fixed location by your satellite's orbit (the DORIS system), the surfaces are more complicated than conic sections, and depend on your velocity as well as your position, so you need to solve for at least six dimensions. If you are measuring the frequency difference of arrival between two different signals, the surface is given by an eighth-degree polynomial, having level sets that sometimes look like a banana, or a peanut, or a donut, or two pointy hats on a table, or a wide variety of other things.

Additional complications come from things like atmospheric propagation. For example, since the atmosphere refracts radio waves, they don't travel in straight lines, so the surface of constant travel time from emitter to receiver is not actually spherical. In GPS work, if you have a dual-frequency receiver, you can use the difference between the propagation effects on the two frequencies to infer total electron content along the signal travel path, and use that to figure out what the undistorted signal might have been if you were able to receive it without interference. This just scratches the surface of a very broad area of knowledge.