Calculus &
Linear Algebra II

Chapter 19

19 Quadratic forms

By the end of this section, you should be able to answer the following questions:

  • What is a quadratic form?
  • How do you diagonalise quadratic forms?
  • How can you use diagonalisation of two variable quadratic forms to identify conic sections?
  • What are quadric surfaces?



19 Quadratic forms

This section presents a novel application of orthogonal diagonalisation as a way of identifying conic sections. We also mention the generalisation to three dimensions and how, in principle, we could identify quadric surfaces, although the details in this case can become quite messy.

The majority of this section is based on the section on quadratic forms in the MATH2001 recommended text “Elementary Linear Algebra (Applications Version)” by Anton and Rorres, pages 479-502.



19.1 Definition

Consider $n$ real variables $x_1, x_2, \ldots, x_n$. A function of the form $$\ds{\sum_{i=1}^n\sum_{j=1}^na_{ij}x_ix_j}$$ is called a quadratic form, where the $a_{ij}$ are real constants.

For example, the most general quadratic form in the variables $x$ and $y$ is $$ Q(x,y) = ax^2 + by^2 + cxy. $$



19.1 Definition

In the three variables $x$, $y$ and $z$, the most general quadratic form is $$ Q(x,y,z) = ax^2 + by^2 + cz^2 + dxy + exz + fyz, $$ where in both cases $a,b,c,d,e,f$ are all constants. It is possible to express quadratic forms in $n$ variables as a matrix product $\v^TA\v$, where $\v$ is a vector with the $n$ variables as entries and $A$ is a symmetric matrix.

The two variable quadratic form above can be expressed as $$ Q(x,y) = \mat{cc}{x & y}\mat{cc}{a & c/2 \\ c/2 & b}\mat{c}{x\\ y}. $$



19.1 Definition

The three variable quadratic form given above can be written as $$ Q(x,y,z) = \mat{ccc}{x & y & z}\mat{ccc}{a & d/2 & e/2\\ d/2 & b & f/2\\ e/2 & f/2 & c}\mat{c}{x\\ y\\ z}. $$ As an exercise, trying verifying this by expanding out both expressions. Observe that in both cases the diagonal entries of the matrix are the coefficients of the square terms and the off-diagonal entries in the matrix are the coefficients of the cross-terms.




19.1.1 Give the matrix representation of the quadratic form $2x^2+6xy-7y^2$

Note that the expression $2x^2+6xy-7y^2$ can be written as \[ \underbrace{ \left( \begin{array}{rr} x & y \end{array} \right) }_{{\large \v^T}} \underbrace{ \left( \begin{array}{rr} 2 & 3 \\ 3 & -7 \end{array} \right) }_{{\large A}} \underbrace{ \left( \begin{array}{r} x \\ y \end{array} \right) }_{{\large \v}} \] The matrix $A$ is symmetric. Then it is a unique symetric matrix representation.




19.2 Diagonalising quadratic forms

Since we know we can always orthogonally diagonalise a symmetric matrix, if we do this to the symmetric matrix in the matrix representation of the quadratic form, we can reduce the quadratic form to a sum of square terms.

We shall demonstrate this by example:

19.2.1 Express $\,-3x^2-2y^2-3z^2+2xy+2yz\,$ exclusively as a sum of square terms



19.2.1 Express $\,-3x^2-2y^2-3z^2+2xy+2yz\,$ exclusively as a sum of square terms

First, set $Q=-3x^2-2y^2-3z^2+2xy+2yz.$ Here we want to find a change of variables \[ \left( \begin{array}{r} x \\ y \\ z \end{array} \right) = P \left( \begin{array}{r} u \\ v \\ w \end{array} \right) \] where $P$ is an orthogonal matrix, such that \[ Q = \lambda_1u^2 + \lambda_2 v^2 + \lambda_3 w^2 \] in terms of the new variables $u,v,w.$



19.2.1 Express $\,-3x^2-2y^2-3z^2+2xy+2yz\,$ exclusively as a sum of square terms
Now $\;Q$ $=\,-3x^2-2y^2-3z^2+2xy+2yz$
$\ds =\underbrace{ \left( \begin{array}{rrr} x & y & z \end{array} \right) }_{{\large \v^T}} \underbrace{ \left( \begin{array}{rrr} -3 & 1 & 0 \\ 1 & -2 & 1 \\ 0 & 1 & -3 \end{array} \right) }_{{\large A}} \underbrace{ \left( \begin{array}{r} x \\ y \\ z \end{array} \right) }_{{\large \v}} $
$ \ds =\left( \begin{array}{rrr} u & v & w \end{array} \right) P^TAP \left( \begin{array}{} u \\ v \\ w \end{array} \right) $
$=\lambda_1u^2 + \lambda_2 v^2 + \lambda_3 w^2$


