---
title: Gauss's Lemma and Unique Factorization
module: Factorization and Polynomial Rings
moduleNumber: 7
lessonNumber: 3
order: 703
summary: >
  A UFD is not a field, so its polynomial ring is not a PID — yet unique
  factorization survives the passage from R to R[x]. Gauss's lemma supplies the
  passage: a polynomial that factors over the fraction field already factors over
  R, once content is factored out. This gives the theorem that R[x] is a UFD whenever R
  is, so Z[x] and Q[x,y] factor uniquely even though neither is a PID.
topics: [Factorization and Polynomial Rings]
sources:
  - book: Dummit & Foote
    ref: "Ch. 9 — Polynomial Rings; §9.3 Polynomial Rings that are Unique Factorization Domains"
  - book: Judson
    ref: "Ch. 17 — Polynomials; §17.3 Irreducible Polynomials; Ch. 18 §18.2 Factorization in Integral Domains"
draft: false
---

[Over a field](/abstract-algebra/factorization-and-polynomials/polynomial-rings-over-fields),
$F[x]$ is Euclidean and factorization is easy. Over a mere UFD $R$ the ring
$R[x]$ is never a PID — the ideal $(2, x)$ in $\mathbb{Z}[x]$ already needs two
generators — so the clean chain from
[the first lesson](/abstract-algebra/factorization-and-polynomials/euclidean-domains-pids-ufds)
gives nothing. Unique factorization nonetheless carries over:
if $R$ is a UFD then so is $R[x]$. The proof factors polynomials in the easy ring
$F[x]$, where $F$ is the fraction field of $R$, and then clears denominators back
into $R[x]$ without losing uniqueness. Gauss's lemma is the step that makes the
clearing of denominators honest.

## Content and primitive polynomials

Every polynomial over a UFD splits into a constant "size" and a shape with no
common factor.

> **Definition (Content, primitive).** Let $R$ be a UFD with fraction field $F$
> and let $p(x) \in R[x]$ be nonzero. The **content** $c(p)$ is a gcd of the
> coefficients of $p$, defined up to a unit. The polynomial is **primitive** if
> $c(p)$ is a unit, i.e. its coefficients have no common irreducible factor.

Factoring the content out writes $p(x) = c(p)\, p'(x)$ with $p'$ primitive, and
this decomposition is unique up to units. The two pieces carry different
information: the content records arithmetic in $R$, the primitive part records
the shape that governs irreducibility. For instance $7x$ in $\mathbb{Z}[x]$ has
content $7$ and primitive part $x$, so it is _reducible_ in $\mathbb{Z}[x]$
($7 \cdot x$), whereas over $\mathbb{Q}[x]$ the $7$ is a unit and $7x$ is
irreducible.

> **Worked example.** Content is multiplicative. Take $f = 2x + 4$ and
> $g = 3x + 3$ in $\mathbb{Z}[x]$, with contents $c(f) = 2$, $c(g) = 3$ and
> primitive parts $x + 2$, $x + 1$. Their product is
> $$
> fg = (2x + 4)(3x + 3) = 6x^2 + 18x + 12,
> $$
> with content $\gcd(6, 18, 12) = 6 = c(f)\,c(g)$ and primitive part
> $(x + 2)(x + 1) = x^2 + 3x + 2$, again primitive. The content of a product is
> the product of the contents.

$$
% caption: Every polynomial over a UFD factors uniquely as a content (a constant
% carrying all common coefficient factors) times a primitive polynomial (with
% coprime coefficients).
\begin{tikzpicture}[scale=1.0, >=stealth, font=\footnotesize,
  box/.style={draw, minimum height=9mm, align=center, inner xsep=3mm}]
\definecolor{acc}{HTML}{4A6FA5}
\node[box] (p) at (0,0) {$p(x) = 6x^2 + 15x + 9$};
\node[box, draw=acc, text=acc] (c) at (5.0,0.9) {content $= 3$};
\node[box, draw=acc, text=acc] (prim) at (5.4,-0.9) {primitive part $= 2x^2 + 5x + 3$};
\draw[->, acc] (p.east) -- (c.west);
\draw[->, acc] (p.east) -- (prim.west);
\node[anchor=west, black] at (8.6,0) {product recovers $p$};
\end{tikzpicture}
$$

## Gauss's lemma

The lemma controls how factorizations move between $R[x]$ and $F[x]$.

> **Lemma (Gauss).** Let $R$ be a UFD with fraction field $F$ and $p(x) \in
> R[x]$. If $p(x)$ is reducible in $F[x]$, then it is already reducible in
> $R[x]$. Precisely, if $p = A(x)B(x)$ with $A, B \in F[x]$ nonconstant, there
> are nonzero $r, s \in F$ with $rA, sB \in R[x]$ and $p = (rA)(sB)$ a
> factorization in $R[x]$.[^df93]

