5
$\begingroup$

Suppose I have two quadratic forms $Q_i(x)=(x-a_i)^T A_i(x-a_i)+c_i$, $i=1,2$ where $x,a_i \in \Bbb{R}^n$ and $A_i$ are positive-definite $n\times n$ matrices.

Then $Q(x)=Q_1(x)+Q_2(x)$ is also a quadratic form, $Q(x)=(x-a)^T A(x-a)+c$, with $A=A_1+A_2$ (easy to see by considering just the quadratic terms).

How do I find $a$ and, especially, $c$?

$\endgroup$
0

3 Answers 3

6
$\begingroup$

$\min_x Q(x)=a$ so, taking the derivative, $$2A_1(a-a_1)+2A_2(a-a_2)=0$$ and

$$a=(A_1+A_2)^{-1}(A_1a_1+A_2a_2)$$

thus

$$c=Q(a)=Q_1(a)+Q_2(a)$$

$\endgroup$
4
  • $\begingroup$ It should be $A_1a_1 + A_2a_2$. (Should be symmetric with respect to $1$ and $2$). Also, your result is true only if $A_1$ and $A_2$ are symmetric. $\endgroup$
    – user17762
    Mar 29, 2013 at 17:52
  • $\begingroup$ @Marvis: thanks for catching the typo. Also, positive definite ==> symmetric $\endgroup$
    – sds
    Mar 29, 2013 at 17:58
  • $\begingroup$ I assume the OP is dealing with real matrices since he has $x,a_i \in \mathbb{R}$. In which case, positive definite need not mean symmetric; for instance, consider $A = \begin{bmatrix}1 & 1\\0 & 1 \end{bmatrix}$. The matrix $A$ is positive definite but not symmetric. $\endgroup$
    – user17762
    Mar 29, 2013 at 18:02
  • 1
    $\begingroup$ @Marvis: the OP is dealing with quadratic forms which are 1:1 with symmetric matrices. $\endgroup$
    – sds
    Mar 29, 2013 at 18:06
4
$\begingroup$

Let's turn to homogenous coordinates. For example, for $n=2$ you get

\begin{align*} Q(x) &= (x-a)^T\cdot A\cdot (x-a) + c \\ &= \begin{pmatrix}x_1\\x_2\\1\end{pmatrix}^T\cdot\begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ -a_1 & -a_2 & 1 \end{pmatrix}\cdot\begin{pmatrix} A_{1,1} & A_{1,2} & 0 \\ A_{2,1} & A_{2,2} & 0 \\ 0 & 0 & c \end{pmatrix}\cdot\begin{pmatrix} 1 & 0 & -a_1 \\ 0 & 1 & -a_2 \\ 0 & 0 & 1 \end{pmatrix}\cdot\begin{pmatrix}x_1\\x_2\\1\end{pmatrix} \\&= \begin{pmatrix}x_1\\x_2\\1\end{pmatrix}^T\cdot B \cdot\begin{pmatrix}x_1\\x_2\\1\end{pmatrix} \\ B &=\begin{pmatrix} A_{1,1} & A_{1,2} & -(A_{1,1}a_1 + A_{1,2}a_2) \\ A_{2,1} & A_{2,2} & -(A_{2,1}a_1 + A_{2,2}a_2) \\ -(A_{1,1}a_1 + A_{2,1}a_2) & -(A_{1,2}a_1 + A_{2,2}a_2) & A_{1,1}a_1^2 + (A_{1,2}+A_{2,1})a_1a_2 + A_{2,2}a_2^2 + c \end{pmatrix} \end{align*}

Now you can simply compute the sum of two or more $Q_i$ by adding their $B_i$ matrices. From the upper left $n\times n$ block you can directly deduce the $A$ matrix of the result, just as you already wrote in your question. From the first $n$ entries of the last column you can then deduce the offset vector $a$, since they form a linear system of equations in its coordinates once you know $A$. Other answers have explicitely formulated its solution this using matrix inversion. When you have both $A$ and $a$, you can use the bottom right element to obtain $c$.

$\endgroup$
1
$\begingroup$

We have $$Q_i(x) = x^T A_i x - a_i^T(A_i+A_i^T)x + a_i^T A_i a_i + c_i$$ \begin{align} Q_1(x) + Q_2(x) & = x^T(A_1 + A_2)x - (a_1^T(A_1+A_1^T) + a_2^T(A_2+A_2^T))x\\ & + a_1^T A_1 a_1 + c_1 + a_2^T A_2 a_2 + c_2\\ & = (x-a)^TA(x-a) + c = x^TAx - a^T(A+A^T)x + a^T A a + c \end{align} Comparing coefficients we get \begin{align} A & = A_1 + A_2 \tag{$\star$}\\ a & = (A_1+A_1^T+A_2+A_2^T)^{-1}(a_1^T(A_1+A_1^T) + a_2^T(A_2+A_2^T)) \tag{$\perp$}\\ c & = a_1^T A_1 a_1 + c_1 + a_2^T A_2 a_2 + c_2 - a^T(A_1+A_2)a \tag{$\dagger$}\\ \end{align} where the $a$ in dagger is given by $\perp$.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .