# Complementary sequences

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Complementary_sequences
> Markdown URL: https://mediated.wiki/source/Complementary_sequences.md
> Source: https://en.wikipedia.org/wiki/Complementary_sequences
> Source revision: 1254065717
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

Pairs of sequences

- *For complementary sequences in biology, see [complementarity (molecular biology)](/source/Complementarity_(molecular_biology)). For integer sequences with complementary sets of members see [Lambek–Moser theorem](/source/Lambek%E2%80%93Moser_theorem).*

In applied mathematics, **complementary sequences** (**CS**) are pairs of [sequences](/source/Sequence) with the useful property that their out-of-phase aperiodic [autocorrelation](/source/Autocorrelation) coefficients sum to zero. Binary complementary sequences were first introduced by [Marcel J. E. Golay](/source/Marcel_J._E._Golay) in 1949. In 1961–1962 Golay gave several methods for constructing sequences of length 2*N* and gave examples of complementary sequences of lengths 10 and 26. In 1974 R. J. Turyn gave a method for constructing sequences of length *mn* from sequences of lengths *m* and *n* which allows the construction of sequences of any length of the form 2*N*10*K*26*M*.

Later the theory of complementary sequences was generalized by other authors to polyphase complementary sequences, multilevel complementary sequences, and arbitrary complex complementary sequences. **Complementary sets** have also been considered; these can contain more than two sequences.

## Definition

Let (*a*0, *a*1, ..., *a**N* − 1) and (*b*0, *b*1, ..., *b**N* − 1) be a pair of bipolar sequences, meaning that *a*(*k*) and *b*(*k*) have values +1 or −1. Let the aperiodic [autocorrelation function](/source/Autocorrelation_function) of the sequence **x** be defined by

- R x ( k ) = ∑ j = 0 N − k − 1 x j x j + k . {\displaystyle R_{x}(k)=\sum _{j=0}^{N-k-1}x_{j}x_{j+k}.\,}

Then the pair of sequences *a* and *b* is complementary if:

- R a ( k ) + R b ( k ) = 2 N , {\displaystyle R_{a}(k)+R_{b}(k)=2N,\,}

for *k* = 0, and

- R a ( k ) + R b ( k ) = 0 , {\displaystyle R_{a}(k)+R_{b}(k)=0,\,}

for *k* = 1, ..., *N* − 1.

Or using [Kronecker delta](/source/Kronecker_delta) we can write:

- R a ( k ) + R b ( k ) = 2 N δ ( k ) , {\displaystyle R_{a}(k)+R_{b}(k)=2N\delta (k),\,}

So we can say that the sum of autocorrelation functions of complementary sequences is a delta function, which is an ideal autocorrelation for many applications like [radar](/source/Radar) [pulse compression](/source/Pulse_compression) and [spread spectrum](/source/Spread_spectrum) [telecommunications](/source/Telecommunications).

## Examples

- As the simplest example we have sequences of length 2: (+1, +1) and (+1, −1). Their autocorrelation functions are (2, 1) and (2, −1), which add up to (4, 0).

- As the next example (sequences of length 4), we have (+1, +1, +1, −1) and (+1, +1, −1, +1). Their autocorrelation functions are (4, 1, 0, −1) and (4, −1, 0, 1), which add up to (8, 0, 0, 0).

- One example of length 8 is (+1, +1, +1, −1, +1, +1, −1, +1) and (+1, +1, +1, −1, −1, −1, +1, −1). Their autocorrelation functions are (8, −1, 0, 3, 0, 1, 0, 1) and (8, 1, 0, −3, 0, −1, 0, −1).

- An example of length 10 given by Golay is (+1, +1, −1, +1, −1, +1, −1, −1, +1, +1) and (+1, +1, −1, +1, +1, +1, +1, +1, −1, −1). Their autocorrelation functions are (10, −3, 0, −1, 0, 1,−2, −1, 2, 1) and (10, 3, 0, 1, 0, −1, 2, 1, −2, −1).

## Properties of complementary pairs of sequences

- Complementary [sequences](/source/Sequences) have complementary spectra. As the autocorrelation function and the power spectra form a Fourier pair, complementary sequences also have complementary spectra. But as the Fourier transform of a delta function is a constant, we can write

- - S a + S b = C S , {\displaystyle S_{a}+S_{b}=C_{S},}

- where *C**S* is a constant.

- *S**a* and *S**b* are defined as a squared magnitude of the [Fourier transform](/source/Fourier_transform) of the sequences. The Fourier transform can be a direct DFT of the sequences, it can be a DFT of zero padded sequences or it can be a continuous Fourier transform of the sequences which is equivalent to the [Z transform](/source/Z_transform) for *Z* = *e**j*ω.

- CS spectra is upper bounded. As *S**a* and *S**b* are non-negative values we can write

- - S a = C S − S b < C S , {\displaystyle S_{a}=C_{S}-S_{b}<C_{S},}

- also

- - S b < C S . {\displaystyle S_{b}<C_{S}.}

- If either of the sequences of the CS pair is inverted (multiplied by −1) they remain complementary. More generally if any of the sequences is multiplied by *e**j*φ they remain complementary;

- If either of the sequences is reversed they remain complementary;

- If either of the sequences is delayed they remain complementary;

- If the sequences are interchanged they remain complementary;

- If both sequences are multiplied by the same constant (real or complex) they remain complementary;

