# Quadratic form

In mathematics, a **quadratic form** is a polynomial with terms all of degree two ("form" is another name for a homogeneous polynomial). For example,

Quadratic forms occupy a central place in various branches of mathematics, including number theory, linear algebra, group theory (orthogonal group), differential geometry (Riemannian metric, second fundamental form), differential topology (intersection forms of four-manifolds), and Lie theory (the Killing form).

Quadratic forms are not to be confused with a quadratic equation, which has only one variable and includes terms of degree two or less. A quadratic form is one case of the more general concept of homogeneous polynomials.

Quadratic forms are homogeneous quadratic polynomials in *n* variables. In the cases of one, two, and three variables they are called **unary**, **binary**, and **ternary** and have the following explicit form:

The theory of quadratic forms and methods used in their study depend in a large measure on the nature of the coefficients, which may be real or complex numbers, rational numbers, or integers. In linear algebra, analytic geometry, and in the majority of applications of quadratic forms, the coefficients are real or complex numbers. In the algebraic theory of quadratic forms, the coefficients are elements of a certain field. In the arithmetic theory of quadratic forms, the coefficients belong to a fixed commutative ring, frequently the integers **Z** or the *p*-adic integers **Z**_{p}.^{[2]} Binary quadratic forms have been extensively studied in number theory, in particular, in the theory of quadratic fields, continued fractions, and modular forms. The theory of integral quadratic forms in *n* variables has important applications to algebraic topology.

Using homogeneous coordinates, a non-zero quadratic form in *n* variables defines an (*n*−2)-dimensional quadric in the (*n*−1)-dimensional projective space. This is a basic construction in projective geometry. In this way one may visualize 3-dimensional real quadratic forms as conic sections.
An example is given by the three-dimensional Euclidean space and the square of the Euclidean norm expressing the distance between a point with coordinates (*x*, *y*, *z*) and the origin:

A closely related notion with geometric overtones is a **quadratic space**, which is a pair (*V*, *q*), with *V* a vector space over a field *K*, and *q* : *V* → *K* a quadratic form on *V*.

The study of particular quadratic forms, in particular the question of whether a given integer can be the value of a quadratic form over the integers, dates back many centuries. One such case is Fermat's theorem on sums of two squares, which determines when an integer may be expressed in the form *x*^{2} + *y*^{2}, where *x*, *y* are integers. This problem is related to the problem of finding Pythagorean triples, which appeared in the second millennium B.C.^{[3]}

In 628, the Indian mathematician Brahmagupta wrote *Brāhmasphuṭasiddhānta*, which includes, among many other things, a study of equations of the form *x*^{2} − *ny*^{2} = *c*. In particular he considered what is now called Pell's equation, *x*^{2} − *ny*^{2} = 1, and found a method for its solution.^{[4]} In Europe this problem was studied by Brouncker, Euler and Lagrange.

In 1801 Gauss published *Disquisitiones Arithmeticae,* a major portion of which was devoted to a complete theory of binary quadratic forms over the integers. Since then, the concept has been generalized, and the connections with quadratic number fields, the modular group, and other areas of mathematics have been further elucidated.

Any *n*×*n* real symmetric matrix *A* determines a quadratic form *q*_{A} in *n* variables by the formula

Conversely, given a quadratic form in *n* variables, its coefficients can be arranged into an *n* × *n* symmetric matrix.

An important question in the theory of quadratic forms is how to simplify a quadratic form *q* by a homogeneous linear change of variables. A fundamental theorem due to Jacobi asserts that a real quadratic form *q* has an orthogonal diagonalization.^{[5]}

so that the corresponding symmetric matrix is diagonal, and this is accomplished with a change of variables given by an orthogonal matrix – in this case the coefficients *λ*_{1}, *λ*_{2}, ..., *λ*_{n} are determined uniquely up to a permutation.

