# How to find orthogonal subspace of a subspace

I have written a code:

n=4

V = VectorSpace(GF(2),n) C=[[0,0,1,0], [1,1,1,0]]

U = V.subspace(C)

How to find orthogonal subspace of U?

How to find orthogonal subspace of a subspace

I have written a code:

n=4

V = VectorSpace(GF(2),n) C=[[0,0,1,0], [1,1,1,0]]

U = V.subspace(C)

How to find orthogonal subspace of U?

add a comment

1

You can use the method `complement`

. In your case:

```
sage: U_perp = U.complement()
sage: U_perp
Vector space of degree 4 and dimension 2 over Finite Field of size 2
Basis matrix:
[1 1 0 0]
[0 0 0 1]
```

We can easily check that this is indeed the orthogonal complement:

```
sage: [ b*c for b in U_perp.basis() for c in U.basis() ]
[0, 0, 0, 0]
```

Please start posting anonymously - your entry will be published after you log in or create a new account.

Asked: ** 2021-10-14 20:52:10 +0200 **

Seen: **704 times**

Last updated: **Oct 15 '21**

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.