- If alternating bits of both sequences are inverted they remain complementary. In general for arbitrary complex sequences if both sequences are multiplied by *e**j*π*kn*/*N* (where *k* is a constant and *n* is the time index) they remain complementary;

- A new pair of complementary sequences can be formed as [*a* *b*] and [*a* −*b*] where [..] denotes concatenation and *a* and *b* are a pair of CS;

- A new pair of sequences can be formed as {*a* *b*} and {*a* −*b*} where {..} denotes [interleaving](/source/Interleave_sequence) of sequences.

- A new pair of sequences can be formed as *a* + *b* and *a* − *b*.

## Golay pair

A complementary pair *a*, *b* may be encoded as polynomials *A*(*z*) = *a*(0) + *a*(1)*z* + ... + *a*(*N* − 1)*z**N*−1 and similarly for *B*(*z*). The complementarity property of the sequences is equivalent to the condition

- | A ( z ) | 2 + | B ( z ) | 2 = 2 N {\displaystyle \vert A(z)\vert ^{2}+\vert B(z)\vert ^{2}=2N\,}

for all *z* on the unit circle, that is, |*z*| = 1. If so, *A* and *B* form a **Golay pair** of polynomials. Examples include the [Shapiro polynomials](/source/Shapiro_polynomials), which give rise to complementary sequences of length a [power of two](/source/Power_of_two).

## Applications of complementary sequences

- Multislit spectrometry

- Ultrasound measurements

- Acoustic measurements

- [radar](/source/Radar) [pulse compression](/source/Pulse_compression)

- [Wi-Fi](/source/Wi-Fi) networks,

- [3G](/source/3G) [CDMA](/source/CDMA) wireless networks

- [OFDM](/source/OFDM) communication systems

- Train wheel detection systems[1][2]

- Non-destructive tests (NDT)

- Communications

- [coded aperture](/source/Coded_aperture) masks are designed using a 2-dimensional generalization of complementary sequences.

## See also

- [Binary Golay code](/source/Binary_Golay_code) ([Error-correcting code](/source/Error-correcting_code))

- [Gold sequences](/source/Gold_code)

- [Kasami sequences](/source/Kasami_code)

- [Polyphase sequence](/source/Polyphase_sequence)

- [Pseudorandom binary sequences](/source/Pseudorandom_binary_sequence) (also called [maximum length sequences](/source/Maximum_length_sequence) or M-sequences)

- [Ternary Golay code](/source/Ternary_Golay_code) ([Error-correcting code](/source/Error-correcting_code))

- [Walsh-Hadamard sequences](/source/Hadamard_code)

- [Zadoff–Chu sequence](/source/Zadoff%E2%80%93Chu_sequence)

## References

1. **[^](#cite_ref-1)** Donato, P.G.; Ureña, J.; Mazo, M.; Alvarez, F. "Train wheel detection without electronic equipment near the rail line". 2004. [doi](/source/Doi_(identifier)):[10.1109/IVS.2004.1336500](https://doi.org/10.1109%2FIVS.2004.1336500)

1. **[^](#cite_ref-2)** J.J. Garcia; A. Hernandez; J. Ureña; J.C. Garcia; M. Mazo; J.L. Lazaro; M.C. Perez; F. Alvarez. ["Low cost obstacle detection for smart railway infrastructures"](http://geintra-uah.org/system/files/private/IV04_I.pdf). 2004.

- [Golay, Marcel J.E.](/source/Marcel_J._E._Golay) (1949). "Multislit spectroscopy". *J. Opt. Soc. Am*. **39** (6): 437–444. [doi](/source/Doi_(identifier)):[10.1364/JOSA.39.000437](https://doi.org/10.1364%2FJOSA.39.000437). [PMID](/source/PMID_(identifier)) [18152021](https://pubmed.ncbi.nlm.nih.gov/18152021).

- Golay, Marcel J.E. (April 1961). "Complementary series". *IRE Trans. Inf. Theory*. **7** (2): 82–87. [doi](/source/Doi_(identifier)):[10.1109/TIT.1961.1057620](https://doi.org/10.1109%2FTIT.1961.1057620).

- Golay, Marcel J.E. (1962). "Note on "Complementary series"". *[Proc. IRE](/source/Proc._IRE)*. **50**: 84. [doi](/source/Doi_(identifier)):[10.1109/JRPROC.1962.288278](https://doi.org/10.1109%2FJRPROC.1962.288278).

- Turyn, R.J. (1974). ["Hadamard matrices, Baumert-Hall units, four-symbol sequences, pulse compression, and surface wave encodings"](https://doi.org/10.1016%2F0097-3165%2874%2990056-9). *J. Comb. Theory A*. **16** (3): 313–333. [doi](/source/Doi_(identifier)):[10.1016/0097-3165(74)90056-9](https://doi.org/10.1016%2F0097-3165%2874%2990056-9).

- [Borwein, Peter](/source/Peter_Borwein) (2002). [*Computational Excursions in Analysis and Number Theory*](https://books.google.com/books?id=A_ITwN13J6YC&pg=PA110). Springer. pp. 110–9. [ISBN](/source/ISBN_(identifier)) [978-0-387-95444-8](https://en.wikipedia.org/wiki/Special:BookSources/978-0-387-95444-8).

- Donato, P.G.; Ureña, J.; Mazo, M.; De Marziani, C.; Ochoa, A. (2006). "Design and signal processing of a magnetic sensor array for train wheel detection". *Sensors and Actuators A: Physical*. **132** (2): 516–525. [Bibcode](/source/Bibcode_(identifier)):[2006SeAcA.132..516D](https://ui.adsabs.harvard.edu/abs/2006SeAcA.132..516D). [doi](/source/Doi_(identifier)):[10.1016/j.sna.2006.02.043](https://doi.org/10.1016%2Fj.sna.2006.02.043).

---
Adapted from the Wikipedia article [Complementary sequences](https://en.wikipedia.org/wiki/Complementary_sequences) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Complementary_sequences?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