There always exists a change of variables given by an invertible matrix, not necessarily orthogonal, such that the coefficients *λ*_{i} are 0, 1, and −1. Sylvester's law of inertia states that the numbers of each 1 and −1 are invariants of the quadratic form, in the sense that any other diagonalization will contain the same number of each. The **signature** of the quadratic form is the triple (*n*_{0}, *n*_{+}, *n*_{−}), where *n*_{0} is the number of 0s and *n*_{±} is the number of ±1s. Sylvester's law of inertia shows that this is a well-defined quantity attached to the quadratic form. The case when all *λ*_{i} have the same sign is especially important: in this case the quadratic form is called **positive definite** (all 1) or **negative definite** (all −1). If none of the terms are 0, then the form is called **nondegenerate**; this includes positive definite, negative definite, and indefinite (a mix of 1 and −1); equivalently, a nondegenerate quadratic form is one whose associated symmetric form is a nondegenerate *bilinear* form. A real vector space with an indefinite nondegenerate quadratic form of index (*p*, *q*) (denoting *p* 1s and *q* −1s) is often denoted as **R**^{p,q} particularly in the physical theory of spacetime.

Let *q* be a quadratic form defined on an *n*-dimensional real vector space. Let *A* be the matrix of the quadratic form *q* in a given basis. This means that *A* is a symmetric *n* × *n* matrix such that

where *x* is the column vector of coordinates of *v* in the chosen basis. Under a change of basis, the column *x* is multiplied on the left by an *n* × *n* invertible matrix *S*, and the symmetric square matrix *A* is transformed into another symmetric square matrix *B* of the same size according to the formula

by a suitable choice of an orthogonal matrix *S*, and the diagonal entries of *B* are uniquely determined – this is Jacobi's theorem. If *S* is allowed to be any invertible matrix then *B* can be made to have only 0,1, and −1 on the diagonal, and the number of the entries of each type (*n*_{0} for 0, *n*_{+} for 1, and *n*_{−} for −1) depends only on *A*. This is one of the formulations of Sylvester's law of inertia and the numbers *n*_{+} and *n*_{−} are called the **positive** and **negative** **indices of inertia**. Although their definition involved a choice of basis and consideration of the corresponding real symmetric matrix *A*, Sylvester's law of inertia means that they are invariants of the quadratic form *q*.

The quadratic form *q* is positive definite (resp., negative definite) if *q*(*v*) > 0 (resp., *q*(*v*) < 0) for every nonzero vector *v*.^{[6]} When *q*(*v*) assumes both positive and negative values, *q* is an **indefinite** quadratic form. The theorems of Jacobi and Sylvester show that any positive definite quadratic form in *n* variables can be brought to the sum of *n* squares by a suitable invertible linear transformation: geometrically, there is only *one* positive definite real quadratic form of every dimension. Its isometry group is a *compact* orthogonal group O(*n*). This stands in contrast with the case of indefinite forms, when the corresponding group, the indefinite orthogonal group O(*p*, *q*), is non-compact. Further, the isometry groups of *Q* and −*Q* are the same (O(*p*, *q*) ≈ O(*q*, *p*)), but the associated Clifford algebras (and hence pin groups) are different.

More concretely, an *n*-ary **quadratic form** over a field *K* is a homogeneous polynomial of degree 2 in *n* variables with coefficients in *K*:

This formula may be rewritten using matrices: let *x* be the column vector with components *x*_{1}, ..., *x*_{n} and *A* = (*a*_{ij}) be the *n*×*n* matrix over *K* whose entries are the coefficients of *q*. Then

Two *n*-ary quadratic forms *φ* and *ψ* over *K* are **equivalent** if there exists a nonsingular linear transformation *C* ∈ GL(*n*, *K*) such that

Let the characteristic of *K* be different from 2.^{[7]} The coefficient matrix *A* of *q* may be replaced by the symmetric matrix (*A* + *A*^{T})/2 with the same quadratic form, so it may be assumed from the outset that *A* is symmetric. Moreover, a symmetric matrix *A* is uniquely determined by the corresponding quadratic form. Under an equivalence *C*, the symmetric matrix *A* of *φ* and the symmetric matrix *B* of *ψ* are related as follows:

Thus, *b*_{q} is a symmetric bilinear form over *K* with matrix *A*. Conversely, any symmetric bilinear form *b* defines a quadratic form

