Mathematica Stack Exchange is a question and answer site for users of Mathematica. 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

The built in function:


where m is a list of vectors returns a orthogonal basis for m. However, I want to stick to the binary field. However, I tried this:


But this just still gives a set of vectors with negative coordinates.

Can anyone please help.


share|improve this question
Can you give an example of a set of vectors where your proposal fails, and what the answer ought to be? – J. M. Aug 14 '12 at 5:29
Will vectors that are self-orthogonal be problrmatic for your purposes? if not, could just do Gram-Schmidt without the normalization part. – Daniel Lichtblau Aug 14 '12 at 15:33
up vote 8 down vote accepted

Define the inner product modulo $2$:

orthogonalize[a_] := Mod[Orthogonalize[a, Mod[#1.#2, 2] &], 2]


(m = Union[orthogonalize[RandomInteger[{0, 1}, {500, 64}]] ]) // ArrayPlot

Orthogonal basis

Check orthogonality:

Mod[m . Transpose[m], 2] // ArrayPlot

enter image description here

share|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.