19.2.1 Express $\,-3x^2-2y^2-3z^2+2xy+2yz\,$ exclusively as a sum of square terms
$\;Q$ $=\lambda_1u^2 + \lambda_2 v^2 + \lambda_3 w^2$
$\ds = \left( \begin{array}{rrr} u & v & w \end{array} \right) \underbrace{ \left( \begin{array}{rrr} \lambda_1 & 0 & 0 \\ 0 & \lambda_2 & 0 \\ 0 & 0 & \lambda_3 \end{array} \right) }_{{\large D}} \left( \begin{array}{r} u \\ v \\ w \end{array} \right) $






19.2.1 Express $\,-3x^2-2y^2-3z^2+2xy+2yz\,$ exclusively as a sum of square terms

$Q\ds = \left( \begin{array}{rrr} u & v & w \end{array} \right) \underbrace{ \left( \begin{array}{rrr} \lambda_1 & 0 & 0 \\ 0 & \lambda_2 & 0 \\ 0 & 0 & \lambda_3 \end{array} \right) }_{{\large D}} \left( \begin{array}{r} u \\ v \\ w \end{array} \right) $

So we need to find the orthogonal matrix $P$ that orthogonally diagonalises $A$. That is $$P^TAP = D.$$




19.2.1 Express $\,-3x^2-2y^2-3z^2+2xy+2yz\,$ exclusively as a sum of square terms

$Q\ds = \left( \begin{array}{rrr} u & v & w \end{array} \right) \underbrace{ \left( \begin{array}{rrr} \lambda_1 & 0 & 0 \\ 0 & \lambda_2 & 0 \\ 0 & 0 & \lambda_3 \end{array} \right) }_{{\large D}} \left( \begin{array}{r} u \\ v \\ w \end{array} \right) $

From Example 18.2.4 we know that \[ P = \left( \begin{array}{rrr} \dfrac{1}{\sqrt{2}} & \dfrac{1}{\sqrt{6}} & \dfrac{1}{\sqrt{3}}\\ 0 & \dfrac{2}{\sqrt{6}} & -\dfrac{1}{\sqrt{3}}\\ -\dfrac{1}{\sqrt{2}} & \dfrac{1}{\sqrt{6}} & \dfrac{1}{\sqrt{3}} \end{array} \right)\;\; \text{ & } \;\; D = \left(\begin{array}{rrr}-3&0&0\\0&-1&0\\0&0&-4\end{array}\right) \]




19.2.1 Express $\,-3x^2-2y^2-3z^2+2xy+2yz\,$ exclusively as a sum of square terms

$Q\ds = \left( \begin{array}{rrr} u & v & w \end{array} \right) \underbrace{ \left( \begin{array}{rrr} \lambda_1 & 0 & 0 \\ 0 & \lambda_2 & 0 \\ 0 & 0 & \lambda_3 \end{array} \right) }_{D} \left( \begin{array}{r} u \\ v \\ w \end{array} \right),$ $\;\;\; P = \left( \begin{array}{crr} \dfrac{1}{\sqrt{2}} & \dfrac{1}{\sqrt{6}} & \dfrac{1}{\sqrt{3}}\\ 0 & \dfrac{2}{\sqrt{6}} & -\dfrac{1}{\sqrt{3}}\\ -\dfrac{1}{\sqrt{2}} & \dfrac{1}{\sqrt{6}} & \dfrac{1}{\sqrt{3}} \end{array} \right)\;\;\; \text{ & } \;\;\; D = \left(\begin{array}{rrr}-3&0&0\\0&-1&0\\0&0&-4\end{array}\right) $

Then $\ds \left( \begin{array}{r} x \\ y \\ z \end{array} \right) = P \left( \begin{array}{r} u \\ v \\ w \end{array} \right)$ $=\ds \left( \begin{array}{r} \dfrac{u}{\sqrt{2}} + \dfrac{v}{\sqrt{6}} + \dfrac{w}{\sqrt{3}}\\ \dfrac{2v}{\sqrt{6}} -\dfrac{w}{\sqrt{3}}\\ -\dfrac{u}{\sqrt{2}} + \dfrac{v}{\sqrt{6}} + \dfrac{w}{\sqrt{3}} \end{array} \right)\;$

