---
title: "Variable Extension of Ideals"
canonical: "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/PolynomialRingIdealOperations/variable-extension.html"
source: "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/PolynomialRingIdealOperations/variable-extension.md"
part: "Commutative Algebra"
chapter: "Polynomial Ring Ideal Operations"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Commutative Algebra", "source": "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/index-commutative-algebra.md"}
  - {"title": "Polynomial Ring Ideal Operations", "source": "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/PolynomialRingIdealOperations/index-polynomial-ring-ideal-operations.md"}
prev: {"title": "Elimination", "source": "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/PolynomialRingIdealOperations/elimination.md"}
next: {"title": "Homogenization of Ideals", "source": "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/PolynomialRingIdealOperations/homogenization.md"}
intrinsics:
  - {"name": "VariableExtension", "signature": "VariableExtension(I, k, b): RngMPol, RngIntElt, BoolElt -> RngMPol, Map"}
  - {"name": "VariableExtension", "signature": "VariableExtension(I, k, b, order): RngMPol, RngIntElt, BoolElt, ... -> RngMPol, Map"}
---

# Variable Extension of Ideals

Often one wishes to introduce new variables temporarily to a polynomial ring. Magma allows one to do this by use of the `VariableExtension` function, and also to restrict again to the original ring with elimination performed automatically.

<a id="function-dpoly-ideal-variableextension"></a>
## `VariableExtension(I, k, b): RngMPol, RngIntElt, BoolElt -> RngMPol, Map`

<a id="function-variableextension-rngmpol-rngintelt-boolelt"></a>
## `VariableExtension(I, k, b, order): RngMPol, RngIntElt, BoolElt, ... -> RngMPol, Map`

Given an ideal $I$ of the polynomial ring $P = R[x_1, \ldots, x_n]$, create a polynomial ring $Q$ as a $k$-variable extension of $P$, the ideal $J$ of $Q$ corresponding to $I$, and the embedding map $f: P \rightarrow Q$, and return $J$ and $f$.

If the argument $b$ (standing for “before”) is `true`, the $k$ variables are inserted before the current variables of $P$, so $Q$ is defined to be $R[y_1, \ldots, y_k, x_1, \ldots, x_n]$ and $f$ maps $P.i$ to $Q.(k+i)$ (so the $x_i$ variables of $P$ are mapped to the $x_i$ variables of $Q$).

If the argument $b$ is `false`, the $k$ variables are inserted after the current variables of $P$, so $Q$ is defined to be $R[x_1, \ldots, x_n, y_1, \ldots, y_k]$ and $f$ maps $P.i$ to $Q.i$ (so the $x_i$ variables of $P$ are mapped to the $x_i$ variables of $Q$).

If the argument order is given, then $Q$ is constructed with the specified order; otherwise, the `grevlex` order is used for $Q$ by default. See the section on monomial orders (Section [Representation and Monomial Orders](https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/GrobnerBases/order.md#dpoly-monomial-orders)) for the valid values for the argument order.

The image under $f$ of a polynomial of $P$ is the corresponding polynomial of $Q$, while the image under $f$ of an ideal of $P$ is the corresponding ideal of $Q$. The inverse image under $f$ of a polynomial of $Q$ is only defined if none of the extension variables of $Q$ occur in that polynomial, in which case the inverse image is just the restriction back to $P$, while the inverse image under $f$ of an ideal $H$ of $Q$ is always defined and is the restriction back to $P$ of the elimination ideal $H \cap R[x_1, \ldots, x_n]$.
