Matrix form of a quadratic function with 3 variables

4.6k Views Asked by At

$$f(x,y,z)=x-2y+3z^2$$

When given this quadratic function, how would I write it in a matrix form?

I have been taught that any quadratic function can be rewritten into the form

$$Q(\vec{x}) = \vec{x}^T A \vec{x}$$

where A is a symmetric matrix. One example is:

$$x^2 + xy + y^2 + 2xz + 3z^2= \left(\begin{matrix}x & y & z\end{matrix}\right) \left(\begin{matrix}1 & \frac{1}{2} & 1\\ \frac{1}{2} & 1 & 0 \\ 1 & 0 & 3\end{matrix}\right) \left(\begin{matrix}x \\ y \\ z \end{matrix}\right) $$

But this doesn't seem to work when the function has something other than variables of power 2 and either xy, yz, or xz? For example, in my original problem, repeated below:

$$f(x,y,z)=x-2y+3z^2$$

What would I do with the x-2y?

1

There are 1 best solutions below

0
On

Split the funciton on the linear and quadratic parts. The first one could be rewrited as scalar product. The second one require simple matrix:

$f(x,y,z) = \begin{pmatrix} x & y & z\\ \end{pmatrix}\cdot\begin{pmatrix} 1\\ -2\\ 0\\ \end{pmatrix} + \begin{pmatrix} x & y & z\\ \end{pmatrix} A \begin{pmatrix} x\\ y\\ z\\ \end{pmatrix},$ where $A = \begin{pmatrix} 0 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 3\\ \end{pmatrix}$