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.


  • $\begingroup$ Can you give an example of a set of vectors where your proposal fails, and what the answer ought to be? $\endgroup$ Aug 14, 2012 at 5:29
  • $\begingroup$ Will vectors that are self-orthogonal be problrmatic for your purposes? if not, could just do Gram-Schmidt without the normalization part. $\endgroup$ Aug 14, 2012 at 15:33

1 Answer 1


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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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