and these two processes are the inverses of each other. As a consequence, over a field of characteristic not equal to 2, the theories of symmetric bilinear forms and of quadratic forms in *n* variables are essentially the same.

A quadratic form *q* in *n* variables over *K* induces a map from the *n*-dimensional coordinate space *K*^{n} into *K*:

The map *Q* is a homogeneous function of degree 2, which means that it has the property that, for all *a* in *K* and *v* in *V*:

When the characteristic of *K* is not 2, the bilinear map *B* : *V* × *V* → *K* over *K* is defined:

This bilinear form *B* is symmetric. That is, *B*(*x*, *y*) = *B*(*y*, *x*) for all *x*, *y* in *V*, and it determines *Q*: *Q*(*x*) = *B*(*x*, *x*) for all *x* in *V*.

When the characteristic of *K* is 2, so that 2 is not a unit, it is still possible to use a quadratic form to define a symmetric bilinear form *B*′(*x*, *y*) = *Q*(*x* + *y*) − *Q*(*x*) − *Q*(*y*). However, *Q*(*x*) can no longer be recovered from this *B*′ in the same way, since *B*′(*x*, *x*) = 0 for all *x* (and is thus alternating^{[8]}). Alternatively, there always exists a bilinear form *B*″ (not in general either unique or symmetric) such that *B*″(*x*, *x*) = *Q*(*x*).

The pair (*V*, *Q*) consisting of a finite-dimensional vector space *V* over *K* and a quadratic map *Q* from *V* to *K* is called a **quadratic space**, and *B* as defined here is the associated symmetric bilinear form of *Q*. The notion of a quadratic space is a coordinate-free version of the notion of quadratic form. Sometimes, *Q* is also called a quadratic form.

Two *n*-dimensional quadratic spaces (*V*, *Q*) and (*V*′, *Q*′) are **isometric** if there exists an invertible linear transformation *T* : *V* → *V*′ (**isometry**) such that

The isometry classes of *n*-dimensional quadratic spaces over *K* correspond to the equivalence classes of *n*-ary quadratic forms over *K*.

Let *R* be a commutative ring, *M* be an *R*-module, and *b* : *M* × *M* → *R* be an *R*-bilinear form.^{[9]} A mapping *q* : *M* → *R* : *v* ↦ *b*(*v*, *v*) is the *associated quadratic form* of *b*, and *B* : *M* × *M* → *R* : (*u*, *v*) ↦ *q*(*u* + *v*) − *q*(*u*) − *q*(*v*) is the *polar form* of *q*.

A quadratic form *q* : *M* → *R* may be characterized in the following equivalent ways:

The orthogonal group of a non-singular quadratic form *Q* is the group of the linear automorphisms of *V* that preserve *Q*: that is, the group of isometries of (*V*, *Q*) into itself.

If a quadratic space (*A*, *Q*) has a product so that *A* is an algebra over a field, and satisfies

Every quadratic form *q* in *n* variables over a field of characteristic not equal to 2 is equivalent to a **diagonal form**

Quadratic forms over the ring of integers are called **integral quadratic forms**, whereas the corresponding modules are **quadratic lattices** (sometimes, simply lattices). They play an important role in number theory and topology.

An integral quadratic form has integer coefficients, such as *x*^{2} + *xy* + *y*^{2}; equivalently, given a lattice Λ in a vector space *V* (over a field with characteristic 0, such as **Q** or **R**), a quadratic form *Q* is integral *with respect to* Λ if and only if it is integer-valued on Λ, meaning *Q*(*x*, *y*) ∈ **Z** if *x*, *y* ∈ Λ.

This is the current use of the term; in the past it was sometimes used differently, as detailed below.

Historically there was some confusion and controversy over whether the notion of **integral quadratic form** should mean:

This debate was due to the confusion of quadratic forms (represented by polynomials) and symmetric bilinear forms (represented by matrices), and "twos out" is now the accepted convention; "twos in" is instead the theory of integral symmetric bilinear forms (integral symmetric matrices).

Several points of view mean that *twos out* has been adopted as the standard convention. Those include: