---
title: "Reducing Vectors Relative to a Subspace"
canonical: "https://docs.magma-maths.org/v2.30-1/MatricesLinearAlgebra/VectorSpaces/reducing-vectors.html"
source: "https://docs.magma-maths.org/v2.30-1/MatricesLinearAlgebra/VectorSpaces/reducing-vectors.md"
part: "Matrices and Linear Algebra"
chapter: "Vector Spaces"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Matrices and Linear Algebra", "source": "https://docs.magma-maths.org/v2.30-1/MatricesLinearAlgebra/index-matrices-linear-algebra.md"}
  - {"title": "Vector Spaces", "source": "https://docs.magma-maths.org/v2.30-1/MatricesLinearAlgebra/VectorSpaces/index-vector-spaces.md"}
prev: {"title": "Basic Operations", "source": "https://docs.magma-maths.org/v2.30-1/MatricesLinearAlgebra/VectorSpaces/operation.md"}
next: {"title": "Bases", "source": "https://docs.magma-maths.org/v2.30-1/MatricesLinearAlgebra/VectorSpaces/basis.md"}
intrinsics:
  - {"name": "ReduceVector", "signature": "ReduceVector(W, v): ModTupRng, ModTupRngElt -> ModTupRngElt"}
  - {"name": "ReduceVector", "signature": "ReduceVector(W, ~v): ModTupRng, ModTupRngElt"}
  - {"name": "DecomposeVector", "signature": "DecomposeVector(U, v): ModTupRng, ModTupRngElt -> ModTupRngElt, ModTupRngElt"}
---

# Reducing Vectors Relative to a Subspace

<a id="function-reducevector-modtuprng-modtuprngelt"></a>
## `ReduceVector(W, v): ModTupRng, ModTupRngElt -> ModTupRngElt`

(Function.) Given a vector $v$ from a tuple module $V$ and a submodule $W$ of $V$, return the reduction of $v$ with respect to $W$ (that is, the canonical representative of the coset $v + W$).

Note that the reduction is done with respect to the standard inner product.

<a id="procedure-reducevector-modtuprng-modtuprngelt-2"></a>
## `ReduceVector(W, ~v): ModTupRng, ModTupRngElt`

(Procedure.) Given a vector $v$ from a tuple module $V$ and a submodule $W$ of $V$, replace $v$ with its reduction of with respect to $W$ (that is, the canonical representative of the coset $v + W$).

Note that the reduction is done with respect to the standard inner product.

<a id="function-decomposevector-modtuprng-modtuprngelt"></a>
## `DecomposeVector(U, v): ModTupRng, ModTupRngElt -> ModTupRngElt, ModTupRngElt`

Given a vector $v$ from a tuple module $V$ and a submodule $U$ of $V$, return the unique $u$ in $U$ and $w$ in the complement to $U$ in $U + <v>$ such that $v = u + w$.

Note that the reduction is done with respect to the standard inner product, and the complement noted above need not be orthogonal.