$\text{and } \;Q=-3u^2-v^2-4w^2.$


19.3 Quadratic equations and conic sections

We now restrict our attention to two dimensions, by investigating quadratic equations, which are equations of the form $$ ax^2+by^2+cxy + dx+ey +f= 0, $$ where $a,b,c,d,e,f\in \R$.

Graphs of quadratic equations are known as conic sections, because they can be realised as the intersection of a plane and a double cone in three dimensions. The most interesting of these are the so-called non-degenerate conic sections¹.

¹There are also degenerate (points, lines) and imaginary (without real graphs) conic sections.


19.3 Quadratic equations and conic sections

A non-degenerate conic section is in standard position relative to the coordinate axes if its equation can be expressed in one of the following forms:

  • $\ds{\frac{x^2}{k^2}+\frac{y^2}{l^2}=1; \;k,l>0,}$
  • $\ds{\frac{x^2}{k^2}-\frac{y^2}{l^2}=1}$ or $\ds{\frac{y^2}{l^2}-\frac{x^2}{k^2}=1; \;k,l>0,}$
  • $x^2=ky$ or $y^2=kx; \;k\ne0.$

19.3 Quadratic equations and conic sections

The key observation here is that conic sections in standard form have no cross-terms. Given a quadratic equation with cross-terms in the associated quadratic form, we can change variables to remove the cross-terms by orthogonal diagonalisation.

Due to the defining property of rotation matrices, an orthogonal matrix $P$ always corresponds to a rotation, provided $\det(P)=1$ (not $-1$).




19.3 Quadratic equations and conic sections

Hence, we have the following:

Changing variables by orthogonal diagonalisation corresponds to a rotation of the coordinate axes. If $P$ is the orthogonal (rotation) matrix, then the new coordinates $(u,v)$ can be expressed in terms of the old coordinates $(x,y)$ as $$ \mat{c}{u \\ v} = P^T\mat{c}{x \\ y}. $$



19.3 Quadratic equations and conic sections

Another important observation is that there is never an occurance of $x^2$ and $x$ in the standard form (or $y^2$ and $y$). As a general rule, given a quadratic equation (even after changing variables from orthogonal diagonalisation), if we have terms such as $x^2$ and $x$ (or similar terms involving new variables) we can complete the square to be left with only a square term. We have the following:

Completing the square in a quadratic equation corresponds to translating (or shifting) the coordinate axes.

In summary, to identify a quadratic equation as a conic section, we follow these steps:



19.3 Quadratic equations and conic sections

In summary, to identify a quadratic equation as a conic section, we follow these steps:

1. Write the quadratic equation $$ ax^2+by^2 + cxy + dx+ ey+f=0 $$ in the matrix form $\mathbf x^TA\mathbf x + K\mathbf x + f=0$, where $\mathbf x =\mat{c}{x\\ y}$ and $K = \mat{cc}{d & e}$.
2. Find a matrix $P$ that orthogonally diagonalises $A$, so $A=PDP^T$. You may need to swap columns of $P$ to ensure that $\det(P)=1$ (and hence corresponds to a rotation).
3. Define new variables $u,v$ such that $\v = \mat{c}{u\\ v} = P^T\mathbf x$ $\Ra$ $\mathbf x=P\v$.


19.3 Quadratic equations and conic sections

4. Substitute $\v$ into the matrix form of the equation, giving $$ \v^TD\v + KP\v + f=0. $$
5. Complete the square if required. This is necessary if $u^2$ and $u$ are both present (or $v^2$ and $v$). This defines a new set of variables $s,t$ by translating $u,v$. The translations will be of the form $s=\alpha u+\beta$, $t=\gamma v + \delta$.
6. If it is a non-degenerate conic, the final equation in $s$ and $t$ should be a conic section in standard form.




