In
multivariate statistics, if
is a
vector of
random variable
A random variable (also called random quantity, aleatory variable, or stochastic variable) is a mathematical formalization of a quantity or object which depends on random events. It is a mapping or a function from possible outcomes (e.g., the po ...
s, and
is an
-dimensional
symmetric matrix, then the
scalar
Scalar may refer to:
*Scalar (mathematics), an element of a field, which is used to define a vector space, usually the field of real numbers
* Scalar (physics), a physical quantity that can be described by a single element of a number field such ...
quantity
is known as a quadratic form in
.
Expectation
It can be shown that
:
where
and
are the
expected value
In probability theory, the expected value (also called expectation, expectancy, mathematical expectation, mean, average, or first moment) is a generalization of the weighted average. Informally, the expected value is the arithmetic mean of a l ...
and
variance-covariance matrix
In probability theory and statistics, a covariance matrix (also known as auto-covariance matrix, dispersion matrix, variance matrix, or variance–covariance matrix) is a square matrix giving the covariance between each pair of elements of ...
of
, respectively, and tr denotes the
trace of a matrix. This result only depends on the existence of
and
; in particular,
normality of
is ''not'' required.
A book treatment of the topic of quadratic forms in random variables is that of Mathai and Provost.
Proof
Since the quadratic form is a scalar quantity,
.
Next, by the cyclic property of the
trace operator,
:
Since the trace operator is a
linear combination of the components of the matrix, it therefore follows from the linearity of the expectation operator that
:
A standard property of variances then tells us that this is
:
Applying the cyclic property of the trace operator again, we get
:
Variance in the Gaussian case
In general, the variance of a quadratic form depends greatly on the distribution of
. However, if
''does'' follow a multivariate normal distribution, the variance of the quadratic form becomes particularly tractable. Assume for the moment that
is a symmetric matrix. Then,
:
.
In fact, this can be generalized to find the
covariance between two quadratic forms on the same
(once again,
and
must both be symmetric):
:
.
In addition, a quadratic form such as this follows a
generalized chi-squared distribution
In probability theory and statistics, the generalized chi-squared distribution (or generalized chi-square distribution) is the distribution of a quadratic form of a multinormal variable (normal vector), or a linear combination of different no ...
.
Computing the variance in the non-symmetric case
Some texts incorrectly state that the above variance or covariance results hold without requiring
to be symmetric. The case for general
can be derived by noting that
:
so
:
is a quadratic form in the symmetric matrix
, so the mean and variance expressions are the same, provided
is replaced by
therein.
Examples of quadratic forms
In the setting where one has a set of observations
and an
operator matrix
In statistics, the projection matrix (\mathbf), sometimes also called the influence matrix or hat matrix (\mathbf), maps the vector of response values (dependent variable values) to the vector of fitted values (or predicted values). It describes ...
, then the
residual sum of squares
In statistics, the residual sum of squares (RSS), also known as the sum of squared estimate of errors (SSE), is the sum of the squares of residuals (deviations predicted from actual empirical values of data). It is a measure of the discrepanc ...
can be written as a quadratic form in
:
:
For procedures where the matrix
is
symmetric and
idempotent, and the
errors are
Gaussian with covariance matrix
,
has a
chi-squared distribution with
degrees of freedom and noncentrality parameter
, where
: