Binary Autocorrelation Calculator
Calculate the autocorrelation of a binary sequence at a selected lag. Compare the sequence with its shifted version using bipolar binary mapping and view normalized autocorrelation, raw correlation, overlap, matches and mismatches.
Raw R(k) = Σ x[n] × x[n+k]
Normalized R(k) = Raw Sum ÷ (N – k)
-
-
-
What Is Binary Autocorrelation?
Binary autocorrelation measures how closely a binary sequence resembles a shifted version of itself. Instead of comparing two independent sequences, the same sequence is compared at two different positions separated by a selected lag.
Autocorrelation is useful when studying repetition, periodic structure and similarity inside binary sequences.
Binary Autocorrelation Formula
This calculator first converts the binary sequence into bipolar values:
Binary 1 → +1
For lag k, the raw autocorrelation is calculated from the overlapping samples:
The normalized autocorrelation used by this calculator is:
where N is the original sequence length.
Why Use Bipolar Binary Mapping?
Directly multiplying ordinary 0 and 1 values would cause every pair containing a zero to contribute zero. Bipolar mapping avoids this problem.
| Original Pair | Bipolar Pair | Product |
|---|---|---|
| 1 and 1 | +1 and +1 | +1 |
| 0 and 0 | -1 and -1 | +1 |
| 1 and 0 | +1 and -1 | -1 |
| 0 and 1 | -1 and +1 | -1 |
Therefore matching bits contribute +1 and different bits contribute -1.
Autocorrelation at Lag 0
Lag zero compares every bit with itself. Every pair therefore matches.
Lag: 0
Matches: 8
Raw autocorrelation: 8
Normalized autocorrelation: 8 / 8 = 1
For any non-empty valid sequence, the normalized autocorrelation at lag zero is 1 with this calculation method.
Binary Autocorrelation Example
Consider the repeating sequence:
At lag 2, the overlapping portions are:
Shifted: 101010
All six positions match.
Overlap: 6
Normalized: 6 / 6 = 1
This strong correlation reflects the repeating two-bit structure of the sequence.
Negative Autocorrelation Example
The same alternating sequence behaves differently at lag 1.
Original overlap: 1010101
Shifted overlap: 0101010
Every overlapping bit is opposite.
Normalized: -7 / 7 = -1
The negative value indicates complete opposition at that lag.
What Does Autocorrelation +1 Mean?
A normalized value of +1 means every bit in the two overlapping portions matches.
All overlapping bits agree.
This can occur at lag zero and can also occur at non-zero lags when the sequence contains a repeating structure.
What Does Autocorrelation -1 Mean?
A normalized autocorrelation of -1 means every overlapping binary bit is opposite after bipolar mapping.
Shifted: 01010
R(k): -1
What Does Autocorrelation Near Zero Mean?
A value near zero occurs when positive contributions from matching bits and negative contributions from mismatching bits approximately cancel.
Mismatches: 5
Raw: 5 – 5 = 0
Normalized: 0
The interpretation applies only to the selected lag.
What Is Lag?
Lag is the number of positions separating the two copies of the sequence being compared.
Lag 1: x[n] vs x[n+1]
Lag 2: x[n] vs x[n+2]
As lag increases, fewer positions remain available for comparison.
Overlap Length
This calculator performs non-circular autocorrelation. It does not wrap bits from the end of the sequence back to the beginning.
For a 10-bit sequence:
Lag 1 → 9 overlapping bits
Lag 2 → 8 overlapping bits
Lag 5 → 5 overlapping bits
Lag 9 → 1 overlapping bit
Raw vs Normalized Autocorrelation
Raw autocorrelation is the sum of the bipolar products. Its possible magnitude depends on the number of overlapping positions.
Normalized autocorrelation divides this sum by the overlap length.
| Measurement | Meaning | Range |
|---|---|---|
| Raw Autocorrelation | Sum of bipolar products | -L to +L |
| Normalized Autocorrelation | Raw value divided by overlap | -1 to +1 |
L represents the number of overlapping positions.
Matches, Mismatches and Autocorrelation
Because each matching pair contributes +1 and each mismatching pair contributes -1, raw autocorrelation can also be calculated as:
For example:
Mismatches: 3
Raw: 7 – 3 = 4
Overlap: 10
Normalized: 4 / 10 = 0.4
Binary Autocorrelation and Periodicity
One important use of autocorrelation is examining repeating structure. If a sequence repeats after a certain number of positions, its autocorrelation may become high at a lag corresponding to that repetition.
Repeating pattern: 10
Lag 2: R(2) = 1
A high value at one lag does not by itself prove a general statistical property, but it can reveal strong self-similarity at that displacement.
Autocorrelation of Pseudorandom Binary Sequences
Autocorrelation is commonly studied when evaluating pseudorandom and coding sequences. Different sequence families can have characteristic autocorrelation behavior at zero and non-zero lags.
This calculator gives the direct result for one selected lag. It does not automatically certify randomness, identify an LFSR polynomial or determine whether a sequence is cryptographically secure.
Binary Autocorrelation vs Cross-Correlation
The distinction between the two BinaryCon calculators is important.
| Calculator | Input | Purpose |
|---|---|---|
| Binary Autocorrelation | One sequence | Compare sequence with shifted copy of itself |
| Binary Cross-Correlation | Two sequences | Compare two different binary sequences at a lag |
They therefore serve different analysis tasks even though both use correlation concepts.
Binary Autocorrelation vs Sequence Period Calculator
Autocorrelation can reveal similarity at a particular lag, but it is not the same calculation as determining the exact fundamental period of a sequence.
Sequence period: What is the shortest repeating period?
The existing Binary Sequence Period Calculator handles the second task directly.
Applications of Binary Autocorrelation
Binary autocorrelation is relevant to digital communications, sequence analysis, coding theory, signal synchronization concepts, spread-spectrum systems, pseudorandom sequence analysis, digital hardware testing and communications education.
It can provide a compact way to examine whether a binary pattern resembles itself after a known displacement.
Non-Circular vs Circular Autocorrelation
This calculator deliberately uses non-circular autocorrelation.
Circular: Bits shifted beyond one end wrap around to the other end.
Circular autocorrelation is a different calculation and is not silently mixed into this tool.
Important Binary Autocorrelation Notes
Binary 0 is mapped to -1 and binary 1 is mapped to +1.
Matching bits contribute +1.
Mismatching bits contribute -1.
This is non-circular autocorrelation. Bits do not wrap around.
Lag must be a non-negative whole number.
The maximum valid lag is N – 1.
Overlap length equals N – lag.
Raw autocorrelation equals matches minus mismatches.
Normalized autocorrelation equals raw autocorrelation divided by overlap length.
Normalized autocorrelation ranges from -1 to +1.
At lag zero, normalized autocorrelation is always +1 for a valid non-empty sequence.
This tool does not calculate cross-correlation between two independent sequences, automatically search all lags, determine an exact sequence period or certify randomness.