19.3 Quadratic equations and conic sections
1. Write the quadratic equation $ ax^2+by^2 + cxy + dx+ ey+f=0 $ in the matrix form $\mathbf x^TA\mathbf x + K\mathbf x + f=0$, where $\mathbf x =\mat{c}{x\\ y}$ and $K = \mat{cc}{d & e}$.
2. Find a matrix $P$ that orthogonally diagonalises $A$, so $A=PDP^T$. You may need to swap columns of $P$ to ensure that $\det(P)=1$ (and hence corresponds to a rotation).
3. Define new variables $u,v$ such that $\v = \mat{c}{u\\ v} = P^T\mathbf x$ $\Ra$ $\mathbf x=P\v$.
4. Substitute $\v$ into the matrix form of the equation, giving $ \v^TD\v + KP\v + f=0. $
5. Complete the square if required. This is necessary if $u^2$ and $u$ are both present (or $v^2$ and $v$). This defines a new set of variables $s,t$ by translating $u,v$. The translations will be of the form $s=\alpha u+\beta$, $t=\gamma v + \delta$.
6. If it is a non-degenerate conic, the final equation in $s$ and $t$ should be a conic section in standard form.

19.3.1 Describe the conic whose equation is $x^2+y^2+2xy-3x-5y+4=0$

Step 1. First we rewrite the conic as follows

$\ds \left( \begin{array}{rr} x & y \end{array} \right) \underbrace{ \left( \begin{array}{rr} 1 & 1 \\ 1 & 1 \end{array} \right) }_{{\large A \text{ symmetric}}} \left( \begin{array}{r} x \\ y \end{array} \right) + \underbrace{\left( \begin{array}{rr} -3 & -5 \end{array} \right)}_{{\large K}} \left( \begin{array}{r} x \\ y \end{array} \right) + 4 = 0 $

Step 2. Find eigenvalues and eigenvectors of $A$.

$\ds \left| \begin{array}{rr} 1-\lambda & 1 \\ 1 & 1 -\lambda \end{array} \right| $ $\ds =\left(1-\lambda\right)^2-1 $ $= 0. $

$\;\Ra\; \lambda_1 = 2,\quad \lambda_2 =0. $



19.3.1 Describe the conic whose equation is $x^2+y^2+2xy-3x-5y+4=0$

Step 2. Find eigenvalues and eigenvectors of $A$.

$\;\Ra\; \lambda_1 = 2,\quad \lambda_2 =0. $

$\lambda_1 =2:$ $\quad \left(A-2I\right) \left( \begin{array}{r} x_1 \\ x_2 \end{array} \right) $ $ = \left( \begin{array}{rr} -1 & 1 \\ 1 & -1 \end{array} \right) \left( \begin{array}{r} x_1 \\ x_2 \end{array} \right) = \left( \begin{array}{r} 0 \\ 0 \end{array} \right) $

$\Ra\;$ $ -x_1 + x_2 =0 $ $ \;\Ra\; x_2 = x_1 $ $ \;\Ra\; \v_1 = \left( \begin{array}{r} 1 \\ 1 \end{array} \right). $

$\lambda_2 =0:$ $\quad \left(A-0I\right) \left( \begin{array}{r} x_1 \\ x_2 \end{array} \right) $ $ = \left( \begin{array}{rr} 1 & 1 \\ 1 & 1 \end{array} \right) \left( \begin{array}{r} x_1 \\ x_2 \end{array} \right) = \left( \begin{array}{r} 0 \\ 0 \end{array} \right) $

$\Ra\;$ $ x_1 + x_2 =0 $ $ \;\Ra\; x_2 = -x_1 $ $ \;\Ra\; \v_2 = \left( \begin{array}{r} 1 \\ -1 \end{array} \right). $



19.3.1 Describe the conic whose equation is $x^2+y^2+2xy-3x-5y+4=0$

Step 2. Find eigenvalues and eigenvectors of $A$.

$\;\Ra\; \lambda_1 = 2,\qquad\quad \lambda_2 =0. $

$ \Ra\; \v_1 = \left( \begin{array}{r} 1 \\ 1 \end{array} \right), \qquad \v_2 = \left( \begin{array}{r} 1 \\ -1 \end{array} \right). $

We check that $\v_1 \pd \v_2 = 0$. They are orthogonal! 😃

Since $\norm{\v_1} = \sqrt{2}, \; \norm{\v_2} = \sqrt{2},$ we have that

$\hat{\v}_1 = \dfrac{\v_1}{\norm{\v_1}} = \dfrac{1}{\sqrt{2}} \left( \begin{array}{r} 1 \\ 1 \end{array} \right) \;$ and $\;\hat{\v}_2 = \dfrac{\v_2}{\norm{\v_2}} = \dfrac{1}{\sqrt{2}} \left( \begin{array}{r} 1 \\ -1 \end{array} \right). $



19.3.1 Describe the conic whose equation is $x^2+y^2+2xy-3x-5y+4=0$

