The radar is a detection system that was developed before and during World War II for military uses, though by today it has many other applications including, for example, astronomical and geological research. The name radar is an acronym for RAdio Detection And Ranging, and as its name says, it uses radio waves to detect targets. In this post we will try to understand one of the basic ideas behind the operation of the radar, which while it seems quite simple at first glance, when we start to try to understand the details, we encounter an interesting problem. In order to solve it we will need to use a mathematical theorem first formulated by the Chinese mathematician Sunzi from the 3rd century AD.

For an English video version of this post – https://youtu.be/OoWoxBhixDI

For a Hebrew video version of this post – https://youtu.be/30CEOB_j3Ag

Let us begin with this basic idea. Suppose that we are in the control center of an airport and we want to find the distance of a nearby plane. In order to find this distance, we transmit a radio wave in the general direction of the plane, and once the wave hits the plane, it is reflected back, and is eventually captured by the receiver inside the radar. The radio wave is an electromagnetic radiation, and as such it moves at the speed of light which is km per second. If we let be how many seconds it took from transmitting the radio wave until receiving it, then the distance that the wave traveled is km. Since the wave needed to travel to the target and back, this means that the target was at distance km from the radar.

While this was a very simple computation, in real life, this is much more complicated. For example, maybe the wave is not strong enough to make it all the way to the target and back, there can be multiple targets, we can receive back waves from other objects which are not the intended targets (like the sea or earth), and many other problems. These are all interesting engineering problems, which contain in themselves mathematical ideas, but for this post we will ignore these problems and we will focus on another problem arising from a very simple reason – our targets move!

Consider again the wave that travels from the transmitter of the radar to the target plane. As we said before, when it hits the plane it get reflected and return to the radar. The problem is that in the end the radar only computes the distance to where the wave got reflected, but in the meanwhile the plane can move away from that location. It can also move outside of the range of our radar, or other planes can move inside the range, so we must update our data all the time.

At a first glance, this doesn’t seem to be too much of a problem, since instead of sending a single wave, we can just send many of them, one after the other, so that we will keep getting more and more updates. But here we encounter our problem – if we send the same type of wave again and again, then when the radar receives a wave back, it doesn’t know which is it from all the waves that it transmitted. And if the radar doesn’t know that, then it cannot compute the time it took the wave to go to the target and back, so our computation from before fails.

However, not all is lost. Let us number our waves using integers …,-2,-1,0,1,2,… and suppose that we transmit one wave every seconds. When the radar receives back a wave, it can always guess that it is the zero wave and compute the time from the moment it was transmitted until it received it back. If the guess was wrong and it was the -th wave instead, then the time would actually be . This means that instead of travelling km, the wave actually traveled km. In other words, we know the distance up to jumps which are multiples of .

This ambiguity might not be so bad. If for example is huge compared to the possible ranges that we consider, then we can always take the smallest positive number that we can write as . For example, if km and km, then the closest possible target will be at distance km, and otherwise it will be at least km away. If a plane is at km away from us, then it is not really close enough to worry about it. Furthermore, in real life, when a target is really far away, the signal is usually much too weak for the radar to receive, so we might as well assume that the distance is km. However, the whole point of sending more than one wave was to get good updates, and the smaller is, the more updates we get, so in general can be small. These days, there are radars which send more than 100,000 waves per second, so that , and therefore can be maybe a couple of kilometers, or even less than a kilometer, so it can be really crucial to know the exact location, and not up to these jumps of .

To summarize, if the radar uses a high frequency wave, namely if is very small, then we get really good updates, but on the other hand we only know the location up to small jumps of . If instead it uses a low frequency, namely is very large, then the jumps in would be very large, which is good, but it will have updates at slower intervals which is bad. Our problem now is to somehow find a way to get good updates on the one hand, but that these jumps would be really large on the other.

Let us formulate our problem mathematically. To simplify our problem, let us first choose a basic measure of distance, say 1 cm, and assume that all the distances that we have are multiples of it. In particular, our distances can be measured using integer numbers. If we let and , then the distance to the plane will be . This division by two doesn’t change the problem itself, so for simplification of notation, we will ignore it and just assume that the plane is at distance for some integer , namely and are the same up to some integer multiple of .

This type of relation is well known in mathematics, and is called congruence. In particular we say that and are the same modulo and we write it as or (mod ).

Now, for our radar problem, let us assume that we want to know the distance to the plane modulo at least km = cm, but we want good enough updates so that the wavelength is at at most cm.

The first approach is to send waves of length 1 cm which satisfy our conditions for good updates. We also make sure that the waves look different enough in the first 10 km, and only after this they can repeat themselves. For example, the waves are the same, the waves are the same, and so on. This answers both of our problems, since these waves are 1 cm apart, but once the radar receives a wave, it determines which type it is (i.e. which , such it belongs to ), and then the jumps are by 10 km. The problem with this approach is that we then need to create different type of waves, which is not that simple, not too mention that we also need to be able to differentiate between these many waves.

The second approach is to use some interesting properties of integers which are coprime, but before we define this property, let us see it in action.

Suppose that we send two types of waves, one at length and the second at length . This means that the radar know the exact location up to jumps of size and also jumps of size . This can be seen in the image below with the red and green points. Since the actual location of the plane is on one of the red and green points, we can restrict to this places, but as can be seen in the picture, these places are 6 cm apart from one another. In other words, if we know what is mod 2 and mod 3, then we also know what it is mod .

