0
$\begingroup$

Find n binary codes of length n such that distance between each pair is n/2 , where n is a even number , if possible?How to generate all codes? for example if n=4 we have 1110,1101,1011,0111 each pair have distance 2. Distance between a pair of code means number of different bits in both code words. For example 1110 and 1101 ,only last two bits are different so distance between this pair is 2.Here n<=100.

$\endgroup$

closed as off-topic by Will Jagy, Stefan Kohl, Stopple, Ryan Budney, Boris Bukh Sep 10 '15 at 1:10

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be about research level mathematics within the scope defined in the help center." – Will Jagy, Stefan Kohl, Stopple, Ryan Budney, Boris Bukh
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ I think you're asking about Hadamard matrices. $\endgroup$ – Anthony Quas Sep 9 '15 at 21:43
  • $\begingroup$ Can give some link about details how to generate Hadamard matrices for any n? $\endgroup$ – subrat singh Sep 9 '15 at 21:59
  • $\begingroup$ @subratsingh Have you seen these yet?wolfram,wiki $\endgroup$ – Henry.L Sep 10 '15 at 0:35
1
$\begingroup$

Hadamard code is indeed the answer you want. Hadamard matrices are conjectured to exist for all n which are multiples of 4. This is very hard to prove and a longstanding open problem. Sylvester Hadamard matrices can be explicitly constructed for all n which are positive integer powers of 2.

$\endgroup$
0
$\begingroup$

Well I would have commented, but I don't have 50 reputation so I have to post an answer :(

Here you can find some info about Hadamard code- https://en.wikipedia.org/wiki/Hadamard_code
Notice that the distance is always half the block length, as required.
As explained under the "Construction" category, the generator matrix for the Hadamard code of rank is constructed by listing all the binary strings of length k in lexicographical order as column vectors.
The example for k=3 is given in the wiki, and for k=4 you get

G =
| 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 |
| 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 |
| 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 |
| 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 |

Hope this helps :)

$\endgroup$
  • $\begingroup$ I don't think this answers the question as the OP was looking for a square matrix. $\endgroup$ – Anthony Quas Sep 9 '15 at 23:08
  • $\begingroup$ Well, using the generating matrix you can construct the code- Had(x) = x*G. So, if you go over all strings binary x of length k and multiply by G (of rank k), you will get the actual code. $\endgroup$ – mikibest2 Sep 10 '15 at 8:42
  • $\begingroup$ what the... I'm trying to help, how is this spam? I would have commented, but I don't have enough reputation so I'm forced to answer instead. BTW, my answer here is in the same direction as the other answer given, just more explanatory, and I actually posted it 2 minutes after the first guy because I didn't notice. $\endgroup$ – mikibest2 Sep 10 '15 at 23:14
  • 1
    $\begingroup$ @Arul: I don't think this is spam at all. I think in the end that the answer is not helpful because it constructs matrices of size $n\times 2^n$, whereas the OP wanted $n\times n$ matrices, but who hasn't given a wrong answer at some point? Also calling people spammers in public is probably not a good idea on a public forum. (Maybe you could delete your comment?) $\endgroup$ – Anthony Quas Sep 11 '15 at 0:09
  • $\begingroup$ ok sorry I will remove $\endgroup$ – user76479 Sep 11 '15 at 0:37

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