Step 2. Now we form the matrix $P= \left(\hat{\v}_1 ~|~ \hat{\v}_2 \right),$ i.e., $$ P = \dfrac{1}{\sqrt{2}} \left( \begin{array}{r} 1 & 1 \\ 1 & -1 \end{array} \right). $$

But note that $\text{det}(P) = -1.$ This is NOT a rotation! 😕 No problem! We just swap the columns to obtain \[ P = \left(\hat{\v}_2 ~|~ \hat{\v}_1\right) = \dfrac{1}{\sqrt{2}} \left( \begin{array}{rr} 1 & 1 \\ -1 & 1 \end{array} \right) \] so $\text{det}(P) = 1$ and now $P$ is a rotation! 😎



19.3.1 Describe the conic whose equation is $x^2+y^2+2xy-3x-5y+4=0$

Step 2. Now we form the matrix $P= \left(\hat{\v}_1 ~|~ \hat{\v}_2 \right),$ i.e., $ P = \dfrac{1}{\sqrt{2}} \left( \begin{array}{r} 1 & 1 \\ 1 & -1 \end{array} \right). $

But note that $\text{det}(P) = -1.$ This is NOT a rotation! 😕 No problem! We just swap the columns to obtain \[ P = \left(\hat{\v}_2 ~|~ \hat{\v}_1\right) = \dfrac{1}{\sqrt{2}} \left( \begin{array}{rr} 1 & 1 \\ -1 & 1 \end{array} \right) \] so $\text{det}(P) = 1$ and now $P$ is a rotation! 😎

Thus the matrix $P$ also orthogonally diagonalises $A$. That is,

$P^TAP $ $=D$ $=\left( \begin{array}{rr} 0 & 0 \\ 0 & 2 \end{array} \right)$ $\;\Ra\; A = PDP^T.$



19.3.1 Describe the conic whose equation is $x^2+y^2+2xy-3x-5y+4=0$

Step 3. We now write the new variable

$\w $ $= \left( \begin{array}{r} u \\ v \end{array} \right) $ $=P^T \left( \begin{array}{r} x \\ y \end{array} \right)$ $= \dfrac{1}{\sqrt{2}} \left( \begin{array}{rr} x - y \\ x+y \end{array} \right) .$

$\Ra\;$ $u = \dfrac{x-y}{\sqrt{2}}\;\;$ and $\;\;v = \dfrac{x+y}{\sqrt{2}}.$

Step 4. Consider the expression $\mathbf x^T A \mathbf x + K \mathbf x + 4 = 0.$

$\Ra\, \w^T P^T AP \w + K P \w + 4 =0 $ $ \Ra\, \w^T D \w + K P \w + 4 =0 $

$\Ra \, 2v^2 + \sqrt{2}u - 4 \sqrt{2} v + 4 = 0.$

$\Ra \; \sqrt{2}u + 2v^2 - 4 \sqrt{2} v + 4 = 0.$



19.3.1 Describe the conic whose equation is $x^2+y^2+2xy-3x-5y+4=0$

Step 5. In the expression $\sqrt{2}u + 2v^2 - 4 \sqrt{2} v + 4 = 0$, we complete the square in $v$. That is \[ \sqrt{2} u + 2v^2 - 4 \sqrt{2} v \, \underbrace{\,+ \,\;2\left(\sqrt{2}\right)^2 - 2 \left(\sqrt{2}\right)^2}_{{\large \text{adding }0}} + 4 =0. \] \[ \Ra\; \sqrt{2} u + \underbrace{2\left(v^2 - 2 \sqrt{2} v + \left(\sqrt{2}\right)^2\right)}_{{\large \text{factorise }2}} - 2 \left(\sqrt{2}\right)^2 + 4 =0. \] \[ \Ra\; \sqrt{2} u + 2\left(v - \sqrt{2}\right)^2 =0. \]



19.3.1 Describe the conic whose equation is $x^2+y^2+2xy-3x-5y+4=0$

Step 6. Note that $ \sqrt{2} u + 2\left(v - \sqrt{2}\right)^2 =0 $ is a non-degenerate conic.

Set $\;s=u\;$ and $\;t = v-\sqrt{2}$. Thus $$ \sqrt{2}s + 2t^2 = 0.$$

$\;\Ra\;s = - \sqrt{2}t^2.\quad$

A parabola! 😃




Diagonalisation of Quadratic forms: Geometric interpretation

Applet in GeoGebra site: Click here


Credits