This was not special just to 2 and 3, and we can, for example, do it to the eight waves at lengths and cm, so if we know what is modulo each of these length, then we know what it is modulo the multiplication. This multiplication is already pretty large

So with just 8 different types of waves, we satisfy out two conditions, and actually get the location modulo almost 100 km (unlike previously where we used types of waves to get only modulo 10 km).

The result that we just used is called the Chinese Remainder Theorem (CRT). In our notation above, we can formulate it as follows:

**Definition**: Two integers are called coprime if their greatest common divisor (gcd) is 1, namely if ( divides ) and , then .

**The Chinese Remainder Theorem**: Let be two coprime integers. Then for any there is some such that if and , then .

In particular, distinct prime numbers are always coprime, so in our radar example, if we know what is modulo these 8 different primes, then the CRT tells us that we know what is modulo their product.

Before we prove CRT, we need a lemma which characterize coprime numbers. This lemma is usually seen in the first abstract algebra course you take (and sometimes even sooner), and is part of a much bigger theory of algebraic structures. However, I will show here only an elementary proof, without going into the theory behind it. In general, some of the ideas below might seem weird to someone who never learned any abstract algebra, though all of them are quite natural when learned in a proper way (and I might even write a post about it some day…).

**Lemma**: Let . Then are coprime if and only if there are such that .

**Proof**: Assume first that we can find such that . If , then it also divide the linear combination , and the only integers which divide 1 are . In other words, we get that are coprime.

On the other hand, assume that are coprime, and let be the smallest positive number which we can write as . If we can show that divides both and , then it must be 1 and we are done. We can always divide by and get a remainder, namely where . This means that

.

We chose to be the smallest positive combination of , and since we conclude that , or in other words divides . The same argument works for , so that must divide both and and we are done.

Now that we have this lemma, we can prove the CRT.

**Proof (Chinese Remainder Theorem):** Assume that are coprime and find such that . We first want to show that there is some integer such that and . The main trick is to note that is divisible by on the one hand, namely it is zero modulo , but on the other hand it is 1 modulo . This means that is zero mod and mod . We do the same trick with and we get that

satisfy both of our conditions (You should check this and make sure that you understand what happened here).

Now that we have at least one solution, we want to find all the other solutions. Lets say that there is another solution to both of our conditions and write . You can then check that and similarly , so that is divisible by both and . We claim that this means that is a multiple of which by our notations means that which is exactly what we wanted to prove.

By our assumption, we can write with . We can now get that

so that is a multiple of and we are done.

As I said before, the proofs above might seem like tricks to people unfamiliar with abstract algebra, though once one is used to the language and objects in this area, the process above becomes much more natural. In any way, we have only used some elementary congruence relations to prove the CRT, proving that our computation in the example of the radar was correct.

Even if you didn’t follow all of the computations above, there is one idea that is very important here. What the CRT tells us, is that if we want to solve the big problem of finding what is modulo , then it is enough to solve the two smaller problems of modulo and modulo . In other words, this approach is a sort of divide and conquer approach. If the smaller problems are easier (as it is usually the case) and we have such a theorem that tells us how to combine them all together, then we can usually use this approach to solve the bigger problem.

Congruence problems are quite common in mathematics, so that this divide and conquer approach in the CRT make it very useful, in particular in problems in number theory. In particular, what we usually do it to “divide” our congruence problems to modulo prime power (for example mod to mod , mod and mod $latex 5%), and then hope that we can solve the problem for each prime power case.

The CRT also has a more generalized form which is applicable in other places. For example, a very common process in the general sciences is polynomial extrapolation. Namely, there is a polynomial of some fixed degree that we want to find, but we are not given all the information about this polynomial (i.e. all the coefficients). On the other hand, we are given some “local” information – the value of the polynomial at certain points. A very early result in the studies of probably every engineering student is that a polynomial of degree has at most roots. This quickly implies that if two polynomials of degree have the same values at distinct points, then they must be the same. Once formulated in the language of rings, this results can be immediately seen to be a very close relative of the CRT we showed above, and actually the generalization of CRT almost includes this result.

One can even take this approach much further. Indeed, in the base of it, the Fourier transform which is used in signal processing all around the world, is just an infinite dimensional type of CRT. The Fourier transform tells us that when ever we have a periodic function (which is usually what we send in all those information wires which connect most of our thinking machines), this periodic function can be decomposed into “parts” which are the sines and cosines. Again, we see the usefulness of the divide and conquer approach – it is usually hard to work with a difficult periodic function, however it is much easier to work with a specific sine (or cosine) function.

In general, once you are used to working on mathematical problems (and problems in general), you learn to look for divide and conquer type results which decompose your problems to it basic blocks, in the hope that you can understand these blocks better. In particular, in the CRT we decompose to product coprime numbers. Since the product of small numbers can still be very large, what managed to show that with a very few different types of waves, we can get a lot of information.

Reblogged this on FPGA Base X and commented:

Wonder whether this can be used to triangulate a WiFi or Bluetooth device by reproducing the originally sent data from the package and then comparing it to what has been received. Then doing the CRM for coprime wavelengths within the given package!

Love this post. Had a similar idea for COVID-19 distance monitoring – in theory.