Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hi I am learning about Barker sequence. I have a problem, because I do not know, why for example 5, in Barker Code looks like this: +++-+. What is the base of this code. I am looking for some algorithm, because, I do not want to learn by hearth.

share|cite|improve this question
up vote 2 down vote accepted

You should look at wikipedia.

There you will find the definition: "A Barker code is a sequence of N values of +1 and −1, $a_j$ for $j= 1, 2, ..., N$ such that

$$|\sum_{j=1}^{N-v} a_ja_{j+v}| \le 1$$

for all $1 \le v < N$."

The Barker code for 3 is given by $+1$ $+1$ $-1$, i.e $a_1 = +1$, $a_2 = +1$, $a_3 = -1$. Here you can check that the definition works: if $v = 1$ you have that

$$|\sum_{j=1}^{3-1} a_ja_{j+1}| = |\sum_{j=1}^{2} a_ja_{j+1}| = | a_1a_2 + a_2a_3| = |1\cdot 1 + 1 \cdot (-1)| = 0 \le 1$$

And for $v = 2$ you have:

$$|\sum_{j=1}^{3-2} a_ja_{j+2}| = |a_1a_3| = |1\cdot (-1)| \le 1$$

Hence $+1$ $+1$ $-1$ is a correct Barker code for $3$.

So in Barker code, 5 is given by the sequence $+1$ $+1$ $+1$ $−1$ $+1$. This is just a sequence of numbers that works given your definition. You can check this by computing the 4 sums.

share|cite|improve this answer

As milcak said $1,1,1,-1,1$ satisfies the definition. You can also verify that the reversal of the sequence also works and the sequence obtained by multiplying the entire sequence by $-1$ also works.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.