# Simplify quadratic polynomial with matrix

I am reading a paper and have trouble following equation (3):

$$(\mathbf{x}-\mathbf{d})^T \mathbf{A}_1 (\mathbf{x}-\mathbf{d}) + \mathbf{b}^T_1 (\mathbf{x}-\mathbf{d}) + c_1 = \\ \mathbf{x}^T \mathbf{A}_1 \mathbf{x} + (\mathbf{b}_1 - 2 \mathbf{A}_1 \mathbf{d})^T \mathbf{x} + \mathbf{d}^T \mathbf{A}_1 \mathbf{d} - \mathbf{b}^T_1 \mathbf{d} + c_1$$ where $\mathbf{A}_1$ is symmetric.

What I get instead is (listing only the terms with $\mathbf{x}$) is for the first term: $$((\mathbf{x} - \mathbf{d})^T \mathbf{A}_1 \mathbf{x} - (\mathbf{x} - \mathbf{d})^T \mathbf{A}_1 \mathbf{d}) =\\ (((\mathbf{A}_1 \mathbf{x})^T \mathbf{x} - (\mathbf{A}_1 \mathbf{x})^T \mathbf{d}) - ((\mathbf{A}_1 \mathbf{d})^T \mathbf{x} - (\mathbf{A}_1 \mathbf{d})^T \mathbf{d}))^T = \\ \mathbf{x}^T \mathbf{A}_1 \mathbf{x} - \mathbf{d}^T \mathbf{A}_1 \mathbf{x} - \mathbf{x}^T \mathbf{A}_1 \mathbf{d}$$ and for the second term: $$\mathbf{b}^T_1 \mathbf{x}$$ so $$\mathbf{x}^T \mathbf{A}_1 \mathbf{x} - \mathbf{d}^T \mathbf{A}_1 \mathbf{x} - \mathbf{x}^T \mathbf{A}_1 \mathbf{d} + \mathbf{b}^T_1 \mathbf{x} + \dots$$

Is this already wrong or is there some step from this to the solution that I can not see?

Summands like $\mathbf d^T\mathbf A_1\mathbf x$ are scalars. Every scalar (viewed as a $1\times 1$ matrix) is equal to its transpose. Thus we have $\mathbf d^T\mathbf A_1\mathbf x = (\mathbf d^T\mathbf A_1\mathbf x)^T = \mathbf x^T\mathbf A_1^T\mathbf d$ etc..
• Thanks. And with $\mathbf{A}_1$ beeing symmetric it is clear. – tauran Apr 24 '14 at 15:10