The proof clears denominators, then cancels them one prime at a time. Writing the
$F$-coefficients over a common denominator $d \in R$ gives $d\, p(x) = a'(x)
b'(x)$ with $a', b' \in R[x]$. If $d$ is a unit, rescale and finish. Otherwise
factor $d = \pi_1 \cdots \pi_k$ into irreducibles of $R$. The ideal $(\pi_1)$ is
prime (irreducible equals prime in a UFD), so $(R/\pi_1 R)[x]$ is a domain.
Reducing $d\, p = a'b'$ modulo $\pi_1$ gives $0 = \overline{a'}\,\overline{b'}$,
forcing one factor — say $\overline{a'}$ — to vanish, meaning every coefficient
of $a'$ is divisible by $\pi_1$. Cancel one $\pi_1$ from $d$ and from $a'$ and
repeat with $\pi_2, \dots, \pi_k$. When $d$ is exhausted, what remains is $p =
a(x)b(x)$ in $R[x]$ with $a, b$ scalar multiples of $A, B$.

A compact restatement is the multiplicativity of content: **a product of
primitive polynomials is primitive**, so $c(fg) = c(f)\,c(g)$ up to units. If
$f$ and $g$ were primitive but $fg$ had a common factor $\pi$ in all
coefficients, then reducing mod $\pi$ would give $\bar f \bar g = 0$ in the
domain $(R/\pi R)[x]$, so $\bar f = 0$ or $\bar g = 0$, contradicting
primitivity. Judson states the lemma in the concrete form for monic polynomials
in $\mathbb{Z}[x]$: a monic $p \in \mathbb{Z}[x]$ that factors into monic
polynomials of lower degree over $\mathbb{Q}$ already factors that way over
$\mathbb{Z}$.[^ju173]

$$
% caption: Gauss's lemma in content form: the content of a product equals the
% product of the contents, so multiplying two primitive polynomials keeps the
% result primitive.
\begin{tikzpicture}[scale=1.0, >=stealth, font=\footnotesize,
  box/.style={draw, minimum width=26mm, minimum height=9mm, align=center}]
\definecolor{acc}{HTML}{4A6FA5}
\node[box] (f) at (0,1) {$f$ primitive};
\node[box] (g) at (0,-1) {$g$ primitive};
\node[box, draw=acc, text=acc, thick] (fg) at (5,0) {$fg$ primitive};
\draw[->, acc] (f.east) -- (fg.west);
\draw[->, acc] (g.east) -- (fg.west);
\node[anchor=west, black, align=left] at (7.2,0)
  {content is\\multiplicative};
\end{tikzpicture}
$$

The lemma has a corollary that reduces irreducibility in $R[x]$ to
irreducibility in the friendlier ring $F[x]$.

> **Corollary.** Let $R$ be a UFD with fraction field $F$ and let $p(x) \in
> R[x]$ be primitive. Then $p$ is irreducible in $R[x]$ if and only if it is
> irreducible in $F[x]$. In particular a monic polynomial irreducible in $R[x]$
> is irreducible in $F[x]$.[^df93]

If $p$ is reducible in $F[x]$, Gauss's lemma makes it reducible in $R[x]$.
Conversely, if a primitive $p$ factors in $R[x]$, neither factor can be a
constant (a constant factor would divide the content, which is a unit), so both
have positive degree and the same factorization exhibits reducibility in $F[x]$.

## R a UFD implies R[x] a UFD

The pieces assemble into the main theorem.

> **Theorem.** $R$ is a UFD if and only if $R[x]$ is a UFD.[^df93]

One direction is quick: if $R[x]$ is a UFD, then the constant polynomials must
factor uniquely into irreducibles of degree $0$, so $R$ itself is a UFD. The
substantial direction assumes $R$ is a UFD with fraction field $F$ and factors an
arbitrary nonzero $p \in R[x]$.

$$
% caption: Lifting unique factorization from R to R[x]: split off the content,
% factor the primitive part in the Euclidean ring F[x], then use Gauss's lemma to
% pull that factorization back into R[x].
\begin{tikzpicture}[scale=1.0, >=stealth, font=\footnotesize,
  box/.style={draw, minimum width=42mm, minimum height=9mm, align=center}]
\definecolor{acc}{HTML}{4A6FA5}
\node[box] (p) at (0,3) {$p = c \cdot p_0$ in $R[x]$};
\node[box] (c) at (-3.2,1.6) {factor $c$ in the UFD $R$};
\node[box] (fx) at (3.2,1.6) {factor $p_0$ in $F[x]$};
\node[box, draw=acc, text=acc] (gauss) at (3.2,0.2) {Gauss: pull factors into $R[x]$};
\node[box, draw=acc, text=acc, thick] (out) at (0,-1.2) {unique factorization of $p$ in $R[x]$};
\draw[->, acc] (p) -- (c);
\draw[->, acc] (p) -- (fx);
\draw[->, acc] (fx) -- (gauss);
\draw[->, acc] (c) |- (out);
\draw[->, acc] (gauss) |- (out);
\end{tikzpicture}
$$

**Existence.** Split $p = d\, p'(x)$ where $d = c(p)$ and $p'$ is primitive.
Factor $d$ into irreducibles of $R$ (they stay irreducible in $R[x]$). Factor the
primitive $p'$ into irreducibles in the UFD $F[x]$; Gauss's lemma converts this
into a factorization of $p'$ in $R[x]$ whose factors are $F$-multiples of the
$F[x]$-factors. Because $p'$ is primitive, each of those factors is primitive,
hence irreducible in $R[x]$ by the corollary. So $p$ is a finite product of
irreducibles.

**Uniqueness.** Two factorizations of $p$ into irreducibles in $R[x]$, after
discarding the constant (content) factors handled by uniqueness in $R$, consist
of positive-degree primitive irreducibles. By the corollary these are
irreducible in $F[x]$, where factorization is unique, so the two lists match up
to associates in $F[x]$. A pair of primitive polynomials associate over $F$ —
one a nonzero $F$-scalar times the other — must be associate over $R$, because
comparing contents forces the scalar to be a unit of $R$. The factorizations
therefore agree up to units and order.

Induction extends the theorem to any number of variables.

> **Corollary.** If $R$ is a UFD, then $R[x_1, \dots, x_n]$ is a UFD for every
> $n$.[^df93]

A polynomial ring in $n$ variables is $R[x_1, \dots, x_{n-1}][x_n]$, so the
one-variable theorem applies inductively. This is the source of a stock of UFDs
that are _not_ PIDs.

| Ring | UFD? | PID? | separating fact |
| --- | --- | --- | --- |
| $\mathbb{Z}[x]$ | yes | no | $(2, x)$ is not principal |
| $\mathbb{Q}[x, y]$ | yes | no | $(x, y)$ is not principal |
| $F[x_1, \dots, x_n]$, $n \geq 2$ | yes | no | not a PID over a non-field |
| $F[x]$ | yes | yes | $F$ is a field |

## Factoring a primitive polynomial

The theorem turns into a procedure: split off the content, then factor the
primitive part.

> **Worked example.** Factor $f(x) = 12x^3 + 8x^2 - 3x - 2 \in \mathbb{Z}[x]$.
> The content is $\gcd(12, 8, 3, 2) = 1$, so $f$ is primitive and any
> factorization is a product of positive-degree pieces. Grouping,
> $$
> 12x^3 + 8x^2 - 3x - 2 = 4x^2(3x + 2) - (3x + 2) = (3x + 2)(4x^2 - 1)
> = (3x + 2)(2x - 1)(2x + 1).
> $$
> Each factor is primitive and linear, hence irreducible in $\mathbb{Z}[x]$; by
> the corollary they are irreducible in $\mathbb{Q}[x]$ as well.

No denominators appear, because $f$ was primitive to begin with. Had a
factorization over $\mathbb{Q}$ produced fractional coefficients, Gauss's lemma
would rescale each factor by a rational constant to land back in $\mathbb{Z}[x]$
while keeping the product equal to $f$.

## Factoring in Z[x] versus Q[x]

The corollary is the practical rule for hand computation: to factor a polynomial
with integer coefficients, it is enough to factor it over $\mathbb{Q}$ and then
account for content. The two rings differ only by units of $\mathbb{Q}$.

> **Worked example.** The same polynomial factors differently in the two rings.
> Its content is $\gcd(6, 15, 9) = 3$, so
> $$
> 6x^2 + 15x + 9 = 3\,(2x + 3)(x + 1).
> $$
> Over $\mathbb{Q}[x]$ the constant $3$ is a unit, so the factorization into
> nonunits is $(2x + 3)(x + 1)$. Over $\mathbb{Z}[x]$ the $3$ is irreducible, so
> the full factorization has three irreducible factors,
> $3 \cdot (2x + 3) \cdot (x + 1)$.

The UFD hypothesis on $R$ is not optional. Over the non-UFD ring $R =
\mathbb{Z}[2i] = \{a + 2bi\}$ the monic polynomial $x^2 + 1$ is irreducible in
$R[x]$ (its roots $\pm i$ are not in $R$), yet it factors as $(x - i)(x + i)$ in
$F[x]$, where $F = \mathbb{Q}(i)$. A monic polynomial irreducible in $R[x]$ but
reducible in $F[x]$ shows the corollary failing, and it certifies that $R =
\mathbb{Z}[2i]$ is not a UFD.[^df93]

[^df93]: **Dummit & Foote**, _Abstract Algebra_, §9.3 — Polynomial Rings that are Unique Factorization Domains: content and primitivity, Gauss's lemma (Proposition 5), the corollary equating irreducibility in $R[x]$ and $F[x]$ for primitive polynomials, the theorem that $R$ is a UFD iff $R[x]$ is, its extension to many variables, and the $\mathbb{Z}[2i]$ counterexample.
[^ju173]: **Judson**, _Abstract Algebra: Theory and Applications_, §17.3 — Irreducible Polynomials: Gauss's lemma stated for monic integer polynomials (Theorem 17.9), factoring over $\mathbb{Q}$ versus $\mathbb{Z}$, and the reduction of $\mathbb{Z}[x]$-irreducibility to $\mathbb{Q}[x]$-irreducibility.
